更新payutil

pull/1/head
张萌 3 years ago
parent de350805cd
commit 1455940627

@ -1,13 +1,12 @@
import 'dart:convert';
import 'package:aku_new_community/models/pay/pay_model.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:power_logger/power_logger.dart';
import 'package:tobias/tobias.dart';
import 'package:aku_new_community/models/pay/pay_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
enum PAYTYPE {
///
ALI,
@ -79,23 +78,22 @@ class PayUtil {
Future<bool> _confirmPayResult(String path, String code) async {
try {
int status = 0;
late BaseModel base;
for (var i = 0; i < 3; i++) {
await Future.delayed(Duration(milliseconds: 1000), () async {
Response response = await NetUtil().dio!.get(path, queryParameters: {
base = await NetUtil().get(path, params: {
"code": code,
});
status = response.data['status'] as int;
});
if (status == 2) {
if (base.success) {
break;
}
}
if (status == 2) {
if (base.success) {
BotToast.showText(text: '交易成功');
return true;
} else {
BotToast.showText(text: '交易失败 错误码${status}');
BotToast.showText(text: '交易失败');
return false;
}
} catch (e) {

@ -1,5 +1,4 @@
import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/order/order_list_model.dart';
import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart';
@ -10,6 +9,7 @@ import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/buttons/line_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -70,15 +70,18 @@ class _OrderCardState extends State<OrderCard> {
Future _pay() async {
Function cancel = BotToast.showLoading();
BaseModel baseModel =
await NetUtil().post(API.pay.jcookOrderCreateOrder, params: {
await NetUtil().post(SAASAPI.pay.createGoodsOrder, params: {
"addressId": widget.model.appGoodsAddressId,
"settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(),
"payType": 1, //
"payPrice": widget.model.payPrice
"payPrice": widget.model.payPrice,
"residentId": UserTool.userProvider.userInfoModel!.id,
"payname": UserTool.userProvider.userInfoModel!.name,
"payTel": UserTool.userProvider.userInfoModel!.tel,
});
if (baseModel.success) {
bool result = await PayUtil()
.callAliPay(baseModel.msg, API.pay.sharePayOrderCodeCheck);
.callAliPay(baseModel.msg, SAASAPI.pay.jcookOrderCheckAlipay);
if (result) {
Get.off(() => PayFinishPage());
}

Loading…
Cancel
Save