fix:微信支付
All checks were successful
构建并部署前端到生产环境 / build-and-deploy (push) Successful in 4m41s

This commit is contained in:
luo
2026-09-23 09:32:48 +08:00
parent a81b403cce
commit e82b0ab5da
12 changed files with 254 additions and 13 deletions

9
utils/payment-attempt.js Normal file
View File

@@ -0,0 +1,9 @@
export const isUnknownPaymentResult = (error) => Boolean(error?.paymentResultUnknown);
export const getPaymentErrorMessage = (error, fallback = '支付失败,请稍后重试') => {
if (isUnknownPaymentResult(error)) {
return '支付结果未知,请稍后查看订单状态';
}
return error?.msg || error?.message || fallback;
};

View File

@@ -47,8 +47,15 @@ const request = (options) => {
reject(responseData);
},
fail: (err) => {
showErrorToast('网络请求失败');
reject(err);
if (options.showError !== false) {
showErrorToast('网络请求失败');
}
// A transport failure does not tell us whether the backend created a
// payment. Callers must reconcile status and must not retry creation.
reject({
...err,
paymentResultUnknown: true
});
}
});
});