diff --git a/app/Command/MineCommand.php b/app/Command/MineCommand.php index 331fa24..0b4b70c 100644 --- a/app/Command/MineCommand.php +++ b/app/Command/MineCommand.php @@ -42,7 +42,7 @@ class MineCommand extends HyperfCommand public function handle(): void { - $this->payment(); + $this->rsyncBankCards(); } protected function generateToken() { @@ -135,7 +135,7 @@ class MineCommand extends HyperfCommand * @var UserService $userService */ $userService = $this->container->make(UserService::class); - $userService->rsyncBankCards('247eda1b7de0c76603123c477f2072fa'); + $userService->rsyncBankCards('4673f922e30cfd2efeeb992ff6a32ece'); } protected function bindCard() @@ -155,18 +155,18 @@ class MineCommand extends HyperfCommand */ $paymentService = $this->container->make(PaymentService::class); $data = [ - 'userId' => 'RLX1990', - 'agreementNo' => '312023080700002049466', + 'userId' => 'ELF1990', + 'agreementNo' => '312023080400002047764', 'notifyUrl' => 'http://www.baidu.com', 'returnUrl' => 'http://www.baidu.com', - 'amount' => 10, + 'amount' => 100, 'outOrderNo' => time() . rand(1000, 9999), 'expiresIn' => 10*60, 'splitInfoList' => [ [ - 'userId' => 'ELF1990', + 'userId' => 'RLX1990', 'sellerFlag' => 1, - 'amount' => 10, + 'amount' => 100, 'subOutOrderNo' => time() . rand(1000, 9999), ] ] diff --git a/app/Controller/Payment/NotifyController.php b/app/Controller/Payment/NotifyController.php index 5422517..6fe7568 100644 --- a/app/Controller/Payment/NotifyController.php +++ b/app/Controller/Payment/NotifyController.php @@ -35,15 +35,14 @@ class NotifyController extends AbstractController { [$token, $params] = $this->getTokenAndParams($request); - $token = $request->route('token'); - $requestLog = $this->requestService->getRequestLogByToken($token); - $baofu = new Baofu(); if (!$baofu->notifyVerify($params, 'register')) { Log::info('registerNotifyVerifyFail: ', $params); return $baofu->notifySuccess(); } + $requestLog = $this->requestService->getRequestLogByToken($token); + $userId = $requestLog->getDataValue('userId'); $appId = $requestLog->app_id; $this->userService->rsyncUser($params['loginNo'], $appId, $userId); @@ -63,13 +62,13 @@ class NotifyController extends AbstractController { [$token, $params] = $this->getTokenAndParams($request); - $requestLog = $this->requestService->getRequestLogByToken($token); - $baofu = new Baofu(); if (!$baofu->notifyVerify($params, 'bindCard')) { Log::info('bindCardNotifyVerifyFail: ' . $params); return $baofu->notifySuccess(); } + + $requestLog = $this->requestService->getRequestLogByToken($token); $bindCardFlag = $params['bindCardFlag'] && $params['bindCardFlag'] != 'false' ? true : false; if ($bindCardFlag) { @@ -91,14 +90,14 @@ class NotifyController extends AbstractController public function payment(RequestInterface $request) { [$token, $params] = $this->getTokenAndParams($request); - - $requestLog = $this->requestService->getRequestLogByToken($token); $baofu = new Baofu(); if (!$baofu->notifyVerify($params, 'payment')) { Log::info('paymentNotifyVerifyFail: ' . $params); return $baofu->notifySuccess(); } + + $requestLog = $this->requestService->getRequestLogByToken($token); $info = [ 'member_id' => $params['loginId'], @@ -135,13 +134,13 @@ class NotifyController extends AbstractController { [$token, $params] = $this->getTokenAndParams($request); - $requestLog = $this->requestService->getRequestLogByToken($token); - $baofu = new Baofu(); if (!$baofu->notifyVerify($params, 'refund')) { Log::info('refundNotifyVerifyFail: ' . $params); return $baofu->notifySuccess(); } + + $requestLog = $this->requestService->getRequestLogByToken($token); $info = [ 'refund_no' => $params['refundTradeId'], diff --git a/app/Controller/Payment/PayController.php b/app/Controller/Payment/PaymentController.php similarity index 98% rename from app/Controller/Payment/PayController.php rename to app/Controller/Payment/PaymentController.php index c159af2..931e444 100644 --- a/app/Controller/Payment/PayController.php +++ b/app/Controller/Payment/PaymentController.php @@ -12,7 +12,7 @@ use App\Service\PaymentService; use App\Service\UserService; use Hyperf\Context\Context; -class PayController extends AbstractController +class PaymentController extends AbstractController { private UserService $userService; private PaymentService $paymentService; diff --git a/config/routes.php b/config/routes.php index b5f825d..7660421 100644 --- a/config/routes.php +++ b/config/routes.php @@ -3,7 +3,7 @@ declare(strict_types=1); use App\Controller\Payment\NotifyController; -use App\Controller\Payment\PayController; +use App\Controller\Payment\PaymentController; use App\Controller\Payment\ReturnController; use Hyperf\HttpServer\Router\Router; @@ -12,16 +12,16 @@ Router::get('/favicon.ico', function () { }); Router::addGroup('/payment',function () { - Router::post('/company-register', [PayController::class, 'companyRegister']); - Router::post('/register', [PayController::class, 'register']); - Router::post('/bind-card', [PayController::class, 'bindCard']); - Router::post('/unbind-card', [PayController::class, 'unbindCard']); - Router::post('/pwd-forget', [PayController::class, 'pwdForget']); - Router::post('/pwd-modify', [PayController::class, 'pwdModify']); - Router::post('/payment', [PayController::class, 'payment']); - Router::post('/refund-apply', [PayController::class, 'refundApply']); - Router::post('/refund-confirm', [PayController::class, 'refundConfirm']); - Router::post('/refund-cancel', [PayController::class, 'refundCancel']); + Router::post('/company-register', [PaymentController::class, 'companyRegister']); + Router::post('/register', [PaymentController::class, 'register']); + Router::post('/bind-card', [PaymentController::class, 'bindCard']); + Router::post('/unbind-card', [PaymentController::class, 'unbindCard']); + Router::post('/pwd-forget', [PaymentController::class, 'pwdForget']); + Router::post('/pwd-modify', [PaymentController::class, 'pwdModify']); + Router::post('/payment', [PaymentController::class, 'payment']); + Router::post('/refund-apply', [PaymentController::class, 'refundApply']); + Router::post('/refund-confirm', [PaymentController::class, 'refundConfirm']); + Router::post('/refund-cancel', [PaymentController::class, 'refundCancel']); }, ['middleware' => [\App\Middleware\RequestLogMiddleware::class, \App\Middleware\AppAuthMiddleWare::class]]); Router::addGroup('/notify',function () {