feat: 增加提现金额最低限制,优化错误处理逻辑
This commit is contained in:
parent
a8b89bfa85
commit
a956648fa7
|
@ -118,6 +118,9 @@ class WithdrawController
|
||||||
if ($money_no > $user->money) {
|
if ($money_no > $user->money) {
|
||||||
return ApiResponseApp::error(null, '提现积分不足');
|
return ApiResponseApp::error(null, '提现积分不足');
|
||||||
}
|
}
|
||||||
|
if ($money_no < 4500) {
|
||||||
|
return ApiResponseApp::error(null, '提现积分不足');
|
||||||
|
}
|
||||||
|
|
||||||
// 获取当前时间的 3 分钟前
|
// 获取当前时间的 3 分钟前
|
||||||
$threeMinutesAgo = Carbon::now()->subMinutes(3);
|
$threeMinutesAgo = Carbon::now()->subMinutes(3);
|
||||||
|
@ -140,11 +143,11 @@ class WithdrawController
|
||||||
'createtime2' => date('Y-m-d H:i:s'),
|
'createtime2' => date('Y-m-d H:i:s'),
|
||||||
'username' => $user->username,
|
'username' => $user->username,
|
||||||
'status_text' => '申请中',
|
'status_text' => '申请中',
|
||||||
'accumulated'=>$money_no,
|
'accumulated' => $money_no,
|
||||||
'fee'=>self::$handlingFee,
|
'fee' => self::$handlingFee,
|
||||||
'account'=>$userbank->account,
|
'account' => $userbank->account,
|
||||||
'bank_name'=>$userbank->bank_name,
|
'bank_name' => $userbank->bank_name,
|
||||||
'bank_username'=>$userbank->bank_username
|
'bank_username' => $userbank->bank_username
|
||||||
]);
|
]);
|
||||||
//大于1000积分等待管理员审核
|
//大于1000积分等待管理员审核
|
||||||
if ($money_no >= 100000) {
|
if ($money_no >= 100000) {
|
||||||
|
@ -159,43 +162,15 @@ class WithdrawController
|
||||||
//获取刚刚存入数据库的id(订单号)
|
//获取刚刚存入数据库的id(订单号)
|
||||||
$orderId = $withdraw->id;
|
$orderId = $withdraw->id;
|
||||||
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);
|
$res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId);
|
||||||
// //逻辑错误需要修改
|
//逻辑错误需要修改
|
||||||
if ($res->Success) {
|
if ($res->Success) {
|
||||||
$withdraw->update([
|
$withdraw->update([
|
||||||
'status' => 4, //
|
'status' => 4, //
|
||||||
'status_text' => trans('等待银行打款'),
|
'status_text' => trans('等待银行打款'),
|
||||||
'order_number' => $res->TrackingNumber ?? null,
|
'order_number' => $res->TrackingNumber,
|
||||||
]);
|
]);
|
||||||
return ApiResponseApp::success(null, '转账成功');
|
return ApiResponseApp::success(null, '转账成功');
|
||||||
} else {
|
} else {
|
||||||
$errorMsg = '';
|
|
||||||
if ($res->ErrorMessage == "CheckIpAddressFailed") {
|
|
||||||
$errorMsg = 'IP 检查失败';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "CheckEncryptValueFailed ") {
|
|
||||||
$errorMsg = '加密检查失败';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "PaymentChannelClosed") {
|
|
||||||
$errorMsg = '平台休息中,暂不接单';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "InsufficientBalance") {
|
|
||||||
$errorMsg = '余额不足';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "TryAgainLater") {
|
|
||||||
$errorMsg = '系统忙碌中,请稍后再试';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "DevError") {
|
|
||||||
$errorMsg = '程式错误,请联络开发人员';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "PayeeAccountNameFormatError") {
|
|
||||||
$errorMsg = '收款人帐号格式错误';
|
|
||||||
}
|
|
||||||
if ($res->ErrorMessage == "PayeeAccountNumberFormatError") {
|
|
||||||
$errorMsg = '收款人卡号格式错误';
|
|
||||||
}
|
|
||||||
if ($errorMsg == '') {
|
|
||||||
$errorMsg = '未知错误';
|
|
||||||
}
|
|
||||||
$withdraw->update([
|
$withdraw->update([
|
||||||
'status' => 5, //
|
'status' => 5, //
|
||||||
'status_text' => trans('支付错误:') . $res->ErrorMessage
|
'status_text' => trans('支付错误:') . $res->ErrorMessage
|
||||||
|
@ -219,13 +194,14 @@ class WithdrawController
|
||||||
$callbackData = $request->all();
|
$callbackData = $request->all();
|
||||||
// 记录回调数据以便调试
|
// 记录回调数据以便调试
|
||||||
Log::info('Payment Callback Received:', $callbackData);
|
Log::info('Payment Callback Received:', $callbackData);
|
||||||
$orderId = $callbackData['TrackingNumber'] ?? null;
|
$orderId = $callbackData['TrackingNumber'];
|
||||||
$failedMessage = $callbackData['FailedMessage'] ?? null;
|
$failedMessage = $callbackData['FailedMessage'] ;
|
||||||
$amount = $callbackData['Amount'] ?? null;
|
$amount = $callbackData['Amount'];
|
||||||
|
|
||||||
$withdraw = Withdraw::where('order_number', $orderId)->first();
|
$withdraw = Withdraw::where('order_number', $orderId)->first();
|
||||||
//$failedMessage为null就是成功
|
//$failedMessage为null就是成功
|
||||||
if ($failedMessage != null) {
|
if ($failedMessage != null) {
|
||||||
|
//解决多次回调
|
||||||
if ($withdraw->status == 5) {
|
if ($withdraw->status == 5) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -241,5 +217,6 @@ class WithdrawController
|
||||||
'status_text' => trans('已到账'),
|
'status_text' => trans('已到账'),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
return 'ok';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue