Explorar o código

Merge branch 'develop'

caihongxingqiu %!s(int64=5) %!d(string=hai) anos
pai
achega
ee8c41eb3b
Modificáronse 3 ficheiros con 43 adicións e 5 borrados
  1. 32 3
      .rocketeer/config.php
  2. 1 1
      app/Helper/helper.php
  3. 10 1
      app/Http/Middleware/JwtAuthMiddleware.php

+ 32 - 3
.rocketeer/config.php

@@ -30,14 +30,14 @@ return [
     ////////////////////////////////////////////////////////////////////
 
     // The default remote connection(s) to execute tasks on
-    'default'          => ['production'],
+    'default'          => ['beta'],
 
     // The various connections you defined
     // You can leave all of this empty or remove it entirely if you don't want
     // to track files with credentials : Rocketeer will prompt you for your credentials
     // and store them locally
     'connections'      => [
-        'production' => [
+        'beta' => [
             'host'      => '47.92.174.125:2345',
             'username'  => 'root',
             'password'  => '',
@@ -46,6 +46,26 @@ return [
             'agent'     => '',
             'db_role'   => true,
         ],
+        'production'    => [
+            'servers'   => [
+                [
+                    'host'      => '47.92.131.85:2345',
+                    'username'  => 'root',
+                    'password'  => '',
+                    'key'       => '/root/.ssh/id_rsa',
+                    'keyphrase' => '',
+                    'agent'     => '',
+                ],
+                [
+                    'host'      => '47.92.30.243:2345',
+                    'username'  => 'root',
+                    'password'  => '',
+                    'key'       => '/root/.ssh/id_rsa',
+                    'keyphrase' => '',
+                    'agent'     => '',
+                ]
+            ]
+        ],
     ],
 
     /*
@@ -77,7 +97,16 @@ return [
         // Stages configurations
         'stages'      => [],
         // Connections configuration
-        'connections' => [],
+        'connections' => [
+            'production'    => [
+                'remote'    => [
+                    'root_directory'    => '/data/wwwroot/uptoyo/api'
+                ],
+                'scm'   => [
+                    'branch'    => 'release'
+                ]
+            ]
+        ],
 
     ],
 

+ 1 - 1
app/Helper/helper.php

@@ -26,7 +26,7 @@ function generateSign(array $params, $secret_key)
 {
     unset($params['sign']);
     // 将删除参数组中所有等值为FALSE的参数(包括:NULL, 空字符串,0, false)
-    $params = array_filter($params);
+    // $params = array_filter($params);
 
     // 按照键名对参数数组进行升序排序
     ksort($params);

+ 10 - 1
app/Http/Middleware/JwtAuthMiddleware.php

@@ -3,6 +3,7 @@
 namespace App\Http\Middleware;
 
 use Closure;
+use Illuminate\Support\Facades\Redis;
 use Tymon\JWTAuth\Exceptions\JWTException;
 use Tymon\JWTAuth\Exceptions\TokenExpiredException;
 use Tymon\JWTAuth\Exceptions\TokenInvalidException;
@@ -27,9 +28,17 @@ class JwtAuthMiddleware
                     'message' => 'token is required',
                     'code' => 401,
                 ];
-                return response()->json($error);
+                return response()->json($error)->setStatusCode(401);
             }
             $data = JWTAuth::decode($token)['user'];
+            //检测token是否存在黑名单中
+            if(Redis::zscore('blacklist_token', $token->get())){
+                $error = [
+                    'message' => 'token in blacklist',
+                    'code' => 401,
+                ];
+                return response()->json($error)->setStatusCode(401);
+            }
             if ($data->sign !== md5($data->uid . config('customer.jwt_secret'))) {
                 $error = [
                     'message' => 'request is not allow',