wesmiler 5 лет назад
Родитель
Сommit
e64a4fe512

+ 1 - 0
app/Controller/IndexController.php

@@ -17,6 +17,7 @@ class IndexController extends AbstractController
 
     public function index()
     {
+        echo __('test').'++';
         return ApiResource::success(1013);
     }
 }

+ 1 - 2
app/Controller/Resource/ApiResource.php

@@ -17,13 +17,12 @@ class ApiResource extends JsonResource
 
         $msg = is_numeric($msg)? __('api.'.$msg) :$msg;
         $result = [
-            'code' => __('api.1001'),
+            'code' => __('1001'),
             'message' => $msg,
         ];
         if ($data !== null) {
             $result['data'] = $data;
         }
-        var_dump($result);
         return $result;
     }
 

+ 2 - 1
composer.json

@@ -37,7 +37,8 @@
         "hyperf/tracer": "~2.0.0",
         "phper666/hyperf-server-command": "~1.0.0",
         "hyperf/resource": "^2.0",
-        "hyperf/translation": "^2.0"
+        "hyperf/translation": "^2.0",
+        "phper666/jwt-auth": "^3.0"
     },
     "require-dev": {
         "swoole/ide-helper": "^4.5",

+ 142 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "300330a03d63ecc572a42a60dc1fad16",
+    "content-hash": "5163f3587c9f0cd7628ffa2397424686",
     "packages": [
         {
             "name": "doctrine/annotations",
@@ -3397,6 +3397,81 @@
             "time": "2020-09-14T14:23:00+00:00"
         },
         {
+            "name": "lcobucci/jwt",
+            "version": "3.3.3",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/lcobucci/jwt.git",
+                "reference": "c1123697f6a2ec29162b82f170dd4a491f524773"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/lcobucci/jwt/zipball/c1123697f6a2ec29162b82f170dd4a491f524773",
+                "reference": "c1123697f6a2ec29162b82f170dd4a491f524773",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-mbstring": "*",
+                "ext-openssl": "*",
+                "php": "^5.6 || ^7.0"
+            },
+            "require-dev": {
+                "mikey179/vfsstream": "~1.5",
+                "phpmd/phpmd": "~2.2",
+                "phpunit/php-invoker": "~1.1",
+                "phpunit/phpunit": "^5.7 || ^7.3",
+                "squizlabs/php_codesniffer": "~2.3"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Lcobucci\\JWT\\": "src"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
+            "authors": [
+                {
+                    "name": "Luís Otávio Cobucci Oblonczyk",
+                    "email": "lcobucci@gmail.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "A simple library to work with JSON Web Token and JSON Web Signature",
+            "keywords": [
+                "JWS",
+                "jwt"
+            ],
+            "support": {
+                "issues": "https://github.com/lcobucci/jwt/issues",
+                "source": "https://github.com/lcobucci/jwt/tree/3.3.3"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/lcobucci",
+                    "type": "github"
+                },
+                {
+                    "url": "https://www.patreon.com/lcobucci",
+                    "type": "patreon"
+                }
+            ],
+            "time": "2020-08-20T13:22:28+00:00"
+        },
+        {
             "name": "markrogoyski/math-php",
             "version": "v0.49.0",
             "source": {
@@ -4144,6 +4219,72 @@
             "time": "2020-07-28T05:38:15+00:00"
         },
         {
+            "name": "phper666/jwt-auth",
+            "version": "v3.0.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phper666/jwt-auth.git",
+                "reference": "48c50257cacb4168b1e1121f6b287708ad00a1e5"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phper666/jwt-auth/zipball/48c50257cacb4168b1e1121f6b287708ad00a1e5",
+                "reference": "48c50257cacb4168b1e1121f6b287708ad00a1e5",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-swoole": ">=4.4",
+                "lcobucci/jwt": "^3.2",
+                "nesbot/carbon": "^1.0 || ^2.0",
+                "php": ">=7.2"
+            },
+            "suggest": {
+                "hyperf/cache": "required hyperf/cache ~2.0.0 OR required hyperf/cache ~1.1.0",
+                "hyperf/command": "required hyperf/command ~2.0.0 OR required hyperf/command ~1.1.0",
+                "hyperf/config": "required hyperf/config ~2.0.0 OR required hyperf/config ~1.1.0",
+                "hyperf/di": "required hyperf/di ~2.0.0 OR required hyperf/di ~1.1.0"
+            },
+            "type": "library",
+            "extra": {
+                "hyperf": {
+                    "config": "Phper666\\JWTAuth\\ConfigProvider"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Phper666\\JWTAuth\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Li Yuzhao",
+                    "email": "562405704@qq.com",
+                    "homepage": "https://github.com/phper666/jwt-auth",
+                    "role": "Developer"
+                }
+            ],
+            "description": "jwt-auth Component",
+            "keywords": [
+                "hyperf",
+                "php"
+            ],
+            "support": {
+                "issues": "https://github.com/phper666/jwt-auth/issues",
+                "source": "https://github.com/phper666/jwt-auth/tree/3.0.1"
+            },
+            "time": "2020-06-22T13:48:02+00:00"
+        },
+        {
             "name": "phpoption/phpoption",
             "version": "1.7.5",
             "source": {

+ 1 - 0
storage/languages/zh_CN/api.php

@@ -74,4 +74,5 @@ return [
     '4007'=> '删除栏目失败',
 
 
+    'test'=> '测试',
 ];