Commit 33d8c3f9 by huangzhi

feat: 余额自定义异常处理开关

parent 67e6b14c
......@@ -90,22 +90,23 @@ export class Payment {
}
}
async getBalance(): Promise<number|BalanceReturns> {
//isHandleErr 是否要自定义处理异常
async getBalance(isHandleErr: Boolean): Promise<number|BalanceReturns> {
try {
const {data: res} = await requestForPhp.post(MY_BALANCE, {balance: 1})
if (res.data && res.data.balance) {
this.balance = Number(res.data.balance)
}
if(res.msg === 'success'){
return this.balance
}
if(isHandleErr && res.msg !== 'success'){
return {
success: false,
msg: res.msg,
code: res.code
}
}
return this.balance
} catch (err) {
return { success: false }
return isHandleErr ? { success: false } : 0
}
}
getPayMethodList (totalAmount:number) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment