master
elf 1 year ago
parent a2a5d05e42
commit bca410f33e

@ -42,7 +42,7 @@ class MineCommand extends HyperfCommand
public function handle(): void public function handle(): void
{ {
$this->payment(); $this->rsyncBankCards();
} }
protected function generateToken() { protected function generateToken() {
@ -135,7 +135,7 @@ class MineCommand extends HyperfCommand
* @var UserService $userService * @var UserService $userService
*/ */
$userService = $this->container->make(UserService::class); $userService = $this->container->make(UserService::class);
$userService->rsyncBankCards('247eda1b7de0c76603123c477f2072fa'); $userService->rsyncBankCards('4673f922e30cfd2efeeb992ff6a32ece');
} }
protected function bindCard() protected function bindCard()
@ -155,18 +155,18 @@ class MineCommand extends HyperfCommand
*/ */
$paymentService = $this->container->make(PaymentService::class); $paymentService = $this->container->make(PaymentService::class);
$data = [ $data = [
'userId' => 'RLX1990', 'userId' => 'ELF1990',
'agreementNo' => '312023080700002049466', 'agreementNo' => '312023080400002047764',
'notifyUrl' => 'http://www.baidu.com', 'notifyUrl' => 'http://www.baidu.com',
'returnUrl' => 'http://www.baidu.com', 'returnUrl' => 'http://www.baidu.com',
'amount' => 10, 'amount' => 100,
'outOrderNo' => time() . rand(1000, 9999), 'outOrderNo' => time() . rand(1000, 9999),
'expiresIn' => 10*60, 'expiresIn' => 10*60,
'splitInfoList' => [ 'splitInfoList' => [
[ [
'userId' => 'ELF1990', 'userId' => 'RLX1990',
'sellerFlag' => 1, 'sellerFlag' => 1,
'amount' => 10, 'amount' => 100,
'subOutOrderNo' => time() . rand(1000, 9999), 'subOutOrderNo' => time() . rand(1000, 9999),
] ]
] ]

@ -35,15 +35,14 @@ class NotifyController extends AbstractController
{ {
[$token, $params] = $this->getTokenAndParams($request); [$token, $params] = $this->getTokenAndParams($request);
$token = $request->route('token');
$requestLog = $this->requestService->getRequestLogByToken($token);
$baofu = new Baofu(); $baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'register')) { if (!$baofu->notifyVerify($params, 'register')) {
Log::info('registerNotifyVerifyFail: ', $params); Log::info('registerNotifyVerifyFail: ', $params);
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }
$requestLog = $this->requestService->getRequestLogByToken($token);
$userId = $requestLog->getDataValue('userId'); $userId = $requestLog->getDataValue('userId');
$appId = $requestLog->app_id; $appId = $requestLog->app_id;
$this->userService->rsyncUser($params['loginNo'], $appId, $userId); $this->userService->rsyncUser($params['loginNo'], $appId, $userId);
@ -63,13 +62,13 @@ class NotifyController extends AbstractController
{ {
[$token, $params] = $this->getTokenAndParams($request); [$token, $params] = $this->getTokenAndParams($request);
$requestLog = $this->requestService->getRequestLogByToken($token);
$baofu = new Baofu(); $baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'bindCard')) { if (!$baofu->notifyVerify($params, 'bindCard')) {
Log::info('bindCardNotifyVerifyFail: ' . $params); Log::info('bindCardNotifyVerifyFail: ' . $params);
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }
$requestLog = $this->requestService->getRequestLogByToken($token);
$bindCardFlag = $params['bindCardFlag'] && $params['bindCardFlag'] != 'false' ? true : false; $bindCardFlag = $params['bindCardFlag'] && $params['bindCardFlag'] != 'false' ? true : false;
if ($bindCardFlag) { if ($bindCardFlag) {
@ -91,14 +90,14 @@ class NotifyController extends AbstractController
public function payment(RequestInterface $request) public function payment(RequestInterface $request)
{ {
[$token, $params] = $this->getTokenAndParams($request); [$token, $params] = $this->getTokenAndParams($request);
$requestLog = $this->requestService->getRequestLogByToken($token);
$baofu = new Baofu(); $baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'payment')) { if (!$baofu->notifyVerify($params, 'payment')) {
Log::info('paymentNotifyVerifyFail: ' . $params); Log::info('paymentNotifyVerifyFail: ' . $params);
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }
$requestLog = $this->requestService->getRequestLogByToken($token);
$info = [ $info = [
'member_id' => $params['loginId'], 'member_id' => $params['loginId'],
@ -135,13 +134,13 @@ class NotifyController extends AbstractController
{ {
[$token, $params] = $this->getTokenAndParams($request); [$token, $params] = $this->getTokenAndParams($request);
$requestLog = $this->requestService->getRequestLogByToken($token);
$baofu = new Baofu(); $baofu = new Baofu();
if (!$baofu->notifyVerify($params, 'refund')) { if (!$baofu->notifyVerify($params, 'refund')) {
Log::info('refundNotifyVerifyFail: ' . $params); Log::info('refundNotifyVerifyFail: ' . $params);
return $baofu->notifySuccess(); return $baofu->notifySuccess();
} }
$requestLog = $this->requestService->getRequestLogByToken($token);
$info = [ $info = [
'refund_no' => $params['refundTradeId'], 'refund_no' => $params['refundTradeId'],

@ -12,7 +12,7 @@ use App\Service\PaymentService;
use App\Service\UserService; use App\Service\UserService;
use Hyperf\Context\Context; use Hyperf\Context\Context;
class PayController extends AbstractController class PaymentController extends AbstractController
{ {
private UserService $userService; private UserService $userService;
private PaymentService $paymentService; private PaymentService $paymentService;

@ -3,7 +3,7 @@
declare(strict_types=1); declare(strict_types=1);
use App\Controller\Payment\NotifyController; use App\Controller\Payment\NotifyController;
use App\Controller\Payment\PayController; use App\Controller\Payment\PaymentController;
use App\Controller\Payment\ReturnController; use App\Controller\Payment\ReturnController;
use Hyperf\HttpServer\Router\Router; use Hyperf\HttpServer\Router\Router;
@ -12,16 +12,16 @@ Router::get('/favicon.ico', function () {
}); });
Router::addGroup('/payment',function () { Router::addGroup('/payment',function () {
Router::post('/company-register', [PayController::class, 'companyRegister']); Router::post('/company-register', [PaymentController::class, 'companyRegister']);
Router::post('/register', [PayController::class, 'register']); Router::post('/register', [PaymentController::class, 'register']);
Router::post('/bind-card', [PayController::class, 'bindCard']); Router::post('/bind-card', [PaymentController::class, 'bindCard']);
Router::post('/unbind-card', [PayController::class, 'unbindCard']); Router::post('/unbind-card', [PaymentController::class, 'unbindCard']);
Router::post('/pwd-forget', [PayController::class, 'pwdForget']); Router::post('/pwd-forget', [PaymentController::class, 'pwdForget']);
Router::post('/pwd-modify', [PayController::class, 'pwdModify']); Router::post('/pwd-modify', [PaymentController::class, 'pwdModify']);
Router::post('/payment', [PayController::class, 'payment']); Router::post('/payment', [PaymentController::class, 'payment']);
Router::post('/refund-apply', [PayController::class, 'refundApply']); Router::post('/refund-apply', [PaymentController::class, 'refundApply']);
Router::post('/refund-confirm', [PayController::class, 'refundConfirm']); Router::post('/refund-confirm', [PaymentController::class, 'refundConfirm']);
Router::post('/refund-cancel', [PayController::class, 'refundCancel']); Router::post('/refund-cancel', [PaymentController::class, 'refundCancel']);
}, ['middleware' => [\App\Middleware\RequestLogMiddleware::class, \App\Middleware\AppAuthMiddleWare::class]]); }, ['middleware' => [\App\Middleware\RequestLogMiddleware::class, \App\Middleware\AppAuthMiddleWare::class]]);
Router::addGroup('/notify',function () { Router::addGroup('/notify',function () {

Loading…
Cancel
Save