Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
b2a759a6
Commit
b2a759a6
authored
Sep 20, 2023
by
hj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
cf02e316
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
9 deletions
+75
-9
server/app/Http/Controllers/Middleware/SystemMaintenance.php
server/app/Http/Controllers/Middleware/SystemMaintenance.php
+65
-0
server/bootstrap/app.php
server/bootstrap/app.php
+1
-0
server/routes/api/rhawn.php
server/routes/api/rhawn.php
+9
-9
No files found.
server/app/Http/Controllers/Middleware/SystemMaintenance.php
0 → 100644
View file @
b2a759a6
<?php
/*
* This file is part of the Jiannei/lumen-api-starter.
*
* (c) Jiannei <longjian.huang@foxmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace
App\Http\Controllers\Middleware
;
use
App\Exceptions\ServerRunTimeException
;
use
App\Services\CustomerService
;
use
App\Services\ThirdPlatform\ThirdPlatformService
;
use
App\Services\ThirdPlatform\ZhenKhService
;
use
Closure
;
use
Illuminate\Auth\Access\AuthorizationException
;
use
Illuminate\Contracts\Auth\Factory
as
Auth
;
use
Illuminate\Http\Request
;
use
Jiannei\Response\Laravel\Support\Facades\Response
;
use
App\Support\Traits\Helpers
;
use
Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException
;
class
SystemMaintenance
{
use
Helpers
;
/**
* The authentication guard factory instance.
*
* @var Auth
*/
protected
$auth
;
/**
* Create a new middleware instance.
*
* @param Auth $auth
*/
public
function
__construct
(
Auth
$auth
)
{
$this
->
auth
=
$auth
;
}
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*
* @throws AuthorizationException
*/
public
function
handle
(
$request
,
Closure
$next
,
$guard
=
null
)
{
if
(
env
(
'MAINTENANCE'
)
==
true
){
throw
new
ServerRunTimeException
(
'系统维护中,暂时无法访问'
);
}
return
$next
(
$request
);
}
}
server/bootstrap/app.php
View file @
b2a759a6
...
@@ -108,6 +108,7 @@ $app->middleware([
...
@@ -108,6 +108,7 @@ $app->middleware([
]);
]);
$app
->
routeMiddleware
([
$app
->
routeMiddleware
([
'maintenance'
=>
App\Http\Controllers\Middleware\SystemMaintenance
::
class
,
'apiAuth'
=>
App\Http\Controllers\Middleware\Authenticate
::
class
,
'apiAuth'
=>
App\Http\Controllers\Middleware\Authenticate
::
class
,
'throttle'
=>
App\Http\Controllers\Middleware\RateLimits
::
class
'throttle'
=>
App\Http\Controllers\Middleware\RateLimits
::
class
//'syslog' => App\Http\Controllers\Middleware\SysLog::class,
//'syslog' => App\Http\Controllers\Middleware\SysLog::class,
...
...
server/routes/api/rhawn.php
View file @
b2a759a6
...
@@ -3,11 +3,11 @@
...
@@ -3,11 +3,11 @@
$api
->
version
(
'v1'
,
function
(
$api
)
{
$api
->
version
(
'v1'
,
function
(
$api
)
{
//获取token
//获取token
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Auth'
,
'middleware'
=>
[
'throttle:60,1'
]],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Auth'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
]],
function
(
$api
)
{
$api
->
post
(
'/openapi/auth/getToken'
,
[
'uses'
=>
'CustomerAuthController@getToken'
]);
$api
->
post
(
'/openapi/auth/getToken'
,
[
'uses'
=>
'CustomerAuthController@getToken'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
// 获取订单列表
// 获取订单列表
$api
->
post
(
'/openapi/rhawn/orders/getRhawnOrders'
,
[
'permission'
=>
'orders.getCustomerOrders'
,
'uses'
=>
'OrdersController@getCustomerOrders'
]);
$api
->
post
(
'/openapi/rhawn/orders/getRhawnOrders'
,
[
'permission'
=>
'orders.getCustomerOrders'
,
'uses'
=>
'OrdersController@getCustomerOrders'
]);
// 获取订单详情
// 获取订单详情
...
@@ -22,18 +22,18 @@ $api->version('v1', function($api) {
...
@@ -22,18 +22,18 @@ $api->version('v1', function($api) {
$api
->
post
(
'/openapi/rhawn/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
$api
->
post
(
'/openapi/rhawn/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/rhawn/products/getAllProducts'
,
[
'permission'
=>
'orders.getProductList'
,
'uses'
=>
'ProductsController@getAllProductsList'
]);
$api
->
post
(
'/openapi/rhawn/products/getAllProducts'
,
[
'permission'
=>
'orders.getProductList'
,
'uses'
=>
'ProductsController@getAllProductsList'
]);
$api
->
post
(
'/openapi/rhawn/products/getProductDetail'
,
[
'permission'
=>
'orders.getProductDetail'
,
'uses'
=>
'ProductsController@getProductDetail'
]);
$api
->
post
(
'/openapi/rhawn/products/getProductDetail'
,
[
'permission'
=>
'orders.getProductDetail'
,
'uses'
=>
'ProductsController@getProductDetail'
]);
$api
->
post
(
'/openapi/rhawn/products/getProductByCas'
,
[
'permission'
=>
'orders.getProductByCas'
,
'uses'
=>
'ProductsController@getProductByCas'
]);
$api
->
post
(
'/openapi/rhawn/products/getProductByCas'
,
[
'permission'
=>
'orders.getProductByCas'
,
'uses'
=>
'ProductsController@getProductByCas'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Rhawn'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/rhawn/invoice/getInvoiceSorderItems'
,
[
'permission'
=>
'orders.getInvoiceSorderItems'
,
'uses'
=>
'InvoiceController@getInvoiceSorderItems'
]);
$api
->
post
(
'/openapi/rhawn/invoice/getInvoiceSorderItems'
,
[
'permission'
=>
'orders.getInvoiceSorderItems'
,
'uses'
=>
'InvoiceController@getInvoiceSorderItems'
]);
});
});
// 百化接口
// 百化接口
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
// 新建订单
// 新建订单
$api
->
post
(
'/openapi/bhua/orders/createBhuaOrders'
,
[
'permission'
=>
'orders.createBhuaOrders'
,
'uses'
=>
'OrdersController@createCustomerNewOrder'
]);
$api
->
post
(
'/openapi/bhua/orders/createBhuaOrders'
,
[
'permission'
=>
'orders.createBhuaOrders'
,
'uses'
=>
'OrdersController@createCustomerNewOrder'
]);
$api
->
post
(
'/openapi/bhua/orders/getOrdersDispatch'
,
[
'permission'
=>
'orders.getOrdersDispatch'
,
'uses'
=>
'OrdersController@getOrdersDispatch'
]);
$api
->
post
(
'/openapi/bhua/orders/getOrdersDispatch'
,
[
'permission'
=>
'orders.getOrdersDispatch'
,
'uses'
=>
'OrdersController@getOrdersDispatch'
]);
...
@@ -42,21 +42,21 @@ $api->version('v1', function($api) {
...
@@ -42,21 +42,21 @@ $api->version('v1', function($api) {
$api
->
post
(
'/openapi/bhua/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
$api
->
post
(
'/openapi/bhua/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/bhua/products/getAllBrands'
,
[
'permission'
=>
'orders.getAllBrands'
,
'uses'
=>
'ProductsController@getAllBrands'
]);
$api
->
post
(
'/openapi/bhua/products/getAllBrands'
,
[
'permission'
=>
'orders.getAllBrands'
,
'uses'
=>
'ProductsController@getAllBrands'
]);
$api
->
post
(
'/openapi/bhua/products/getProductsByBrandId'
,
[
'permission'
=>
'orders.getProductsByBrandId'
,
'uses'
=>
'ProductsController@getProductsByBrand'
]);
$api
->
post
(
'/openapi/bhua/products/getProductsByBrandId'
,
[
'permission'
=>
'orders.getProductsByBrandId'
,
'uses'
=>
'ProductsController@getProductsByBrand'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\Internal\V1\Bhua'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\Internal\V1\Bhua'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/internal/bhua/getAllBrands'
,
[
'permission'
=>
'orders.getAllBrands'
,
'uses'
=>
'ProductsController@getAllBrands'
]);
$api
->
post
(
'/openapi/internal/bhua/getAllBrands'
,
[
'permission'
=>
'orders.getAllBrands'
,
'uses'
=>
'ProductsController@getAllBrands'
]);
});
});
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Bhua'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/bhua/invoice/getInvoiceSorderItems'
,
[
'permission'
=>
'orders.getInvoiceSorderItems'
,
'uses'
=>
'InvoiceController@getInvoiceSorderItems'
]);
$api
->
post
(
'/openapi/bhua/invoice/getInvoiceSorderItems'
,
[
'permission'
=>
'orders.getInvoiceSorderItems'
,
'uses'
=>
'InvoiceController@getInvoiceSorderItems'
]);
});
});
// chemsite接口
// chemsite接口
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Chemsite'
,
'middleware'
=>
[
'throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
group
([
'namespace'
=>
'App\Http\Controllers\V1\Chemsite'
,
'middleware'
=>
[
'
maintenance'
,
'
throttle:60,1'
,
'apiAuth'
],
'providers'
=>
'jwt'
],
function
(
$api
)
{
$api
->
post
(
'/openapi/chemsite/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
$api
->
post
(
'/openapi/chemsite/customer/getCustomer'
,
[
'permission'
=>
'chemsite.customer.search'
,
'uses'
=>
'CustomerController@getCustomer'
]);
});
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment