版本升级,生成订单号等待300-600ms再支付
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
"version" : "1.0",
|
"version" : "1.0",
|
||||||
"configurations" : [
|
"configurations" : [
|
||||||
{
|
{
|
||||||
|
"customPlaygroundType" : "local",
|
||||||
"playground" : "custom",
|
"playground" : "custom",
|
||||||
"type" : "uni-app:app-android"
|
"type" : "uni-app:app-android"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -607,6 +607,23 @@ async function goldPay(data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异步等待函数:随机等待 300-600ms(包含边界值)
|
||||||
|
* @returns {Promise<number>} 成功后返回实际等待的毫秒数(方便调试或日志记录)
|
||||||
|
*/
|
||||||
|
function randomWait() {
|
||||||
|
// 1. 生成 300-600 之间的随机整数(含 300 和 600)
|
||||||
|
const waitTime = Math.floor(Math.random() * (600 - 300 + 1)) + 300;
|
||||||
|
|
||||||
|
// 2. 返回 Promise,延迟 waitTime 后 resolve
|
||||||
|
return new Promise((resolve) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
resolve(waitTime); // resolve 实际等待时间,便于后续使用
|
||||||
|
}, waitTime);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//确认支付
|
//确认支付
|
||||||
async function payConfirm() {
|
async function payConfirm() {
|
||||||
const [type, num] = popup.payType.split('-');
|
const [type, num] = popup.payType.split('-');
|
||||||
@@ -636,6 +653,14 @@ async function payConfirm() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (res) {
|
if (res) {
|
||||||
|
uni.showLoading()
|
||||||
|
console.log('等待开始');
|
||||||
|
const start=Date.now()
|
||||||
|
await randomWait()
|
||||||
|
const end=Date.now()
|
||||||
|
console.log('等待结束');
|
||||||
|
console.log('等待时间',end-start);
|
||||||
|
uni.hideLoading()
|
||||||
if (type == 'gold') {
|
if (type == 'gold') {
|
||||||
goldPay({
|
goldPay({
|
||||||
orderId: res.orders.ordersId
|
orderId: res.orders.ordersId
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
"name" : "斯耀短剧",
|
"name" : "斯耀短剧",
|
||||||
"appid" : "__UNI__E0B05B1",
|
"appid" : "__UNI__E0B05B1",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.3.2",
|
"versionName" : "1.3.3",
|
||||||
"versionCode" : 132,
|
"versionCode" : 133,
|
||||||
"transformPx" : false,
|
"transformPx" : false,
|
||||||
/* 5+App特有相关 */
|
/* 5+App特有相关 */
|
||||||
"app-plus" : {
|
"app-plus" : {
|
||||||
|
|||||||
Reference in New Issue
Block a user