From 4e675fd7580b27288cde34f34ac6cde89e9c1e74 Mon Sep 17 00:00:00 2001 From: weigang Date: Thu, 13 Aug 2020 21:50:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9API=20AUTH=E4=B8=AD=E9=97=B4?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Controller/PaymentController.php | 4 ++-- config/autoload/middlewares.php | 4 ++-- config/routes.php | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/Controller/PaymentController.php b/app/Controller/PaymentController.php index 5047f27..9fc92ae 100644 --- a/app/Controller/PaymentController.php +++ b/app/Controller/PaymentController.php @@ -35,7 +35,7 @@ class PaymentController extends BaseController 'out_trade_no' => $orderMain->global_order_id, // 'total_fee' => bcmul(floatval($orderMain->money), 100, 0), 'total_fee' => 1, - 'notify_url' => config('site_host') . '/v1/notify/wxminionline', + 'notify_url' => config('site_host') . '/wechat/notify/wxminionline', 'trade_type' => 'JSAPI', 'openid' => $data['openid'], ]); @@ -75,7 +75,7 @@ class PaymentController extends BaseController 'body' => '懒族生活 - 当面支付', 'out_trade_no' => $orderMain->global_order_id, 'total_fee' => bcmul(floatval($orderMain->money), 100, 0), - 'notify_url' => config('site_host') . '/v1/notify/wxminioffline', + 'notify_url' => config('site_host') . '/wechat/notify/wxminioffline', 'trade_type' => 'JSAPI', 'openid' => $data['openid'], ]); diff --git a/config/autoload/middlewares.php b/config/autoload/middlewares.php index 5eb19a5..fa4a0fc 100644 --- a/config/autoload/middlewares.php +++ b/config/autoload/middlewares.php @@ -11,8 +11,8 @@ declare(strict_types=1); */ return [ 'http' => [ - \App\Middleware\Auth\ApiMiddleware::class, - \Hyperf\Validation\Middleware\ValidationMiddleware::class, + // \App\Middleware\Auth\ApiMiddleware::class, \App\Middleware\CorsMiddleware::class, + \Hyperf\Validation\Middleware\ValidationMiddleware::class, ], ]; diff --git a/config/routes.php b/config/routes.php index 7902ff0..ab8a2ed 100644 --- a/config/routes.php +++ b/config/routes.php @@ -44,7 +44,10 @@ Router::addGroup('/v1/',function (){ //小程序支付相关 Router::post('wxminipay/online', 'App\Controller\PaymentController@wxminiPayOnline'); Router::post('wxminipay/offline', 'App\Controller\PaymentController@wxminiPayOffline'); + +},['middleware' => [\App\Middleware\Auth\ApiMiddleware::class]]); + +Router::addGroup('/wechat/',function () { Router::post('notify/wxminionline', 'App\Controller\NotifyController@wxminiOnline'); Router::post('notify/wxminioffline', 'App\Controller\NotifyController@wxminiOffline'); - }); \ No newline at end of file