diff --git a/app/controller/api/WithdrawController.php b/app/controller/api/WithdrawController.php index e28ab06..958f60b 100644 --- a/app/controller/api/WithdrawController.php +++ b/app/controller/api/WithdrawController.php @@ -118,6 +118,9 @@ class WithdrawController if ($money_no > $user->money) { return ApiResponseApp::error(null, '提现积分不足'); } + if ($money_no < 4500) { + return ApiResponseApp::error(null, '提现积分不足'); + } // 获取当前时间的 3 分钟前 $threeMinutesAgo = Carbon::now()->subMinutes(3); @@ -140,11 +143,11 @@ class WithdrawController 'createtime2' => date('Y-m-d H:i:s'), 'username' => $user->username, 'status_text' => '申请中', - 'accumulated'=>$money_no, - 'fee'=>self::$handlingFee, - 'account'=>$userbank->account, - 'bank_name'=>$userbank->bank_name, - 'bank_username'=>$userbank->bank_username + 'accumulated' => $money_no, + 'fee' => self::$handlingFee, + 'account' => $userbank->account, + 'bank_name' => $userbank->bank_name, + 'bank_username' => $userbank->bank_username ]); //大于1000积分等待管理员审核 if ($money_no >= 100000) { @@ -155,47 +158,19 @@ class WithdrawController //用户积分减少$money UserRewardDao::base($user_id, 1, - ($money_no + self::$handlingFee), '提现'); - + //获取刚刚存入数据库的id(订单号) $orderId = $withdraw->id; $res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name, $orderId); - // //逻辑错误需要修改 + //逻辑错误需要修改 if ($res->Success) { $withdraw->update([ 'status' => 4, // 'status_text' => trans('等待银行打款'), - 'order_number' => $res->TrackingNumber ?? null, + 'order_number' => $res->TrackingNumber, ]); return ApiResponseApp::success(null, '转账成功'); } 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([ 'status' => 5, // 'status_text' => trans('支付错误:') . $res->ErrorMessage @@ -219,13 +194,14 @@ class WithdrawController $callbackData = $request->all(); // 记录回调数据以便调试 Log::info('Payment Callback Received:', $callbackData); - $orderId = $callbackData['TrackingNumber'] ?? null; - $failedMessage = $callbackData['FailedMessage'] ?? null; - $amount = $callbackData['Amount'] ?? null; + $orderId = $callbackData['TrackingNumber']; + $failedMessage = $callbackData['FailedMessage'] ; + $amount = $callbackData['Amount']; $withdraw = Withdraw::where('order_number', $orderId)->first(); //$failedMessage为null就是成功 if ($failedMessage != null) { + //解决多次回调 if ($withdraw->status == 5) { return; } @@ -241,5 +217,6 @@ class WithdrawController 'status_text' => trans('已到账'), ]); } + return 'ok'; } }