微调
This commit is contained in:
10
App.vue
10
App.vue
@@ -32,8 +32,8 @@
|
|||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
updata();
|
updata();
|
||||||
// 检测是否有未关闭苹果内购订单
|
// 检测是否有未关闭苹果内购订单
|
||||||
iap.getChannels();
|
// iap.getChannels();
|
||||||
console.log('引入了?');
|
// console.log('引入了?');
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
uni.getSystemInfo({
|
uni.getSystemInfo({
|
||||||
@@ -153,6 +153,12 @@
|
|||||||
|
|
||||||
},
|
},
|
||||||
onShow: function(e) {
|
onShow: function(e) {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
// updata();
|
||||||
|
// 检测是否有未关闭苹果内购订单
|
||||||
|
iap.getChannels();
|
||||||
|
// console.log('引入了?');
|
||||||
|
// #endif
|
||||||
// console.log(plus.runtime.arguments, 'plus.runtime.arguments-----')
|
// console.log(plus.runtime.arguments, 'plus.runtime.arguments-----')
|
||||||
// #ifdef MP-WEIXIN
|
// #ifdef MP-WEIXIN
|
||||||
//获取二维码携带的参数
|
//获取二维码携带的参数
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ if (process.env.NODE_ENV === 'development') {
|
|||||||
// socketUrl = "ws://localhost:6001/";
|
// socketUrl = "ws://localhost:6001/";
|
||||||
// baseUrl = "https://twin-ui.com/demo/";
|
// baseUrl = "https://twin-ui.com/demo/";
|
||||||
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
|
// baseUrl = "https://testapi.nuttyreading.com/"; // 线上测试环境
|
||||||
baseUrl = "https://api.nuttyreading.com/"; // 线上正式
|
// baseUrl = "https://api.nuttyreading.com/"; // 线上正式
|
||||||
// baseUrl = "http://192.168.110.100:9200/pb/"; // 开发用电脑
|
baseUrl = "http://192.168.110.100:9200/pb/"; // 开发用电脑
|
||||||
// baseUrl = "http://59.110.212.44:9200/pb/";
|
// baseUrl = "http://59.110.212.44:9200/pb/";
|
||||||
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
|
// baseUrl = "http://192.168.110.100:9100/pb/"; // 开发用电脑
|
||||||
// baseUrl = "http://192.168.110.110:9200/pb/";
|
// baseUrl = "http://192.168.110.110:9200/pb/";
|
||||||
|
|||||||
@@ -266,12 +266,13 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}else{
|
|
||||||
uni.showToast({
|
|
||||||
title:'支付环境不支持IAP',
|
|
||||||
icon:'none'
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
// else{
|
||||||
|
// uni.showToast({
|
||||||
|
// title:'支付环境不支持IAP',
|
||||||
|
// icon:'none'
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -329,7 +330,8 @@
|
|||||||
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
|
// 支付成功,result 为 IAP商品交易信息对象 IAPTransaction 需将返回的支付凭证传给后端进行二次认证
|
||||||
that.iapCheck(result)
|
that.iapCheck(result)
|
||||||
}, function(e) {
|
}, function(e) {
|
||||||
console.log('错误回调', e)
|
uni.hideLoading()
|
||||||
|
console.log('错误回调', e)
|
||||||
if (e.code == 2) {
|
if (e.code == 2) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'取消支付,内购订单即将关闭',
|
title:'取消支付,内购订单即将关闭',
|
||||||
@@ -342,6 +344,7 @@
|
|||||||
})
|
})
|
||||||
console.log('其他支付错误',e);
|
console.log('其他支付错误',e);
|
||||||
}
|
}
|
||||||
|
that.restoreComplateRequest()
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
iapCheck(result) {
|
iapCheck(result) {
|
||||||
@@ -367,14 +370,15 @@
|
|||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
},
|
},
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
console.log(JSON.stringify(res))
|
// console.log(JSON.stringify(res))
|
||||||
if (res.code == 0) {
|
if (res.code == 0) {
|
||||||
|
|
||||||
uni.hideLoading()
|
uni.hideLoading()
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title:'充值成功!',
|
title:'充值成功!',
|
||||||
icon:'success'
|
icon:'success'
|
||||||
})
|
})
|
||||||
console.log("充值订单已处理,请留意账户金额变动....");
|
console.log("充值订单已处理,请留意账户金额变动....",res);
|
||||||
that.finishTransaction(result);
|
that.finishTransaction(result);
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
|||||||
Binary file not shown.
@@ -17,14 +17,13 @@ var iap = {
|
|||||||
console.log('检测支付通道')
|
console.log('检测支付通道')
|
||||||
plus.payment.getChannels(async (channels) => {
|
plus.payment.getChannels(async (channels) => {
|
||||||
for (var i in channels) {
|
for (var i in channels) {
|
||||||
|
console.log("channels",channels, );
|
||||||
// 判断是否苹果支付1
|
// 判断是否苹果支付1
|
||||||
if (channels[i].id === "appleiap") {
|
if (channels[i].id === "appleiap") {
|
||||||
console.log("存在苹果内购channels",channels, );
|
console.log("存在苹果内购channels",channels, );
|
||||||
that.iapChannel = channels[i];
|
that.iapChannel = channels[i];
|
||||||
// 先检测有没有未完成的订单
|
// 先检测有没有未完成的订单
|
||||||
that.restoreComplateRequest()
|
that.restoreComplateRequest()
|
||||||
}else{
|
|
||||||
console.log('安卓客户端');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -50,7 +49,7 @@ var iap = {
|
|||||||
// return false
|
// return false
|
||||||
// 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
|
// 已经支付,但是没有走逻辑的内购订单 就发给后台做验证
|
||||||
that.iapCheck(item, index)
|
that.iapCheck(item, index)
|
||||||
// that.finishTransaction(item)
|
// that.finishTransaction(item)
|
||||||
} else {
|
} else {
|
||||||
// 其他状态的内购订单
|
// 其他状态的内购订单
|
||||||
that.finishTransaction(item)
|
that.finishTransaction(item)
|
||||||
@@ -110,6 +109,21 @@ var iap = {
|
|||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
console.log('后台验证失败=>',e);
|
console.log('后台验证失败=>',e);
|
||||||
|
uni.showModal({
|
||||||
|
title: "提示",
|
||||||
|
cancelColor:'#0081ff',
|
||||||
|
content: `您的账户下存在验证异常的订单(订单编号为:${e.data.orderId}),可尝试稍后重启app,如不能解决您的问题,可联系官方客服`,
|
||||||
|
cancelText:'已验证关闭订单',
|
||||||
|
confirmText:'知道了',
|
||||||
|
success: function(res) {
|
||||||
|
if (res.confirm) {
|
||||||
|
console.log("用户点击确定");
|
||||||
|
}else{
|
||||||
|
console.log('点了取消')
|
||||||
|
that.finishTransaction(result);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
// that.finishTransaction(result);
|
// that.finishTransaction(result);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user