fix: 接入抖音原生支付并修复App支付服务缺失
This commit is contained in:
+16
-8
@@ -56,10 +56,11 @@ function request(options) {
|
||||
url: BASE_URL + url,
|
||||
method,
|
||||
data,
|
||||
header: {
|
||||
header: {
|
||||
...defaultHeaders,
|
||||
...headers,
|
||||
},
|
||||
...headers,
|
||||
},
|
||||
timeout: 15000,
|
||||
success: (res) => {
|
||||
if (isShowLoading) {
|
||||
hideLoading();
|
||||
@@ -67,8 +68,13 @@ function request(options) {
|
||||
|
||||
let data = res.data;
|
||||
if (data && typeof data === "string") {
|
||||
data = JSON.parse(data);
|
||||
}
|
||||
try { data = JSON.parse(data); }
|
||||
catch (_) { reject(new Error('服务响应格式异常')); return; }
|
||||
}
|
||||
if (res.statusCode < 200 || res.statusCode >= 300 || !data) {
|
||||
reject(new Error('服务请求失败,请稍后重试'));
|
||||
return;
|
||||
}
|
||||
if (data.status === 500) {
|
||||
uni.showToast({
|
||||
title: "系统异常,请稍后再试",
|
||||
@@ -76,7 +82,8 @@ function request(options) {
|
||||
duration: 2000, // 持续时长,单位ms
|
||||
mask: false, // 是否显示透明蒙层,防止触摸穿透
|
||||
});
|
||||
return;
|
||||
reject(new Error('系统异常,请稍后再试'));
|
||||
return;
|
||||
}
|
||||
// 601 微信登录没注册
|
||||
if (data.bizcode === 100) {
|
||||
@@ -114,7 +121,8 @@ function request(options) {
|
||||
});
|
||||
}, 2000);
|
||||
}
|
||||
} else {
|
||||
reject(data);
|
||||
} else {
|
||||
console.log("错误-1", data, url);
|
||||
uni.showToast({
|
||||
title: data.msg || "系统错误,请稍后再试",
|
||||
@@ -134,7 +142,7 @@ function request(options) {
|
||||
icon: "none", // 可选 success/loading/none
|
||||
duration: 2000, // 持续时长,单位ms
|
||||
});
|
||||
// reject(error); // 请求失败时返回错误信息
|
||||
reject(error);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user