提交 84a81d5e 作者: 王进

接入支付

上级 6398aac8
...@@ -134,7 +134,6 @@ class QQSDK { ...@@ -134,7 +134,6 @@ class QQSDK {
// SDK支付接口 // SDK支付接口
public async payOrder(Params, showSDKAlert = true) { public async payOrder(Params, showSDKAlert = true) {
const _selt = this; const _selt = this;
_selt.MidasPaymentParams.offerId = qq_SDKConfig.offerid;
_selt.LoadingOn(); _selt.LoadingOn();
// 支付前先获取用户订单状态,如果没有未完成订单则继续支付 // 支付前先获取用户订单状态,如果没有未完成订单则继续支付
let res = await _selt.sdkRequest(qqLinks.order, _selt.deepCopy({}, _selt.sdkParams, Params)).catch(err => { let res = await _selt.sdkRequest(qqLinks.order, _selt.deepCopy({}, _selt.sdkParams, Params)).catch(err => {
...@@ -144,9 +143,8 @@ class QQSDK { ...@@ -144,9 +143,8 @@ class QQSDK {
console.log("@@订单返回---->", res); console.log("@@订单返回---->", res);
_selt.LoadingOff(); _selt.LoadingOff();
if (res.code == 0) { if (res.code == 0) {
// 根据返回的用户订单状态判断是新订单还是未完成订单 _selt.MidasPaymentParams.prepayId = res.data.prepayId;
if (res.data.order_type == 1) { // 新订单 _selt.MidasPaymentParams.starCurrency = parseInt(res.data.starCurrency);
_selt.MidasPaymentParams.buyQuantity = <number>(Params.money / 100) * <number>res.data.weixin_proportion // 充值金额
console.log("@@SDK -> 发起支付参数:", _selt.MidasPaymentParams); console.log("@@SDK -> 发起支付参数:", _selt.MidasPaymentParams);
// 调微信米大师支付接口 // 调微信米大师支付接口
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
...@@ -185,16 +183,12 @@ class QQSDK { ...@@ -185,16 +183,12 @@ class QQSDK {
} }
if (showSDKAlert) _selt.sdkAlert(msg); if (showSDKAlert) _selt.sdkAlert(msg);
resolve(err.errCode); resolve(err.errCode);
},
complete: function (res) {
console.log('##SDK支付测试', res);
} }
})); }));
}); });
} else { // 已有未完成订单,弹窗提示
const params = {
title: qq_SDKConfig.shareTitle,
content: '订单发货中,请稍候下单..'
}
_selt.showModal(params);
}
} else if (res.code == 3023) { } else if (res.code == 3023) {
const params = { const params = {
title: '支付提示', title: '支付提示',
...@@ -268,13 +262,8 @@ class QQSDK { ...@@ -268,13 +262,8 @@ class QQSDK {
} }
// 米大师支付参数 // 米大师支付参数
private MidasPaymentParams = { private MidasPaymentParams = {
mode: 'game', // 支付的类型 prepayId: null,
env: qq_SDKConfig.midasPayEnv, // 米大师环境 starCurrency: null
offerId: null, // 在米大师侧申请的应用id
currencyType: 'CNY', // 币种
platform: 'android',
buyQuantity: 10, // buyQuantity * 游戏币单价 = 限定的价格等级(1,3,6,8,12,18,25,30,40,45,50,60,68,73,78,88,98,108,118,128,148,168,188,198,328,648)
zoneId: '1', // 分区ID,默认1
} }
//把字符串转换成json //把字符串转换成json
private toJson(str: string) { private toJson(str: string) {
......
...@@ -18,10 +18,6 @@ const qq_SDKConfig = { ...@@ -18,10 +18,6 @@ const qq_SDKConfig = {
appVersion: "产品版本号(cp)", // 产品版本号 appVersion: "产品版本号(cp)", // 产品版本号
offerid: "1450018223", // 支付
midasPayEnv: '1', // 米大师支付环境 0:正式环境, 1:沙盒模式
navPayEnv: 'trial', //切支付跳转方式 体验版:trial 开发版:develop 正式版:release navPayEnv: 'trial', //切支付跳转方式 体验版:trial 开发版:develop 正式版:release
shareTitle: "鲸鱼推广部", // 分享标题 shareTitle: "鲸鱼推广部", // 分享标题
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论