|
|
@@ -143,18 +143,22 @@ export default class UserBalancesController {
|
|
|
const data = request.all()
|
|
|
Logger.info('rechargeNotify: ' + JSON.stringify(data, null, 4))
|
|
|
if (data.head.respCode === '0000') {
|
|
|
- const order = await RechargeOrder.findOrFail(parseInt(data.body.orderId))
|
|
|
- if (order.status === RechargeOrderStatus.Pending) {
|
|
|
- order.status = RechargeOrderStatus.Success
|
|
|
- order.transactionId = data.body.tradeId
|
|
|
- order.payTime = DateTime.now()
|
|
|
- await order.save()
|
|
|
+ try {
|
|
|
+ const order = await RechargeOrder.findOrFail(parseInt(data.body.orderId))
|
|
|
+ if (order.status === RechargeOrderStatus.Pending) {
|
|
|
+ order.status = RechargeOrderStatus.Success
|
|
|
+ order.transactionId = data.body.tradeId
|
|
|
+ order.payTime = DateTime.now()
|
|
|
+ await order.save()
|
|
|
|
|
|
- await UserBalanceService.modifiyBalance({
|
|
|
- userId: order.userId,
|
|
|
- amount: order.amount,
|
|
|
- type: BalanceRecordType.Recharge
|
|
|
- })
|
|
|
+ await UserBalanceService.modifiyBalance({
|
|
|
+ userId: order.userId,
|
|
|
+ amount: order.amount,
|
|
|
+ type: BalanceRecordType.Recharge
|
|
|
+ })
|
|
|
+ }
|
|
|
+ } catch (error) {
|
|
|
+ Logger.error(error)
|
|
|
}
|
|
|
}
|
|
|
return 'SUCCESS'
|