提交 01dbaaa7 作者: 王进

修改支付bug

上级 85db121b
...@@ -184,17 +184,19 @@ class WechatSDK { ...@@ -184,17 +184,19 @@ class WechatSDK {
if (res.data.order_type == 1) { // 新订单 if (res.data.order_type == 1) { // 新订单
that.MidasPaymentParams.buyQuantity = <number>(Params.money / 100) * <number>res.data.weixin_proportion // 充值金额 that.MidasPaymentParams.buyQuantity = <number>(Params.money / 100) * <number>res.data.weixin_proportion // 充值金额
this.printf("SDK -> 发起支付参数:", 0) this.printf("SDK -> 发起支付参数:", 0)
this.printf(that.MidasPaymentParams, 0) this.printf(that.MidasPaymentParams, 0);
// 调微信米大师支付接口 // 调微信米大师支付接口
that.pay(that.MidasPaymentParams) (wx as any).requestMidasPayment(that.deepCopy({}, that.MidasPaymentParams, {
.then(() => { // 支付成功 success: function (res) {
this.printf("SDK -> 支付成功:", 0) that.printf("SDK -> 支付成功:", 0)
this.printf(res, 0) that.printf(res, 0)
that.getCoins(that.deepCopy({}, that.sdkParams, { order_num: res.data.order_num })) that.getCoins(that.deepCopy({}, that.sdkParams, { order_num: res.data.order_num }))
}, err => { // 支付失败 },
this.printf("SDK -> 支付失败:", 0) fail: function (err) {
this.printf(err, 0) that.printf("SDK -> 支付失败:", 0)
}) that.printf(err, 0)
}
}));
} else { // 已有未完成订单,弹窗提示 } else { // 已有未完成订单,弹窗提示
const params = { const params = {
title: SDKConfig.shareTitle, title: SDKConfig.shareTitle,
...@@ -405,7 +407,7 @@ class WechatSDK { ...@@ -405,7 +407,7 @@ class WechatSDK {
// 米大师支付参数 // 米大师支付参数
private MidasPaymentParams = { private MidasPaymentParams = {
mode: 'game', // 支付的类型 mode: 'game', // 支付的类型
env: '1', // 米大师环境配置, 0:正式环境, 1:沙盒模式 env: '0', // 米大师环境配置, 0:正式环境, 1:沙盒模式
offerId: null, // 在米大师侧申请的应用id offerId: null, // 在米大师侧申请的应用id
currencyType: 'CNY', // 币种 currencyType: 'CNY', // 币种
platform: 'android', platform: 'android',
...@@ -501,24 +503,6 @@ class WechatSDK { ...@@ -501,24 +503,6 @@ class WechatSDK {
console.log(error) console.log(error)
}) })
} }
private async pay(params): Promise<any> {
const that = this
return new Promise((resolve, reject) => {
(wx as any).requestMidasPayment(that.deepCopy(params, {
success: function (res) {
resolve(res)
},
fail: function (res) {
reject(res)
},
complete: function () {
console.log("Rechare")
}
}))
}).catch((error) => {
console.log(error)
})
}
private shareInit() { private shareInit() {
(wx as any).showShareMenu({ (wx as any).showShareMenu({
withShareTicket: true, withShareTicket: true,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论