diff --git a/Envoy.blade.php b/Envoy.blade.php index 6562fe6..39d6cc9 100644 --- a/Envoy.blade.php +++ b/Envoy.blade.php @@ -21,7 +21,7 @@ cd /lanzu_api git pull origin master @if($composer == true) - composer update --lock + composer update --no-dev --lock @endif supervisorctl restart lanzu_api @endtask diff --git a/app/Controller/CouponRebateController.php b/app/Controller/CouponRebateController.php new file mode 100644 index 0000000..7ed921d --- /dev/null +++ b/app/Controller/CouponRebateController.php @@ -0,0 +1,28 @@ +success('创建成功'); + } +} diff --git a/app/Controller/ParamsTokenController.php b/app/Controller/ParamsTokenController.php new file mode 100644 index 0000000..0120c41 --- /dev/null +++ b/app/Controller/ParamsTokenController.php @@ -0,0 +1,28 @@ +paramsTokenService->generate($this->request->all()); + return $this->success($res); + } + + public function analyze() + { + $res = $this->paramsTokenService->analyze($this->request->input('token')); + return $this->success($res); + } +} \ No newline at end of file diff --git a/app/Middleware/CorsMiddleware.php b/app/Middleware/CorsMiddleware.php new file mode 100644 index 0000000..7fb6495 --- /dev/null +++ b/app/Middleware/CorsMiddleware.php @@ -0,0 +1,34 @@ +withHeader('Access-Control-Allow-Origin', '*') + ->withHeader('Access-Control-Allow-Credentials', 'true') + // Headers 可以根据实际情况进行改写。 + ->withHeader('Access-Control-Allow-Headers', 'DNT,Keep-Alive,User-Agent,Cache-Control,Content-Type,Authorization'); + + Context::set(ResponseInterface::class, $response); + + if ($request->getMethod() == 'OPTIONS') { + return $response; + } + + return $handler->handle($request); + } +} \ No newline at end of file diff --git a/app/Service/ParamsTokenServiceInterface.php b/app/Service/ParamsTokenServiceInterface.php new file mode 100644 index 0000000..440665f --- /dev/null +++ b/app/Service/ParamsTokenServiceInterface.php @@ -0,0 +1,11 @@ + 'zh_cjdianc/pages/couponrebate/index', 'previous_id' => 211, 'is_expired' => 2]; + } +} \ No newline at end of file diff --git a/config/autoload/dependencies.php b/config/autoload/dependencies.php index a21821b..e8f6126 100644 --- a/config/autoload/dependencies.php +++ b/config/autoload/dependencies.php @@ -12,4 +12,5 @@ declare(strict_types=1); return [ \App\Service\ServiceEvaluateServiceInterface::class => \App\Service\ServiceEvaluateService::class, \App\Service\AttachmentServiceInterface::class => \App\Service\AttachmentService::class, + \App\Service\ParamsTokenServiceInterface::class => \App\Service\ParamsTokenSsdbService::class, ]; diff --git a/config/autoload/middlewares.php b/config/autoload/middlewares.php index 5269173..5eb19a5 100644 --- a/config/autoload/middlewares.php +++ b/config/autoload/middlewares.php @@ -13,5 +13,6 @@ return [ 'http' => [ \App\Middleware\Auth\ApiMiddleware::class, \Hyperf\Validation\Middleware\ValidationMiddleware::class, + \App\Middleware\CorsMiddleware::class, ], ]; diff --git a/config/routes.php b/config/routes.php index 4e17da6..fd08a30 100644 --- a/config/routes.php +++ b/config/routes.php @@ -27,6 +27,6 @@ Router::addGroup('/v1/',function (){ Router::post('Attachment/uploadImage', 'App\Controller\AttachmentController@uploadImage'); Router::post('Attachment/uploadImageByBase64', 'App\Controller\AttachmentController@uploadImageByBase64'); Router::post('Attachment/upload', 'App\Controller\AttachmentController@upload'); - - + Router::post('ParamsToken/generate', 'App\Controller\ParamsTokenController@generate'); + Router::post('ParamsToken/analyze', 'App\Controller\ParamsTokenController@analyze'); }); \ No newline at end of file