From dafe9537bb43e5d096fc4cbad1dd9e52fd67b8e7 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Tue, 8 Aug 2023 00:38:16 +0800 Subject: [PATCH] yh --- app/Command/MineCommand.php | 10 +++++----- app/Controller/Payment/NotifyController.php | 2 +- app/Controller/Payment/PayController.php | 4 ++-- app/Helper/Baofu/Common.php | 1 + app/Helper/Baofu/SignatureUtil.php | 1 + app/Service/PaymentService.php | 3 ++- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/Command/MineCommand.php b/app/Command/MineCommand.php index 123d55e..331fa24 100644 --- a/app/Command/MineCommand.php +++ b/app/Command/MineCommand.php @@ -42,7 +42,7 @@ class MineCommand extends HyperfCommand public function handle(): void { - $this->register('RLX1990'); + $this->payment(); } protected function generateToken() { @@ -135,7 +135,7 @@ class MineCommand extends HyperfCommand * @var UserService $userService */ $userService = $this->container->make(UserService::class); - $userService->rsyncBankCards('4673f922e30cfd2efeeb992ff6a32ece'); + $userService->rsyncBankCards('247eda1b7de0c76603123c477f2072fa'); } protected function bindCard() @@ -155,13 +155,13 @@ class MineCommand extends HyperfCommand */ $paymentService = $this->container->make(PaymentService::class); $data = [ - 'userId' => '24', - 'agreementNo' => '322022110300000005068', + 'userId' => 'RLX1990', + 'agreementNo' => '312023080700002049466', 'notifyUrl' => 'http://www.baidu.com', 'returnUrl' => 'http://www.baidu.com', 'amount' => 10, 'outOrderNo' => time() . rand(1000, 9999), - 'expiresIn' => 15*60, + 'expiresIn' => 10*60, 'splitInfoList' => [ [ 'userId' => 'ELF1990', diff --git a/app/Controller/Payment/NotifyController.php b/app/Controller/Payment/NotifyController.php index 847f252..5422517 100644 --- a/app/Controller/Payment/NotifyController.php +++ b/app/Controller/Payment/NotifyController.php @@ -40,7 +40,7 @@ class NotifyController extends AbstractController $baofu = new Baofu(); if (!$baofu->notifyVerify($params, 'register')) { - Log::info('registerNotifyVerifyFail: ' . $params); + Log::info('registerNotifyVerifyFail: ', $params); return $baofu->notifySuccess(); } diff --git a/app/Controller/Payment/PayController.php b/app/Controller/Payment/PayController.php index 40aa125..c159af2 100644 --- a/app/Controller/Payment/PayController.php +++ b/app/Controller/Payment/PayController.php @@ -75,8 +75,8 @@ class PayController extends AbstractController public function payment(RequestInterface $request) { [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); - $data = $this->paymentService->payment($data, $app, $token); - return $this->success($data); + $url = $this->paymentService->payment($data, $app, $token); + return $this->success(['url' => $url]); } public function refundApply(RequestInterface $request) diff --git a/app/Helper/Baofu/Common.php b/app/Helper/Baofu/Common.php index c50db4c..3e54f90 100644 --- a/app/Helper/Baofu/Common.php +++ b/app/Helper/Baofu/Common.php @@ -214,6 +214,7 @@ trait Common $needSignParams = $notifyItem['signParams']; $paramList = explode('|', $needSignParams); $signString = Tool::getSignStr($needSignParams, $paramList, $data, 'response'); + Log::info('Baofu SignString: ' . $signString); return SignatureUtil::verifySign($signString, $this->getCerFilePath(), $data['signature'] ?: ''); } diff --git a/app/Helper/Baofu/SignatureUtil.php b/app/Helper/Baofu/SignatureUtil.php index f3e2734..4e0e443 100644 --- a/app/Helper/Baofu/SignatureUtil.php +++ b/app/Helper/Baofu/SignatureUtil.php @@ -53,6 +53,7 @@ class SignatureUtil $pubKey = file_get_contents($cerPath); $certs = openssl_get_publickey($pubKey); $ok = openssl_verify($data, hex2bin($signature), $certs); + var_dump($cerPath, $signature); if ($ok == 1) { return true; } diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index 3341961..650719c 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -63,7 +63,7 @@ class PaymentService extends AbstractService $url = $baofu->paymentSplit([ 'loginNo' => $user->member_id, 'outOrderNo' => $order->order_no, - 'amount' => $user->member_id, + 'amount' => $order->amount, 'paidType' => 'CARD', 'agreementNo' => $order->agreement_no, 'pwdPayExpTime' => strtotime($order->expired_at), @@ -72,6 +72,7 @@ class PaymentService extends AbstractService $order->status = 'APPLY_SUCCESS'; $order->applied_at = date('Y-m-d H:i:s'); $order->pay_url = $url; + $order->save(); return $url; } catch (ApiException $e) { $order->status = 'APPLY_FAILED';