支付接口

master
戴余标 2 years ago
parent c6d424ceaa
commit 73224dcd0f

@ -20,11 +20,13 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) { if (flutterVersionName == null) {
flutterVersionName = '1.0' flutterVersionName = '1.0'
} }
def keystoreProperties = new Properties() def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties') def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) { if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
} }
apply plugin: 'com.android.application' apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

@ -6,12 +6,11 @@ class API {
///HOST ///HOST
static String get host { static String get host {
if (DevEV.instance.dev) { if (DevEV.instance.dev) {
return 'http://10.0.2.2:8088/'; // return 'http://10.0.2.2:8088/';
// return 'http://api.dxbs.vip'; return 'http://api.dxbs.vip';
} else { } else {
return 'http://10.0.2.2:8088/'; // return 'http://10.0.2.2:8088/';
return 'http://api.dxbs.vip/';
// return 'http://api.dxbs.vip/';
} }
} }

@ -10,6 +10,12 @@ import 'package:project_telephony/utils/headers.dart';
import 'package:tobias/tobias.dart'; import 'package:tobias/tobias.dart';
import 'package:fluwx/fluwx.dart' as fluwx; import 'package:fluwx/fluwx.dart' as fluwx;
import '../../constants/api.dart';
import '../../model/network/api_client.dart';
import '../../model/pay/wx_pay_model.dart';
import '../../utils/pay_util.dart';
import '../../utils/toast/cloud_toast.dart';
class MembersPage extends StatefulWidget { class MembersPage extends StatefulWidget {
const MembersPage({Key? key}) : super(key: key); const MembersPage({Key? key}) : super(key: key);
@ -40,9 +46,9 @@ List payWay = [
]; ];
class _MembersPageState extends State<MembersPage> { class _MembersPageState extends State<MembersPage> {
@override int nowPrice=1;
@override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Stack( body: Stack(
@ -84,15 +90,16 @@ class _MembersPageState extends State<MembersPage> {
if(!result){ if(!result){
Get.snackbar('提示', "请先安装支付宝"); Get.snackbar('提示', "请先安装支付宝");
}else{ }else{
aliPay("paySign").then((payResult) { _aliPay();
// map["paySign"] // aliPay("paySign").then((payResult) {
print("支付宝:$payResult"); // // map["paySign"]
if (payResult['resultStatus'] == '9000') { // print("支付宝:$payResult");
Get.snackbar('提示', "充值成功"); // if (payResult['resultStatus'] == '9000') {
} else { // Get.snackbar('提示', "充值成功");
Get.snackbar('提示', payResult['memo']); // } else {
} // Get.snackbar('提示', payResult['memo']);
}); // }
// });
} }
} }
} }
@ -206,20 +213,7 @@ class _MembersPageState extends State<MembersPage> {
return ; return ;
} }
// //
fluwx.payWithWeChat( _wxPay();
appId: "wxd930ea5d5a228f5f",
partnerId: "partnerId",
prepayId: "prepayId",
packageValue: "packageValue",
nonceStr: "nonceStr",
timeStamp: 1597927308,
sign: "sign");
fluwx.weChatResponseEventHandler.listen((event) { if(event.isSuccessful){
BotToast.showText(text: "微信支付成功");
}else{
BotToast.showText(text: "微信支付失败");
}
});
// var wxPayModel = WxPayModel.fromJson({ // var wxPayModel = WxPayModel.fromJson({
// "prepayId": "wx121434071826969924754d7d3309520000", // "prepayId": "wx121434071826969924754d7d3309520000",
// "partnerId": "1622850618", // "partnerId": "1622850618",
@ -253,22 +247,31 @@ class _MembersPageState extends State<MembersPage> {
// } // }
// } // }
// //
// Future _aliPayFunc() async { Future _aliPay() async {
// var base = await apiClient.request(API.user.wallet.assessRecharge, data: { var base = await apiClient.request(API.pay.alipay, data: {
// 'count': widget.count, // 'amount': nowPrice,//
// 'payType': 1, 'amount': 0.01,
// }); });
// if (base.code == 0) { if (base.code == 0) {
// var re = await PayUtil().callAliPay(base.data['content']); await PayUtil().callAliPay(base.data);
// if (re) { } else {
// _paySuccess(); CloudToast.show(base.msg);
// } else { }
// BotToast.closeAllLoading(); }
// } Future _wxPay() async {
// } else { var base = await apiClient.request(API.pay.wxpay, data: {
// CloudToast.show(base.msg); // 'amount': nowPrice,//
// } 'amount': 0.1,
// } });
if (base.code == 0) {
var wxPayModel = WxPayModel.fromJson(base.data);
await PayUtil().callWxPay(
payModel: wxPayModel,
);
} else {
CloudToast.show(base.msg);
}
}
// //
_getRecharge() { _getRecharge() {
@ -289,7 +292,7 @@ class _MembersPageState extends State<MembersPage> {
mainAxisSpacing: 20.w, mainAxisSpacing: 20.w,
callback: (item, index) { callback: (item, index) {
_chooseItem = item; _chooseItem = item;
// print(_piceList[index].pice); nowPrice=_piceList[index].pice;
setState(() {}); setState(() {});
}, },
pickItem: _chooseItem, pickItem: _chooseItem,

@ -1,3 +1,4 @@
import 'package:bot_toast/bot_toast.dart';
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -104,7 +105,9 @@ class _UserPageState extends State<UserPage> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () { onTap: () {
if(!userProvider.isLogin){
Get.to(() => const LoginPage()); Get.to(() => const LoginPage());
}
}, },
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -180,8 +183,11 @@ class _UserPageState extends State<UserPage> {
_getBotton() { _getBotton() {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// print(vle); if(userProvider.isLogin){
Get.to(() => const MembersPage()); Get.to(() => const MembersPage());
}else{
BotToast.showText(text: '您还未登录,请先登录!');
}
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w), padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 16.w),

@ -155,7 +155,7 @@ class PayUtil {
required WxPayModel payModel, required WxPayModel payModel,
}) async { }) async {
await payWithWeChat( await payWithWeChat(
appId: 'wx9bc3ffb23a749254', appId: 'wx3a0b41d12afef4e2',
partnerId: payModel.partnerId, partnerId: payModel.partnerId,
prepayId: payModel.prepayId, prepayId: payModel.prepayId,
packageValue: payModel.package, packageValue: payModel.package,

Loading…
Cancel
Save