feat: 支付

This commit is contained in:
陈狼 2025-02-22 15:26:30 +08:00
parent 68b4b3bdf6
commit 3ee760e3a7
2 changed files with 15 additions and 5 deletions

View File

@ -80,17 +80,16 @@ class WithdrawController
$user_id = $request->post('user_id');
//是否同意转账
$type = $request->post('type');
$rate = ExchangeRate::where('type', 'BDT')->get();
//计算积分
$money = $amount * 100 / $rate[0]['points'] + 300;
//不同意
if ($type == 1) {
$Withdraw = Withdraw::where('id', $id)->first();
$Withdraw->status = 3;
$Withdraw->status_text = '已驳回';
$Withdraw->save();
$rate = ExchangeRate::where('type', 'BDT')->get();
//计算积分
$money = $amount * 100 / $rate[0]['points'] + 300;
//用户id
$user_id = $request->data['id'];
//用户积分增加$money
UserRewardDao::base($user_id, 1, $money, '提现失败返还');
return ApiResponse::success(200, null, '操作成功');
@ -105,6 +104,11 @@ class WithdrawController
$Withdraw->save();
return ApiResponse::success(200, null, '操作成功');
} else {
$Withdraw = Withdraw::where('id', $id)->first();
$Withdraw->status = 5;
$Withdraw->status_text = '支付失败:用户银行信息存在问题';
$Withdraw->save();
UserRewardDao::base($user_id, 1, $money, '提现失败返还');
return ApiResponse::error(200, null, '用户银行信息存在问题');
}
}

View File

@ -143,6 +143,7 @@ class WithdrawController
]);
return ApiResponseApp::success(null, '转账成功');
} else {
UserRewardDao::base($user_id, 1, $money_no + 300, '提现失败返还');
if ($res->ErrorMessage == "PayeeAccountNumberFormatError") {
return ApiResponseApp::error(null, '收款人帐号格式错误');
}
@ -170,6 +171,11 @@ class WithdrawController
'status' => 5,
'status_text' => '支付失败: ' . $failedMessage,
]);
}else{
$withdraw->update([
'status' => 2,
'status_text' => '已到账',
]);
}
}
}