diff --git a/app/Command/WithdrawCommand.php b/app/Command/WithdrawCommand.php index cfaf302..f363029 100644 --- a/app/Command/WithdrawCommand.php +++ b/app/Command/WithdrawCommand.php @@ -58,28 +58,27 @@ class WithdrawCommand extends HyperfCommand $userService = $this->container->make(UserService::class); $user = User::where('user_id', 'ACT_5')->first(); - + $balance = $userService->getBalance($user->member_id); + + echo 'before balance' . $balance . PHP_EOL; $bankCard = BankCard::where('user_id', $user->user_id)->first(); - var_dump([ - 'userId' => $user->user_id, - 'withdrawType' => 'entrust', - 'agreementNo' => $bankCard->agreement_no, - 'outWithdrawNo' => StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_WITHDRAW_NO), - 'amount' => $balance - ]); - return; $requestLog = $this->createRequestLog([ 'userId' => $user->user_id, 'withdrawType' => 'entrust', - 'agreementNo' => $order->out_order_no, - 'outWithdrawNo' => $order->amount, + 'agreementNo' => $bankCard->agreement_no, + 'outWithdrawNo' => StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_ACCOUNT_WITHDRAW), 'amount' => $balance ]); + $url = $paymentService->withdraw($requestLog->getData(), $requestLog->app, $requestLog->request_token); - echo $url; + + echo 'result' . $url . PHP_EOL; + + $balance = $userService->getBalance($user->member_id); + echo 'after balance' . $balance . PHP_EOL; } private function createRequestLog($data) { diff --git a/app/Helper/StringHelper.php b/app/Helper/StringHelper.php index f0d8999..d8bff04 100644 --- a/app/Helper/StringHelper.php +++ b/app/Helper/StringHelper.php @@ -16,6 +16,7 @@ class StringHelper const ORDER_NO_TYPE_WITHDRAW_APPLY_BATCH_NUM = 'withdraw_apply_batch_num'; const ORDER_NO_TYPE_WITHDRAW_APPLY_NO = 'withdraw_apply_no'; const ORDER_NO_TYPE_WITHDRAW_NO = 'withdraw_no'; + const ORDER_NO_TYPE_ACCOUNT_WITHDRAW = 'account_withdraw'; const ORDER_NO_TYPE_ACCOUNT_PAY = 'account_pay'; public static function getRandomString($length, $withSpecialChar = false)