更新加项支付结果判断
This commit is contained in:
@@ -438,9 +438,11 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
|
|||||||
|
|
||||||
if (res.Status === 200) {
|
if (res.Status === 200) {
|
||||||
const result = res.Data;
|
const result = res.Data;
|
||||||
// 假设支付成功返回 "success" 或 "1",失败返回其他值
|
console.log(result);
|
||||||
if (result === 'success' || result === '1' || result === 'SUCCESS') {
|
|
||||||
// 支付成功
|
// 支付成功:返回 "true"
|
||||||
|
if (result === 'true') {
|
||||||
|
// 支付成功,停止轮询
|
||||||
if (pollingTimerRef.current) {
|
if (pollingTimerRef.current) {
|
||||||
clearInterval(pollingTimerRef.current);
|
clearInterval(pollingTimerRef.current);
|
||||||
pollingTimerRef.current = null;
|
pollingTimerRef.current = null;
|
||||||
@@ -461,8 +463,8 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
|
|||||||
setPaymentMessage(null);
|
setPaymentMessage(null);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
} else if (result === 'failed' || result === '0' || result === 'FAILED') {
|
} else if (result === 'false') {
|
||||||
// 支付失败
|
// 支付失败,停止轮询
|
||||||
if (pollingTimerRef.current) {
|
if (pollingTimerRef.current) {
|
||||||
clearInterval(pollingTimerRef.current);
|
clearInterval(pollingTimerRef.current);
|
||||||
pollingTimerRef.current = null;
|
pollingTimerRef.current = null;
|
||||||
@@ -472,7 +474,7 @@ export const ExamAddonPanel = ({ client }: ExamAddonPanelProps) => {
|
|||||||
setPaymentMessage(null);
|
setPaymentMessage(null);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
// 其他状态继续轮询
|
// 其他状态(如 "pending"、"processing" 等)继续轮询
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('查询支付状态失败', err);
|
console.error('查询支付状态失败', err);
|
||||||
|
|||||||
Reference in New Issue
Block a user