diff --git a/app/Utils/API/PaymentNew.php b/app/Utils/API/PaymentNew.php index 33e4db0..0d09b1c 100644 --- a/app/Utils/API/PaymentNew.php +++ b/app/Utils/API/PaymentNew.php @@ -54,7 +54,7 @@ class PaymentNew /** * 转账 */ - public static function pushMoney($money, $payeeAccountName, $payeeAccountNumber, $payeeBankName) + public static function pushMoney($money, $payeeAccountName, $payeeAccountNumber, $payeeBankName,$orderId) { $secret_key = "sZ2wAfh1lMkxBVrlY4uZY8Fj92E4scFf"; $url = "https://mdf.hr5688.com/api/createPaymentOrder"; @@ -79,7 +79,7 @@ class PaymentNew "PayeeIFSCCode" => "", "PaymentChannelId" => $PaymentChannelId, "ShopInformUrl" => "http://149.129.107.38/", - "ShopOrderId" => "11", + "ShopOrderId" => $orderId, "ShopUserLongId" => "776ae472-d4fc-435c-9639-be5763138d95" ]; diff --git a/app/controller/api/WithdrawController.php b/app/controller/api/WithdrawController.php index bac89da..295a2ea 100644 --- a/app/controller/api/WithdrawController.php +++ b/app/controller/api/WithdrawController.php @@ -117,13 +117,20 @@ class WithdrawController return ApiResponseApp::success(null, '等待管理员审核'); } //用户积分减少$money - // UserRewardDao::base($user_id, 1, - ($money_no + 300), '提现'); - $userbank = Userbank::where('id', $bank_id)->first(); - var_dump($money); - var_dump($userbank->bank_username); - var_dump($userbank->account); - var_dump($userbank->bank_name); - $res = PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name); + UserRewardDao::base($user_id, 1, - ($money_no + 300), '提现'); + $userbank = Userbank::where('id', $bank_id)->first();\ + //存入数据库 + Withdraw::create([ + 'user_id' => $user_id, + 'amount' => $money, + 'status' => 2, + 'createtime2' => date('Y-m-d H:i:s'), + 'username' => $user->username, + 'status_text' => '已到账', + ]); + //获取刚刚存入数据库的id(订单号) + $orderId = $withdraw->id; + PaymentNew::pushMoney($money, $userbank->bank_username, $userbank->account, $userbank->bank_name,$orderId); // var_dump($res); // //逻辑错误需要修改 // if ($res['Success'] == 200) { @@ -163,17 +170,17 @@ class WithdrawController $type = $request->post('type'); if ($type == 1) { - $res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name); - var_dump($res); - if ($res['Success'] == 200) { - $Withdraw = Withdraw::where('id', $id)->first(); - $Withdraw->status = 2; - $Withdraw->status_text = '已到账'; - $Withdraw->save(); - return ApiResponseApp::success(null, '转账成功'); - } else { - return ApiResponseApp::error(null, '转账失败'); - } + $res = PaymentNew::pushMoney($amount, $bank_username, $account, $bank_name,$id); + // var_dump($res); + // if ($res['Success'] == 200) { + // $Withdraw = Withdraw::where('id', $id)->first(); + // $Withdraw->status = 2; + // $Withdraw->status_text = '已到账'; + // $Withdraw->save(); + // return ApiResponseApp::success(null, '转账成功'); + // } else { + // return ApiResponseApp::error(null, '转账失败'); + // } } else { $Withdraw = Withdraw::where('id', $id)->first(); $Withdraw->status = 3;