소스 검색

第一次提交

zuoyang@infocq.com 4 년 전
커밋
d10347c5ad
80개의 변경된 파일5114개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      .example.env
  2. 5 0
      .gitignore
  3. 42 0
      .travis.yml
  4. 32 0
      LICENSE.txt
  5. 56 0
      README.md
  6. 1 0
      app/.htaccess
  7. 22 0
      app/AppService.php
  8. 2 0
      app/admin/common.php
  9. 24 0
      app/admin/controller/Core.php
  10. 35 0
      app/admin/controller/Index.php
  11. 5 0
      app/admin/event.php
  12. 62 0
      app/admin/job/demoJob.php
  13. 5 0
      app/admin/middleware.php
  14. 79 0
      app/admin/model/TaxiCar.php
  15. 47 0
      app/admin/model/TaxiChauffeur.php
  16. 15 0
      app/admin/route/app.php
  17. 66 0
      app/admin/service/TaxiChauffeur.php
  18. 32 0
      app/admin/validate/LoginValidate.php
  19. 10 0
      app/admin/view/vote/login.html
  20. 2 0
      app/api/common.php
  21. 48 0
      app/api/controller/Index.php
  22. 5 0
      app/api/event.php
  23. 5 0
      app/api/middleware.php
  24. 11 0
      app/api/route/app.php
  25. 33 0
      app/api/validate/IndexValidate.php
  26. 25 0
      app/command/Schedule.php
  27. 52 0
      app/command/Task.php
  28. 31 0
      app/command/Test.php
  29. 206 0
      app/common.php
  30. 109 0
      app/common/AdminController.php
  31. 108 0
      app/common/BaseController.php
  32. 42 0
      app/common/BaseValidate.php
  33. 58 0
      app/common/ExceptionHandle.php
  34. 32 0
      app/common/Redis.php
  35. 8 0
      app/common/Request.php
  36. 36 0
      app/common/ReturnCode.php
  37. 97 0
      app/common/Token.php
  38. 20 0
      app/event.php
  39. 10 0
      app/middleware.php
  40. 25 0
      app/middleware/Admin.php
  41. 60 0
      app/middleware/Api.php
  42. 9 0
      app/provider.php
  43. 9 0
      app/service.php
  44. 70 0
      composer.json
  45. 2543 0
      composer.lock
  46. 42 0
      config/app.php
  47. 17 0
      config/auth.php
  48. 29 0
      config/cache.php
  49. 11 0
      config/console.php
  50. 20 0
      config/cookie.php
  51. 97 0
      config/database.php
  52. 24 0
      config/filesystem.php
  53. 45 0
      config/gateway_worker.php
  54. 27 0
      config/lang.php
  55. 52 0
      config/log.php
  56. 8 0
      config/middleware.php
  57. 39 0
      config/queue.php
  58. 13 0
      config/redis.php
  59. 45 0
      config/route.php
  60. 19 0
      config/session.php
  61. 10 0
      config/trace.php
  62. 12 0
      config/translation.php
  63. 25 0
      config/view.php
  64. 30 0
      config/worker.php
  65. 55 0
      config/worker_server.php
  66. 38 0
      database/migrations/20210526031434_jj_auth_group.php
  67. 39 0
      database/migrations/20210526034443_jj_auth_rule.php
  68. 39 0
      database/migrations/20210526034525_jj_auth_group_access.php
  69. 2 0
      extend/.gitignore
  70. 8 0
      public/.htaccess
  71. BIN
      public/favicon.ico
  72. 24 0
      public/index.php
  73. 2 0
      public/robots.txt
  74. 19 0
      public/router.php
  75. 2 0
      public/static/.gitignore
  76. 2 0
      runtime/.gitignore
  77. 52 0
      support/Translation.php
  78. 61 0
      support/lib/Instance.php
  79. 10 0
      think
  80. 1 0
      view/README.md

+ 1 - 0
.example.env

@@ -0,0 +1 @@
+APP_DEBUG = true

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = test
USERNAME = username
PASSWORD = password
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn

+ 5 - 0
.gitignore

@@ -0,0 +1,5 @@
+/.idea
+/.vscode
+/vendor
+*.log
+.env

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 42 - 0
.travis.yml


+ 32 - 0
LICENSE.txt

@@ -0,0 +1,32 @@
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+版权所有Copyright © 2006-2016 by ThinkPHP (http://thinkphp.cn)
+All rights reserved。
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+Apache Licence是著名的非盈利开源组织Apache采用的协议。
+该协议和BSD类似,鼓励代码共享和尊重原作者的著作权,
+允许代码修改,再作为开源或商业软件发布。需要满足
+的条件: 
+1. 需要给代码的用户一份Apache Licence ;
+2. 如果你修改了代码,需要在被修改的文件中说明;
+3. 在延伸的代码中(修改和有源代码衍生的代码中)需要
+带有原来代码中的协议,商标,专利声明和其他原来作者规
+定需要包含的说明;
+4. 如果再发布的产品中包含一个Notice文件,则在Notice文
+件中需要带有本协议内容。你可以在Notice中增加自己的
+许可,但不可以表现为对Apache Licence构成更改。 
+具体的协议参考:http://www.apache.org/licenses/LICENSE-2.0
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

+ 56 - 0
README.md

@@ -0,0 +1,56 @@
+ThinkPHP 6.0
+===============
+
+> 运行环境要求PHP7.1+,兼容PHP8.0。
+
+[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api)
+
+ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。
+
+## 主要新特性
+
+* 采用`PHP7`强类型(严格模式)
+* 支持更多的`PSR`规范
+* 原生多应用支持
+* 更强大和易用的查询
+* 全新的事件系统
+* 模型事件和数据库事件统一纳入事件系统
+* 模板引擎分离出核心
+* 内部功能中间件化
+* SESSION/Cookie机制改进
+* 对Swoole以及协程支持改进
+* 对IDE更加友好
+* 统一和精简大量用法
+
+## 安装
+
+~~~
+composer create-project topthink/think tp 6.0.*
+~~~
+
+如果需要更新框架使用
+~~~
+composer update topthink/framework
+~~~
+
+## 文档
+
+[完全开发手册](https://www.kancloud.cn/manual/thinkphp6_0/content)
+
+## 参与开发
+
+请参阅 [ThinkPHP 核心框架包](https://github.com/top-think/framework)。
+
+## 版权信息
+
+ThinkPHP遵循Apache2开源协议发布,并提供免费使用。
+
+本项目包含的第三方源码和二进制文件之版权信息另行标注。
+
+版权所有Copyright © 2006-2020 by ThinkPHP (http://thinkphp.cn)
+
+All rights reserved。
+
+ThinkPHP® 商标和著作权所有者为上海顶想信息科技有限公司。
+
+更多细节参阅 [LICENSE.txt](LICENSE.txt)

+ 1 - 0
app/.htaccess

@@ -0,0 +1 @@
+deny from all

+ 22 - 0
app/AppService.php

@@ -0,0 +1,22 @@
+<?php
+declare (strict_types = 1);
+
+namespace app;
+
+use think\Service;
+
+/**
+ * 应用服务类
+ */
+class AppService extends Service
+{
+    public function register()
+    {
+        // 服务注册
+    }
+
+    public function boot()
+    {
+        // 服务启动
+    }
+}

+ 2 - 0
app/admin/common.php

@@ -0,0 +1,2 @@
+<?php
+// 这是系统自动生成的公共文件

+ 24 - 0
app/admin/controller/Core.php

@@ -0,0 +1,24 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\admin\model\TaxiChauffeur;
+use app\common\AdminController;
+
+class Core extends AdminController
+{
+    protected $taxi_chauffeur;
+
+    public function __construct()
+    {
+        $this->taxi_chauffeur = new TaxiChauffeur();
+        parent::__construct();
+    }
+
+    public function xs()
+    {
+        $this->taxi_chauffeur->getChauffeurData();
+        //return '您好!';
+    }
+}

+ 35 - 0
app/admin/controller/Index.php

@@ -0,0 +1,35 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\controller;
+
+use app\admin\model\TaxiCar;
+use app\common\AdminController;
+
+class Index extends AdminController
+{
+    protected $cars_model = null;
+
+    public function __construct()
+    {
+        parent::__construct();
+
+        $this->cars_model = new TaxiCar();
+    }
+
+    public function index()
+    {
+        return '您好!这是一个[admin]示例应用';
+    }
+
+    public function carRes()
+    {
+        dd(123);
+        //$this->cars_model->getFile();
+        //$this->cars_model->editData();
+        $num = '渝ADE6192';//渝DZ8865 渝B12302 渝AE710Z
+        $vin = '500103069622';//LLNCGACA6HA003624 LSHDY56447879875E LLNCGACA0HA007832
+        $carid = '1';
+        $this->cars_model->getCarRes($num,$vin,$carid);
+    }
+}

+ 5 - 0
app/admin/event.php

@@ -0,0 +1,5 @@
+<?php
+// 这是系统自动生成的event定义文件
+return [
+
+];

+ 62 - 0
app/admin/job/demoJob.php

@@ -0,0 +1,62 @@
+<?php
+namespace app\admin\job;
+
+use think\facade\Log;
+use think\queue\Job;
+
+class demoJob
+{
+    /**
+     * fire是消息队列默认调用的方法
+     * @param Job $job 当前的任务对象
+     * @param array|mixed $data 发布任务时自定义的数据
+     */
+    public function fire(Job $job, $data)
+    {
+        //通过这个方法可以检查这个任务已经重试了几次了
+        //if ($job->attempts() > 3) {}
+
+        //有效消息到达消费者时可能已经不再需要执行了
+       /* if(!$this->checkJob($data)){
+            $job->delete();
+            return;
+        }*/
+
+        //执行业务处理
+        if($this->doJob($data)){
+            $job->delete();//任务执行成功后删除
+        }/*else{
+            //检查任务重试次数
+            if($job->attempts() > 3){
+                Log::channel('test')->record('234:'.$data);
+                $job->delete();
+            }
+        }*/
+
+        // 也可以重新发布这个任务
+        //$job->release($delay); //$delay为延迟时间
+    }
+
+    /**
+     * 根据消息中的数据进行实际的业务处理
+     */
+    private function doJob($data)
+    {
+        // 实际业务流程处理
+        try {
+            $data['status'] = rand(999);
+            Log::channel('test')->record(json_decode($data));
+        }catch (\Exception $exception){
+            Log::channel('test')->record('345'.$exception->getMessage());
+        }
+
+        return true;
+    }
+
+    //任务失败执行的方法
+    public function failed($data)
+    {
+        // ...任务达到最大重试次数后,失败了
+    }
+
+}

+ 5 - 0
app/admin/middleware.php

@@ -0,0 +1,5 @@
+<?php
+// 这是系统自动生成的middleware定义文件
+return [
+
+];

+ 79 - 0
app/admin/model/TaxiCar.php

@@ -0,0 +1,79 @@
+<?php
+namespace app\admin\model;
+
+use Curl\Curl;
+use GuzzleHttp\Client;
+use think\facade\Db;
+
+class TaxiCar
+{
+    protected $path = "http://dlyz.chefudang.cn:8102/transportapp/queryVehicleList?";
+
+    protected $curl = null;
+
+    public function __construct()
+    {
+        $this->db = Db::connect('mysql0');
+        $this->client = new Client();
+        $this->curl = new Curl();
+    }
+
+    /**
+     * 处理数据
+     * @throws \think\db\exception\DbException
+     */
+    public function editData()
+    {
+        $this->db->table('total_cars')
+            ->field('id,num,cert')
+            ->chunk(1000,function ($list){
+                foreach ($list as $item){
+                    //$certiticate = $this->findNum($item['Certiticate']);
+                    $this->getCarRes($item['num'],$item['cert'],$item['id']);
+                }
+            });
+    }
+
+    /**
+     * 更新车证状态
+     * @param $plate_number
+     * @param $vin_no
+     * @param $car_id
+     * @throws \think\db\exception\DbException
+     */
+    public function getCarRes($plate_number,$Certiticate,$car_id)
+    {
+        $plate_number = urlencode($plate_number);
+        $params = 'VehicleNo='.$plate_number.'&TransCertificateCode='.$Certiticate.'&Page=1&PageSize=10';
+        $url = $this->path.$params;
+        $re = curlGet($url);
+        if(strpos($re,'营运') !== false ){
+            $this->db->table('total_cars')
+                ->where('id','=',$car_id)
+                ->update(['is_leg'=>'有']);
+        }
+//        if(strpos($re,'注销') !== false || strpos($re,'服务器内部错误') !== false){
+//            $this->db->table('taxi_cars')
+//                ->where('carid','=',$car_id)
+//                ->update(['is_test'=>1]);
+//        }
+    }
+
+    /**
+     * 字符串中提取数字
+     * @param string $str
+     * @return string
+     */
+    public function findNum($str='')
+    {
+        $str=trim($str);
+        if(empty($str)){return '';}
+        $result='';
+        for($i=0;$i<strlen($str);$i++){
+            if(is_numeric($str[$i])){
+                $result.=$str[$i];
+            }
+        }
+        return $result;
+    }
+}

+ 47 - 0
app/admin/model/TaxiChauffeur.php

@@ -0,0 +1,47 @@
+<?php
+namespace app\admin\model;
+
+use Curl\Curl;
+use GuzzleHttp\Client;
+use think\facade\Db;
+
+/**
+ * Class TaxiChauffeur
+ * @package app\service
+ */
+class TaxiChauffeur
+{
+    protected $db;
+
+    protected $client;
+
+    protected $curl;
+
+    public $url = 'http://106.37.189.144:8080/staffcert-web/public/queryStaffCertFromTranscert.json';
+
+    public function __construct()
+    {
+        $this->db = Db::connect('mysql0');
+        $this->client = new Client();
+        $this->curl = new Curl();
+    }
+
+    public function getChauffeurData()
+    {
+        $this->db->table('taxi_chauffeur_copy1')
+            ->field('chauffeurid,card_num,areacode,fullname,is_test')
+            ->chunk(100,function ($list){
+                foreach ($list as $item){
+                    $this->updateIsLegitimate($item['chauffeurid']);
+                }
+            });
+    }
+
+    public function updateIsLegitimate($id)
+    {
+        $data = $this->db->table('taxi_chauffeur_copy1')
+            ->where('chauffeurid','=',$id)
+            ->update(['is_test'=>0]);
+        return $data;
+    }
+}

+ 15 - 0
app/admin/route/app.php

@@ -0,0 +1,15 @@
+<?php
+use think\facade\Route;
+Route::get('',function (){
+    return 'error url';
+});
+
+Route::get('hello', 'Index/index');
+
+Route::get('core', 'Core/xs');
+
+Route::get('cars', 'Index/carRes');
+
+//Route::group('xx', function (){
+//    Route::get('hello', 'index/index');
+//});

+ 66 - 0
app/admin/service/TaxiChauffeur.php

@@ -0,0 +1,66 @@
+<?php
+namespace app\admin\service;
+
+use Curl\Curl;
+use GuzzleHttp\Client;
+use think\facade\Db;
+
+/**
+ * Class TaxiChauffeur
+ * @package app\service
+ */
+class TaxiChauffeur
+{
+    protected $client;
+    protected $curl;
+
+    public $url = 'http://106.37.189.144:8080/staffcert-web/public/queryStaffCertFromTranscert.json';
+
+    public function __construct()
+    {
+        $this->client = new Client();
+        $this->curl = new Curl();
+    }
+
+    public function getChauffeurData($page,$size)
+    {
+        $data = Db::table('taxi_chauffeur_copy1')
+            ->field('chauffeurid,card_num,areacode,fullname,is_test')
+            ->page($page,$size)
+            ->select()
+            ->each(function ($item){
+                $item['areacode'] = substr_replace($item['areacode'],'0000',2);
+                return $item;
+            });
+        foreach ($data as $item){
+            dump($this->selectRes($item));
+        }
+        return ;
+    }
+
+    public function updateIsLegitimate($id)
+    {
+        $data = Db::table('taxi_chauffeur_copy1')
+            ->where('chauffeurid','=',$id)
+            ->update(['is_legitimate'=>2]);
+        return $data;
+    }
+
+    /**
+     * @param $data
+     * @return bool|mixed
+     */
+    public function selectRes($data)
+    {
+        $infos = [
+            'provinceCode'=>$data['areacode'],
+            'idCard'=>$data['card_num'],
+            'staffName'=>$data['fullname']
+        ];
+        if($this->curl->post($this->url,$infos)->response != '') {
+            $this->updateIsLegitimate($data['chauffeurid']);
+        }else{
+            return 'no legitimate'.$data['chauffeurid'];
+        }
+    }
+}

+ 32 - 0
app/admin/validate/LoginValidate.php

@@ -0,0 +1,32 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\validate;
+use app\common\BaseValidate;
+
+class LoginValidate extends BaseValidate
+{
+    /**
+     * 定义验证规则
+     * 格式:'字段名' =>  ['规则1','规则2'...]
+     *
+     * @var array
+     */
+    protected $rule = [
+        'phone'    => 'require',
+    ];
+
+    /**
+     * 定义错误信息
+     * 格式:'字段名.规则名' =>  '错误信息'
+     *
+     * @var array
+     */
+    protected $message = [
+        'phone.require' => '手机号不能为空',
+    ];
+
+    protected $scene = [
+        'vote' => ['phone']
+    ];
+}

+ 10 - 0
app/admin/view/vote/login.html

@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <title>Title</title>
+</head>
+<body>
+    <p>123</p>
+</body>
+</html>

+ 2 - 0
app/api/common.php

@@ -0,0 +1,2 @@
+<?php
+// 这是系统自动生成的公共文件

+ 48 - 0
app/api/controller/Index.php

@@ -0,0 +1,48 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\api\controller;
+
+use app\api\validate\IndexValidate;
+use app\common\BaseController;
+use app\common\Redis;
+use app\common\Request;
+use app\common\Token;
+use Curl\Curl;
+use GuzzleHttp\Client;
+use think\App;
+use think\facade\Db;
+
+
+class Index extends BaseController
+{
+    public function __construct()
+    {
+        parent::__construct();
+        $this->client = new Client();
+        $this->curl = new Curl();
+    }
+
+    public function hello(Request $request)
+    {
+        (new IndexValidate())->goCheck($request->param(),'phone');
+
+        return '123';
+    }
+    
+    public function test()
+    {
+        $user = [
+            'id' => 1,
+            'phone' => '12345678910'
+        ];
+        //$re = \app\common\Token::getToken($user);
+        //$re = \app\common\Token::getClientToken($user);
+        //$re = \app\common\Token::refreshToken($user);
+        // $re = Token::getTokenValue($token);
+        $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0cDYiLCJpYXQiOjE2MjAzNjk5NDcsImV4cCI6MTYyMDM3NzE0NywidXNlciI6eyJpZCI6MSwicGhvbmUiOiIxMjM0NTY3ODkxMCJ9fQ.err2aBVOeqTLnrpQ8p59BRNjKg95UJ-kAs7ktYP-VJI';
+        //$re = $this->redis->hSet('check_token_phone',$user['phone'],$token);
+        $re = $this->redis->hDel('check_token_phone',$user['phone']);
+        dd($re);
+    }
+}

+ 5 - 0
app/api/event.php

@@ -0,0 +1,5 @@
+<?php
+// 这是系统自动生成的event定义文件
+return [
+
+];

+ 5 - 0
app/api/middleware.php

@@ -0,0 +1,5 @@
+<?php
+// 这是系统自动生成的middleware定义文件
+return [
+
+];

+ 11 - 0
app/api/route/app.php

@@ -0,0 +1,11 @@
+<?php
+use think\facade\Route;
+
+Route::get('xx', function (){
+    echo 'hello world';
+});
+
+Route::group('city',function (){
+    Route::get('hello','index/hello');
+    Route::get('test','index/test');
+});

+ 33 - 0
app/api/validate/IndexValidate.php

@@ -0,0 +1,33 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\api\validate;
+
+use app\common\BaseValidate;
+
+class IndexValidate extends BaseValidate
+{
+    /**
+     * 定义验证规则
+     * 格式:'字段名' =>  ['规则1','规则2'...]
+     *
+     * @var array
+     */
+    protected $rule = [
+        'phone' => 'require'
+    ];
+
+    /**
+     * 定义错误信息
+     * 格式:'字段名.规则名' =>  '错误信息'
+     *
+     * @var array
+     */
+    protected $message = [
+        'phone.require' => '电话不能为空'
+    ];
+
+    protected $scene = [
+        'phone' => ['phone']
+    ];
+}

+ 25 - 0
app/command/Schedule.php

@@ -0,0 +1,25 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\command;
+
+use schedule\console\Command;
+use think\console\Input;
+use think\console\Output;
+
+class Schedule extends Command
+{
+    protected function configure()
+    {
+        // 指令配置
+        $this->setName('schedule:run')
+            ->setDescription('the schedule:run command');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        // 每5分钟执行一次test指令
+        $this->command('test')->everyFiveMinutes();
+        parent::execute($input,$output);
+    }
+}

+ 52 - 0
app/command/Task.php

@@ -0,0 +1,52 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\command;
+
+use app\admin\model\TaxiChauffeur;
+use think\console\Command;
+use think\console\Input;
+use think\console\input\Argument;
+use think\console\input\Option;
+use think\console\Output;
+
+class Task extends Command
+{
+    protected function configure()
+    {
+        // 指令配置
+        $this->setName('task')
+            //增加一个命令参数
+            ->addArgument('action', Argument::OPTIONAL, "action", '')
+            ->addArgument('force', Argument::OPTIONAL, "force", '');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        //获取输入参数
+        $action = trim($input->getArgument('action'));
+        $force = trim($input->getArgument('force'));
+
+        $task = new \EasyTask\Task();
+        $task->setDaemon(true);
+        //$task->setPrefix('task_test');
+        $task->setRunTimePath('./runtime/');
+
+        // 配置任务,开启1个进程每隔10秒进行一次
+        $task->addFunc(function () {
+            (new TaxiChauffeur())->getChauffeurData();
+            }, 'data_save', 30, 1);
+
+        // 根据命令执行
+        if ($action == 'start') {
+            $task->start();
+        } elseif ($action == 'status') {
+            $task->status();
+        } elseif ($action == 'stop') {
+            $force = ($force == 'force'); //是否强制停止
+            $task->stop($force);
+        } else {
+            exit('Command is not exist');
+        }
+    }
+}

+ 31 - 0
app/command/Test.php

@@ -0,0 +1,31 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\command;
+
+use app\admin\model\TaxiCar;
+use app\admin\model\TaxiChauffeur;
+use think\console\Command;
+use think\console\Input;
+use think\console\Output;
+use think\facade\Log;
+
+class Test extends Command
+{
+    protected function configure()
+    {
+        // 指令配置
+        $this->setName('test')
+            ->setDescription('the test command');
+    }
+
+    protected function execute(Input $input, Output $output)
+    {
+        // 业务逻辑
+        //(new TaxiChauffeur())->getChauffeurData();
+        (new TaxiCar())->editData();
+
+        //日志记录
+        Log::channel('test')->info('日志信息测试');
+    }
+}

+ 206 - 0
app/common.php

@@ -0,0 +1,206 @@
+<?php
+// 应用公共文件
+
+define('OBJ','obj');
+
+/*
+ * @param $url
+ * @return mixed|string
+ * 自定义 curlGet请求
+ */
+function curlGet($url)
+{
+    $curl = curl_init();
+    curl_setopt($curl, CURLOPT_URL, $url);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+    $output = curl_exec($curl);
+    if (curl_errno($curl)) {
+        return 'ERROR ' . curl_error($curl);
+    }
+    curl_close($curl);
+    return $output;
+}
+
+
+/*
+ * @param $url
+ * @return mixed|string
+ * 自定义 curlPost请求
+ */
+function curlPost($url, $data = null)
+{
+    $curl = curl_init();
+    curl_setopt($curl, CURLOPT_URL, $url);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
+    curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
+    if (!empty($data)) {
+        curl_setopt($curl, CURLOPT_POST, 1);
+        curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
+    }
+    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+    $output = curl_exec($curl);
+    curl_close($curl);
+    return $output;
+}
+
+/**
+ * @param null|string $id
+ * @param array $parameters
+ * @param string|null $domain
+ * @param string|null $locale
+ * @return string
+ */
+function trans(string $id, array $parameters = [], string $domain = null, string $locale = null)
+{
+    return \support\bootstrap\Translation::trans($id, $parameters, $domain, $locale);
+}
+
+/**
+ * 标准返回
+ * @param $msg
+ * @param $code
+ * @param string $data
+ */
+function reMsg($msg, $code, $data = null, $type = '')
+{
+    $options = JSON_UNESCAPED_UNICODE;
+    if ($data instanceof think\model\Collection or $data instanceof \think\Model) $data = $data->toArray();
+    if (empty($data) and $type == OBJ) $options = $options | JSON_FORCE_OBJECT;
+    return json(['code' => $code, 'msg' => $msg, 'data' => $data], $options);
+}
+
+/**
+ * 标准成功返回 列表
+ * @param string $msg
+ * @param string $data
+ */
+function success($msg = '', $data = [], $type = '')
+{
+    if (empty($msg)) $msg = trans('Success');
+    return reMsg($msg, \app\common\ReturnCode::SUCCESS, $data, $type);
+}
+
+/**
+ * @param string $msg
+ * @param int $code
+ * @param array $data
+ * @param string $return_type
+ * @return array|\think\response\Json
+ */
+function apiResponseSuccess( $msg = 'Success',$code = 200,$data = [] ,$return_type = 'json')
+{
+    $result = [
+        'msg'   => $msg,
+        'code'  => $code,
+        'data'  => empty($data) ? [] : $data,
+    ];
+    return $return_type == 'json' ? json($result) : $result;
+}
+
+/**
+ * 标准错误返回
+ * @param string $msg
+ * @param string $data
+ */
+function error($msg = '', $data = null, $type = OBJ)
+{
+    if (empty($msg)) $msg = trans('Error');
+    return reMsg($msg, \app\common\ReturnCode::ERROR, $data, $type);
+}
+
+
+/**
+ * @param array $fields
+ * @param string $type
+ * @return array|mixed
+ * 验证请求必须字段,并返回所有请求数据
+ */
+function checkField(array $fields = [], $type = 'post')
+{
+    $request = request();
+    $data = [];
+    if ($type == 'post') {
+        $data = $request->post();
+    } else if ($type == 'get') {
+        $data = $request->get();
+    } else if ($type == 'request') {
+        $data = $request->request();
+    }
+    if ($fields) {
+        foreach ($fields as $field) {
+            if (!isset($data[$field])) {
+                return error( '参数异常');
+            } else if ($field == 'phone') {
+                if (!preg_match('/^1[23456789]\d{9}$/', $data['phone'])) {
+                    return error( '请输入正确的手机号码');
+                }
+            }
+        }
+    }
+    return $data;
+}
+
+/**
+ * 将对象转换成数组
+ * @param $array
+ * @return array
+ */
+function objectToArray(array $array)
+{
+    if (is_object($array)) {
+        $array = (array)$array;
+    }
+    if (is_array($array)) {
+        foreach ($array as $key => $value) {
+            $array[$key] = objectToArray($value);
+        }
+    }
+    return $array;
+}
+
+/**
+ * 无限极分类
+ * @param $list
+ * @param string $pk
+ * @param string $pid
+ * @param string $child
+ * @param int $root
+ * @return array
+ */
+function makeTree($list, $pk = 'id', $pid = 'pid', $child = 'son', $root = 0)
+{
+    $tree = [];
+    $packData = [];
+    foreach ($list as $data) {
+        $packData[$data[$pk]] = $data;
+    }
+    foreach ($packData as $key => $val) {
+        if ($val[$pid] == $root) {
+            $tree[] =& $packData[$key];
+        } else {
+            $packData[$val[$pid]][$child][] =& $packData[$key];
+        }
+    }
+    return $tree;
+}
+
+/**
+ * 根据开始时间和结束时间获取中间时间
+ * @param $beginTime
+ * @param $endTime
+ * @return array
+ */
+function periodTime($beginTime, $endTime):array
+{
+    $i = 0;
+    $arr = [];
+    while ($beginTime <= $endTime) {
+        $arr[$i] = date('Y-m-d', $beginTime);
+        //$arr[$i] =  $beginTime;
+        $beginTime = strtotime('+1 day', $beginTime);
+        $i++;
+    }
+    return $arr;
+}

+ 109 - 0
app/common/AdminController.php

@@ -0,0 +1,109 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\common;
+
+use support\lib\Instance;
+use think\App;
+use think\cache\driver\Redis;
+use think\exception\ValidateException;
+use think\Validate;
+
+/**
+ * 控制器基础类
+ */
+abstract class AdminController
+{
+    /**
+     * Request实例
+     * @var \think\Request
+     */
+    protected $request;
+
+    /**
+     * 应用实例
+     * @var \think\App
+     */
+    //protected $app;
+
+    /**
+     * 是否批量验证
+     * @var bool
+     */
+    protected $batchValidate = false;
+
+    /**
+     * 控制器中间件
+     * @var array
+     */
+    protected $middleware = [
+        'app\middleware\Admin' => ['except' => ['index','xs','carRes']],//不需要鉴权的接口
+    ];
+
+    /**
+     * @var Redis|null
+     */
+    protected $redis = null;
+
+    /**
+     * 构造方法
+     * @access public
+     * @param  App  $app  应用对象
+     */
+    public function __construct()
+    {
+        //dd($this->middleware);
+        header('Access-Control-Allow-Origin: *');
+        header('Access-Control-Allow-Credentials: true');
+        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
+        header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId,Host,Referer");
+
+        // 控制器初始化
+        $this->initialize();
+
+        //单列redis
+        $this->redis = \app\common\Redis::getRedis();
+    }
+
+    // 初始化
+    protected function initialize()
+    {}
+
+    /**
+     * 验证数据
+     * @access protected
+     * @param  array        $data     数据
+     * @param  string|array $validate 验证器名或者验证规则数组
+     * @param  array        $message  提示信息
+     * @param  bool         $batch    是否批量验证
+     * @return array|string|true
+     * @throws ValidateException
+     */
+    protected function validate(array $data, $validate, array $message = [], bool $batch = false)
+    {
+        if (is_array($validate)) {
+            $v = new Validate();
+            $v->rule($validate);
+        } else {
+            if (strpos($validate, '.')) {
+                // 支持场景
+                [$validate, $scene] = explode('.', $validate);
+            }
+            $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
+            $v     = new $class();
+            if (!empty($scene)) {
+                $v->scene($scene);
+            }
+        }
+
+        $v->message($message);
+
+        // 是否批量验证
+        if ($batch || $this->batchValidate) {
+            $v->batch(true);
+        }
+
+        return $v->failException(true)->check($data);
+    }
+
+}

+ 108 - 0
app/common/BaseController.php

@@ -0,0 +1,108 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\common;
+
+use support\lib\Instance;
+use think\App;
+use think\cache\driver\Redis;
+use think\exception\ValidateException;
+use think\Validate;
+
+/**
+ * 控制器基础类
+ */
+abstract class BaseController
+{
+    /**
+     * Request实例
+     * @var \think\Request
+     */
+    protected $request;
+
+    /**
+     * 应用实例
+     * @var \think\App
+     */
+    //protected $app;
+
+    /**
+     * 是否批量验证
+     * @var bool
+     */
+    protected $batchValidate = false;
+
+    /**
+     * 控制器中间件
+     * @var array
+     */
+    protected $middleware = [
+        'app\middleware\Api' => ['except' => ['login','createUser','refresh','hello']],//不需要鉴权的接口
+    ];
+
+    /**
+     * @var Redis|null
+     */
+    protected $redis = null;
+
+    /**
+     * 构造方法
+     * @access public
+     * @param  App  $app  应用对象
+     */
+    public function __construct()
+    {
+        header('Access-Control-Allow-Origin: *');
+        header('Access-Control-Allow-Credentials: true');
+        header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS');
+        header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, authKey, sessionId,Host,Referer");
+
+        // 控制器初始化
+        $this->initialize();
+
+        //单列redis
+        $this->redis = \app\common\Redis::getRedis();
+    }
+
+    // 初始化
+    protected function initialize()
+    {}
+
+    /**
+     * 验证数据
+     * @access protected
+     * @param  array        $data     数据
+     * @param  string|array $validate 验证器名或者验证规则数组
+     * @param  array        $message  提示信息
+     * @param  bool         $batch    是否批量验证
+     * @return array|string|true
+     * @throws ValidateException
+     */
+    protected function validate(array $data, $validate, array $message = [], bool $batch = false)
+    {
+        if (is_array($validate)) {
+            $v = new Validate();
+            $v->rule($validate);
+        } else {
+            if (strpos($validate, '.')) {
+                // 支持场景
+                [$validate, $scene] = explode('.', $validate);
+            }
+            $class = false !== strpos($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate);
+            $v     = new $class();
+            if (!empty($scene)) {
+                $v->scene($scene);
+            }
+        }
+
+        $v->message($message);
+
+        // 是否批量验证
+        if ($batch || $this->batchValidate) {
+            $v->batch(true);
+        }
+
+        return $v->failException(true)->check($data);
+    }
+
+}

+ 42 - 0
app/common/BaseValidate.php

@@ -0,0 +1,42 @@
+<?php
+declare (strict_types = 1);
+namespace app\common;
+
+use think\exception\ValidateException;
+use think\Validate;
+
+class BaseValidate extends Validate
+{
+    /**
+     * @param $params
+     * @param null $scene
+     * @return bool
+     */
+    public function goCheck($params,$scene = '')
+    {
+        //须设置content-type:application/json
+        $result = $this->scene($scene)->check($params);
+        if (!$result) {
+             throw new ValidateException(is_array($this->error) ? implode(
+                ';', $this->error) : $this->error);
+        }else{
+            return true;
+        }
+    }
+
+    /**
+     * 正整数验证
+     * @param $value
+     * @param string $rule
+     * @param string $data
+     * @param string $field
+     * @return bool|string
+     */
+    protected function isPositiveInteger($value, $rule='', $data='', $field='')
+    {
+        if (is_numeric($value) && is_int($value + 0) && ($value + 0) > 0) {
+            return true;
+        }
+        return $field . '必须是正整数';
+    }
+}

+ 58 - 0
app/common/ExceptionHandle.php

@@ -0,0 +1,58 @@
+<?php
+namespace app\common;
+
+use think\db\exception\DataNotFoundException;
+use think\db\exception\ModelNotFoundException;
+use think\exception\Handle;
+use think\exception\HttpException;
+use think\exception\HttpResponseException;
+use think\exception\ValidateException;
+use think\Response;
+use Throwable;
+
+/**
+ * 应用异常处理类
+ */
+class ExceptionHandle extends Handle
+{
+    /**
+     * 不需要记录信息(日志)的异常类列表
+     * @var array
+     */
+    protected $ignoreReport = [
+        HttpException::class,
+        HttpResponseException::class,
+        ModelNotFoundException::class,
+        DataNotFoundException::class,
+        ValidateException::class,
+    ];
+
+    /**
+     * 记录异常信息(包括日志或者其它方式记录)
+     *
+     * @access public
+     * @param  Throwable $exception
+     * @return void
+     */
+    public function report(Throwable $exception): void
+    {
+        // 使用内置的方式记录异常日志
+        parent::report($exception);
+    }
+
+    /**
+     * Render an exception into an HTTP response.
+     *
+     * @access public
+     * @param \think\Request   $request
+     * @param Throwable $e
+     * @return Response
+     */
+    public function render($request, Throwable $e): Response
+    {
+        // 添加自定义异常处理机制
+
+        // 其他错误交给系统处理
+        return parent::render($request, $e);
+    }
+}

+ 32 - 0
app/common/Redis.php

@@ -0,0 +1,32 @@
+<?php
+//统一业务状态码 具体错误码再订
+namespace app\common;
+
+class Redis
+{
+    private static $_instance = null; //静态实例
+
+    private function __construct(){ //私有的构造方法
+        self::$_instance = new \Redis();
+        $config = config("redis"); // redis配置信息
+        self::$_instance->connect($config['host'],$config['port']);
+        if(isset($config['password'])){
+            self::$_instance->auth($config['password']);
+        }
+    }
+
+    //获取静态实例
+    public static  function getRedis()
+    {
+        if(!self::$_instance){
+            new self;
+        }
+        return self::$_instance;
+    }
+
+    /*
+     * 禁止clone
+     */
+    private function __clone()
+    {}
+}

+ 8 - 0
app/common/Request.php

@@ -0,0 +1,8 @@
+<?php
+namespace app\common;
+
+// 应用请求对象类
+class Request extends \think\Request
+{
+
+}

+ 36 - 0
app/common/ReturnCode.php

@@ -0,0 +1,36 @@
+<?php
+//统一业务状态码 具体错误码再订
+namespace app\common;
+
+class ReturnCode
+{
+    //通用错误
+    const SUCCESS = 200;  //成功
+    const ERROR = 400;  //通用失败
+    const INVALID = 1001; //无效的数据
+    //其他错误
+    const PERMISSION_DENIED = 1002;  //没有权限
+    const TOKEN_TIMEOUT = 1003;  //token超时
+    const TOKEN_ERROR = 1004;  //token错误
+    const UNKNOWN_ERROR = 1005;  //未知错误
+    const EXCEPTION = 1006; //未知异常
+    const RECORD_NOT_FOUND = 1007; //记录未找到
+    const DELETE_FAILED = 1008; // 删除失败
+    const ADD_FAILED = 1009; // 添加记录失败
+    const UPDATE_FAILED = 1010; // 添加记录失败
+    const PARAM_INVALID = 1011; // 参数无效
+    const AUTH_ERROR = 1012;   //权限错误
+    const FILE_SAVE_ERROR = 1013;  //保存失败
+    const LOGIN_ERROR = 1014;  //登陆出错
+    const NOT_EXISTS = 1015;  //数据不存在
+    const JSON_PARSE_FAIL = 1016;  //json解析错误
+    const TYPE_ERROR = 1017;  //类型错误
+    const NUMBER_MATCH_ERROR = 1018; //数字不匹配
+    const EMPTY_PARAMS = 1019;  //参数为空
+    const DATA_EXISTS = 1020;  //数据已存在
+    const USERNAME_OR_PASSWORD_WRONG = 1021;  //用户名或者密码错误
+    const VERIFICATION_CODE_ERROR = 1022;  //验证码错误
+    const RATE_IS_TOO_HIGH = 1023;  //速率限制
+    const TheShopIsClosed = 1024;  //店铺已打烊
+    const PleaseApplyFirst = 1025;  //请先申请成为商铺
+}

+ 97 - 0
app/common/Token.php

@@ -0,0 +1,97 @@
+<?php
+namespace app\common;
+
+use Firebase\JWT\JWT;
+use think\Exception;
+
+class Token
+{
+    private static $key = '@#$%^&*!';
+
+    /**
+     * @param $user
+     * @return array
+     */
+    public static function getToken($user)
+    {
+        $accessToken = self::createAccessToken($user);
+        $refreshToken = self::createRefreshToken($user);
+        return [
+            'access_token' => $accessToken,
+            'refresh_token' => $refreshToken
+        ];
+    }
+
+    /**
+     * @param $user
+     * @return string[]
+     */
+    public static function getClientToken($user)
+    {
+        $accessToken = self::createAccessToken($user);
+        return [
+            'access_token' => $accessToken,
+        ];
+    }
+
+    /**
+     * 刷新token
+     * @return string[]
+     * @throws Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public static function refreshToken($user)
+    {
+        $accessToken = self::createAccessToken($user);
+        return [
+            'access_token' => $accessToken,
+        ];
+    }
+
+    /**
+     * 创建token
+     * @param $user
+     * @return string
+     */
+    private static function createAccessToken($user)
+    {
+        $payload = [
+            'iss' => 'tp6', //签发者
+            'iat' => time(), //什么时候签发的
+            'exp' => time() + 7200, //过期时间
+            'user' => $user,
+        ];
+        $token = JWT::encode($payload, self::$key);
+        return $token;
+    }
+
+    /**
+     * 创建刷新token
+     * @param $user
+     * @return string
+     */
+    private static function createRefreshToken($user)
+    {
+        $payload = [
+            'iss' => 'tp6', //签发者
+            'iat' => time(), //什么时候签发的
+            'user' => $user,
+        ];
+        $token = JWT::encode($payload, self::$key);
+        return $token;
+    }
+
+    /**
+     * 根据token获取用户信息
+     * @param $token
+     * @return mixed|string
+     */
+    public static function getTokenValue($token)
+    {
+        $secretKey = self::$key;
+        $jwt = (array)JWT::decode($token, $secretKey, ['HS256']);
+        return $jwt['user']??'';
+    }
+}

+ 20 - 0
app/event.php

@@ -0,0 +1,20 @@
+<?php
+// 事件定义文件
+return [
+    //绑定
+    'bind'      => [
+    ],
+
+    //监听
+    'listen'    => [
+        'AppInit'  => [],
+        'HttpRun'  => [],
+        'HttpEnd'  => [],
+        'LogLevel' => [],
+        'LogWrite' => [],
+    ],
+
+    //订阅
+    'subscribe' => [
+    ],
+];

+ 10 - 0
app/middleware.php

@@ -0,0 +1,10 @@
+<?php
+// 全局中间件定义文件
+return [
+    // 全局请求缓存
+    // \think\middleware\CheckRequestCache::class,
+    // 多语言加载
+    // \think\middleware\LoadLangPack::class,
+    // Session初始化
+    // \think\middleware\SessionInit::class
+];

+ 25 - 0
app/middleware/Admin.php

@@ -0,0 +1,25 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\middleware;
+
+use think\wenhainan\Auth;
+
+class Admin
+{
+    /**
+     * @param $request
+     * @param \Closure $next
+     * @return array|mixed|\think\response\Json
+     */
+    public function handle($request, \Closure $next)
+    {
+        $controller = request()->controller();
+        $action = request()->action();
+        $auth = new Auth();
+        if(!$auth->check($controller . '-' . $action, 123)){
+            return error('你没有权限访问,请联系管理员!' , 401);
+        }
+        return $next($request);
+    }
+}

+ 60 - 0
app/middleware/Api.php

@@ -0,0 +1,60 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\middleware;
+
+use app\common\Redis;
+use app\common\Request;
+use app\common\Token;
+use Firebase\JWT\JWT;
+use think\Exception;
+
+class Api
+{
+    /**
+     *  处理请求
+     * @param $request
+     * @param \Closure $next
+     * @return \think\response\Json
+     */
+    public function handle($request, \Closure $next)
+    {
+        $authorization = $request->header('authorization');
+
+        if(!$authorization) {
+            return error('请求未携带authorization信息');
+        }
+
+        if(count(explode(' ', $authorization)) < 2){
+            return error('接口认证方式错误');
+        }
+
+        list($type, $token) = explode(' ', $authorization);
+
+        if ($type !== 'Bearer') {
+            return error('接口认证方式需为Bearer');
+        }
+
+        if (!$token) {
+            return error('尝试获取的authorization信息不存在');
+        }
+
+        $msg = Redis::getRedis()->hGet('check_token_phone','12345678910');
+        if($token != $msg){
+            return error('未登陆或token失效,请重新登陆');
+        }
+
+        try {
+            Token::getTokenValue($token);
+        } catch (\Firebase\JWT\SignatureInvalidException $e) {  //签名不正确
+            return error('令牌签名不正确');
+        } catch (\Firebase\JWT\BeforeValidException $e) {  // 签名在某个时间点之后才能用
+            return error('令牌尚未生效',401);
+        } catch (\Firebase\JWT\ExpiredException $e) {  // token过期
+            return error('令牌已过期,刷新浏览器重试',401);
+        } catch (Exception $e) {  //其他错误
+            throw new Exception($e->getMessage());
+        }
+        return $next($request);
+    }
+}

+ 9 - 0
app/provider.php

@@ -0,0 +1,9 @@
+<?php
+use app\common\ExceptionHandle;
+use app\common\Request;
+
+// 容器Provider定义文件
+return [
+    'think\Request'          => Request::class,
+    'think\exception\Handle' => ExceptionHandle::class,
+];

+ 9 - 0
app/service.php

@@ -0,0 +1,9 @@
+<?php
+
+use app\AppService;
+
+// 系统服务定义文件
+// 服务在完成全局初始化之后执行
+return [
+    AppService::class,
+];

+ 70 - 0
composer.json

@@ -0,0 +1,70 @@
+{
+    "name": "topthink/think",
+    "description": "the new thinkphp framework",
+    "type": "project",
+    "keywords": [
+        "framework",
+        "thinkphp",
+        "ORM"
+    ],
+    "homepage": "http://thinkphp.cn/",
+    "license": "Apache-2.0",
+    "authors": [
+        {
+            "name": "liu21st",
+            "email": "liu21st@gmail.com"
+        },
+        {
+            "name": "yunwuxin",
+            "email": "448901948@qq.com"
+        }        
+    ],
+    "require": {
+        "php": ">=7.1.0",
+        "topthink/framework": "^6.0.0",
+        "topthink/think-orm": "^2.0",
+        "easy-task/easy-task": "^2.4",
+        "topthink/think-queue": "^3.0",
+        "ext-curl": "*",
+        "guzzlehttp/guzzle": "^6.3",
+        "curl/curl": "^2.3",
+        "topthink/think-multi-app": "^1.0",
+        "yzh52521/schedule": "^1.0",
+        "topthink/think-worker": "^3.0",
+        "ext-json": "*",
+        "jsonrpc/jsonrpc": "^1.0",
+        "ext-redis": "^5.3@RC",
+        "firebase/php-jwt": "^5.2",
+        "topthink/think-view": "^1.0",
+        "wenhainan/thinkphp6-auth": "^1.0",
+        "topthink/think-migration": "^3.0"
+    },
+    "require-dev": {
+        "symfony/var-dumper": "^4.2",
+        "topthink/think-trace":"^1.0"
+    },
+    "autoload": {
+        "psr-4": {
+            "app\\": "app"
+        },
+        "psr-0": {
+            "": "extend/"
+        }
+    },
+    "config": {
+        "preferred-install": "dist"
+    },
+    "scripts": {
+        "post-autoload-dump": [
+            "@php think service:discover",
+            "@php think vendor:publish"
+        ]
+    },
+
+    "repositories": {
+        "packagist": {
+            "type": "composer",
+            "url": "https://mirrors.aliyun.com/composer/"
+        }
+    }
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 2543 - 0
composer.lock


+ 42 - 0
config/app.php

@@ -0,0 +1,42 @@
+<?php
+// +----------------------------------------------------------------------
+// | 应用设置
+// +----------------------------------------------------------------------
+
+return [
+    // 应用地址
+    'app_host'         => env('app.host', ''),
+    // 应用的命名空间
+    'app_namespace'    => '',
+    // 是否启用路由
+    'with_route'       => true,
+
+    // 默认时区
+    'default_timezone' => 'Asia/Shanghai',
+
+    // 开启多应用
+    'auto_multi_app' => true,
+    // 开启应用快速访问
+    'app_express'    => true,
+    // 默认应用
+    'default_app'    => 'api',
+
+    // 应用映射(自动多应用模式有效)
+    'app_map'          => [
+        'admin' => 'admin',//类似于分组 访问/admin => 访问 admin 应用
+        '' => 'api', //其他就是 api 应用
+    ],
+
+    // 域名绑定(自动多应用模式有效)
+    'domain_bind'      => [],
+    // 禁止URL访问的应用列表(自动多应用模式有效)
+    'deny_app_list'    => [],
+
+    // 异常页面的模板文件
+    'exception_tmpl'   => app()->getThinkPath() . 'tpl/think_exception.tpl',
+
+    // 错误显示信息,非调试模式有效
+    'error_message'    => '页面错误!请稍后再试~',
+    // 显示错误信息
+    'show_error_msg'   => false,
+];

+ 17 - 0
config/auth.php

@@ -0,0 +1,17 @@
+<?php
+/**
+ * Created by wenhainan.
+ * User: wenhainan
+ * QQ群: 606645328
+ * 官网: http://www.waytomilky.com/  
+ * Date: 2020/3/02
+ * Time: 22:50
+ */
+return[
+    'auth_on'           => 1, // 权限开关
+    'auth_type'         => 1, // 认证方式,1为实时认证;2为登录认证。
+    'auth_group'        => 'jj_auth_group', // 用户组数据不带前缀表名
+    'auth_group_access' => 'jj_auth_group_access', // 用户-用户组关系不带前缀表名
+    'auth_rule'         => 'jj_auth_rule', // 权限规则不带前缀表名
+    'auth_user_admin'         => 'jj_user_admin', // 用户信息表不带前缀表名,主键自增字段为id
+];

+ 29 - 0
config/cache.php

@@ -0,0 +1,29 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | 缓存设置
+// +----------------------------------------------------------------------
+
+return [
+    // 默认缓存驱动
+    'default' => env('cache.driver', 'file'),
+
+    // 缓存连接方式配置
+    'stores'  => [
+        'file' => [
+            // 驱动方式
+            'type'       => 'File',
+            // 缓存保存目录
+            'path'       => '',
+            // 缓存前缀
+            'prefix'     => '',
+            // 缓存有效期 0表示永久缓存
+            'expire'     => 0,
+            // 缓存标签前缀
+            'tag_prefix' => 'tag:',
+            // 序列化机制 例如 ['serialize', 'unserialize']
+            'serialize'  => [],
+        ],
+        // 更多的缓存连接
+    ],
+];

+ 11 - 0
config/console.php

@@ -0,0 +1,11 @@
+<?php
+// +----------------------------------------------------------------------
+// | 控制台配置
+// +----------------------------------------------------------------------
+return [
+    // 指令定义
+    'commands' => [
+        'schedule:run' => app\command\Schedule::class,
+        'test' => 'app\command\Test'
+    ],
+];

+ 20 - 0
config/cookie.php

@@ -0,0 +1,20 @@
+<?php
+// +----------------------------------------------------------------------
+// | Cookie设置
+// +----------------------------------------------------------------------
+return [
+    // cookie 保存时间
+    'expire'    => 0,
+    // cookie 保存路径
+    'path'      => '/',
+    // cookie 有效域名
+    'domain'    => '',
+    //  cookie 启用安全传输
+    'secure'    => false,
+    // httponly设置
+    'httponly'  => false,
+    // 是否使用 setcookie
+    'setcookie' => true,
+    // samesite 设置,支持 'strict' 'lax'
+    'samesite'  => '',
+];

+ 97 - 0
config/database.php

@@ -0,0 +1,97 @@
+<?php
+
+return [
+    // 默认使用的数据库连接配置
+    'default'         => env('database.driver', 'mysql1'),
+
+    // 自定义时间查询规则
+    'time_query_rule' => [],
+
+    // 自动写入时间戳字段
+    // true为自动识别类型 false关闭
+    // 字符串则明确指定时间字段类型 支持 int timestamp datetime date
+    'auto_timestamp'  => true,
+
+    // 时间字段取出后的默认时间格式
+    'datetime_format' => 'Y-m-d H:i:s',
+
+    // 数据库连接配置信息
+    'connections'     => [
+        'mysql0' => [
+            // 数据库类型
+            'type'            => env('database0.type', 'mysql'),
+            // 服务器地址
+            'hostname'        => env('database0.hostname', '39.108.105.15'),
+            // 数据库名
+            'database'        => env('database0.database', 'nettaxi1'),
+            // 用户名
+            'username'        => env('database0.username', 'root'),
+            // 密码
+            'password'        => env('database0.password', 'KeYpZrZx'),
+            // 端口
+            'hostport'        => env('database0.hostport', '3306'),
+            // 数据库连接参数
+            'params'          => [],
+            // 数据库编码默认采用utf8
+            'charset'         => env('database0.charset', 'utf8'),
+            // 数据库表前缀
+            'prefix'          => env('database0.prefix', ''),
+
+            // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+            'deploy'          => 0,
+            // 数据库读写是否分离 主从式有效
+            'rw_separate'     => false,
+            // 读写分离后 主服务器数量
+            'master_num'      => 1,
+            // 指定从服务器序号
+            'slave_no'        => '',
+            // 是否严格检查字段是否存在
+            'fields_strict'   => true,
+            // 是否需要断线重连
+            'break_reconnect' => false,
+            // 监听SQL
+            'trigger_sql'     => env('app_debug', true),
+            // 开启字段缓存
+            'fields_cache'    => false,
+        ],
+
+        // 更多的数据库配置信息
+        'mysql1' => [
+            // 数据库类型
+            'type'            => env('database1.type', 'mysql'),
+            // 服务器地址
+            'hostname'        => env('database1.hostname', '127.0.0.1'),
+            // 数据库名
+            'database'        => env('database1.database', ''),
+            // 用户名
+            'username'        => env('database1.username', 'root'),
+            // 密码
+            'password'        => env('database1.password', ''),
+            // 端口
+            'hostport'        => env('database1.hostport', '3306'),
+            // 数据库连接参数
+            'params'          => [],
+            // 数据库编码默认采用utf8
+            'charset'         => env('database1.charset', 'utf8'),
+            // 数据库表前缀
+            'prefix'          => env('database1.prefix', ''),
+
+            // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
+            'deploy'          => 0,
+            // 数据库读写是否分离 主从式有效
+            'rw_separate'     => false,
+            // 读写分离后 主服务器数量
+            'master_num'      => 1,
+            // 指定从服务器序号
+            'slave_no'        => '',
+            // 是否严格检查字段是否存在
+            'fields_strict'   => true,
+            // 是否需要断线重连
+            'break_reconnect' => false,
+            // 监听SQL
+            'trigger_sql'     => env('app_debug', true),
+            // 开启字段缓存
+            'fields_cache'    => false,
+        ],
+    ],
+];

+ 24 - 0
config/filesystem.php

@@ -0,0 +1,24 @@
+<?php
+
+return [
+    // 默认磁盘
+    'default' => env('filesystem.driver', 'local'),
+    // 磁盘列表
+    'disks'   => [
+        'local'  => [
+            'type' => 'local',
+            'root' => app()->getRuntimePath() . 'storage',
+        ],
+        'public' => [
+            // 磁盘类型
+            'type'       => 'local',
+            // 磁盘路径
+            'root'       => app()->getRootPath() . 'public/storage',
+            // 磁盘路径对应的外部URL路径
+            'url'        => '/storage',
+            // 可见性
+            'visibility' => 'public',
+        ],
+        // 更多的磁盘配置信息
+    ],
+];

+ 45 - 0
config/gateway_worker.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// +----------------------------------------------------------------------
+// | Workerman设置 仅对 php think worker:gateway 指令有效
+// +----------------------------------------------------------------------
+return [
+    // 扩展自身需要的配置
+    'protocol'              => 'websocket', // 协议 支持 tcp udp unix http websocket text
+    'host'                  => '0.0.0.0', // 监听地址
+    'port'                  => 2348, // 监听端口
+    'socket'                => '', // 完整监听地址
+    'context'               => [], // socket 上下文选项
+    'register_deploy'       => true, // 是否需要部署register
+    'businessWorker_deploy' => true, // 是否需要部署businessWorker
+    'gateway_deploy'        => true, // 是否需要部署gateway
+
+    // Register配置
+    'registerAddress'       => '127.0.0.1:1236',
+
+    // Gateway配置
+    'name'                  => 'thinkphp',
+    'count'                 => 1,
+    'lanIp'                 => '127.0.0.1',
+    'startPort'             => 2000,
+    'daemonize'             => false,
+    'pingInterval'          => 30,
+    'pingNotResponseLimit'  => 0,
+    'pingData'              => '{"type":"ping"}',
+
+    // BusinsessWorker配置
+    'businessWorker'        => [
+        'name'         => 'BusinessWorker',
+        'count'        => 1,
+        'eventHandler' => '\think\worker\Events',
+    ],
+
+];

+ 27 - 0
config/lang.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | 多语言设置
+// +----------------------------------------------------------------------
+
+return [
+    // 默认语言
+    'default_lang'    => env('lang.default_lang', 'zh-cn'),
+    // 允许的语言列表
+    'allow_lang_list' => [],
+    // 多语言自动侦测变量名
+    'detect_var'      => 'lang',
+    // 是否使用Cookie记录
+    'use_cookie'      => true,
+    // 多语言cookie变量
+    'cookie_var'      => 'think_lang',
+    // 多语言header变量
+    'header_var'      => 'think-lang',
+    // 扩展语言包
+    'extend_list'     => [],
+    // Accept-Language转义为对应语言包名称
+    'accept_language' => [
+        'zh-hans-cn' => 'zh-cn',
+    ],
+    // 是否支持语言分组
+    'allow_group'     => false,
+];

+ 52 - 0
config/log.php

@@ -0,0 +1,52 @@
+<?php
+
+// +----------------------------------------------------------------------
+// | 日志设置
+// +----------------------------------------------------------------------
+return [
+    // 默认日志记录通道
+    'default'      => env('log.channel', 'file'),
+    // 日志记录级别
+    'level'        => [],
+    // 日志类型记录的通道 ['error'=>'email',...]
+    'type_channel' => [],
+    // 关闭全局日志写入
+    'close'        => false,
+    // 全局日志处理 支持闭包
+    'processor'    => null,
+
+    // 日志通道列表
+    'channels'     => [
+        'file' => [
+            // 日志记录方式
+            'type'           => 'File',
+            // 日志保存目录
+            'path'           => '',
+            // 单文件日志写入
+            'single'         => false,
+            // 独立日志级别
+            'apart_level'    => [],
+            // 最大日志文件数量
+            'max_files'      => 0,
+            // 使用JSON格式记录
+            'json'           => false,
+            // 日志处理
+            'processor'      => null,
+            // 关闭通道日志写入
+            'close'          => false,
+            // 日志输出格式化
+            'format'         => '[%s][%s] %s',
+            // 是否实时写入
+            'realtime_write' => false,
+        ],
+        // 其它日志通道配置
+
+        //test通道 log::channel('test')->info('message');
+        'test'    =>    [
+            'type'           => 'File',
+            'path'           => 'runtime/test',
+            'json'           => true,
+        ],
+    ],
+
+];

+ 8 - 0
config/middleware.php

@@ -0,0 +1,8 @@
+<?php
+// 中间件配置
+return [
+    // 别名或分组
+    'alias'    => [],
+    // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行
+    'priority' => [],
+];

+ 39 - 0
config/queue.php

@@ -0,0 +1,39 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2016 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: yunwuxin <448901948@qq.com>
+// +----------------------------------------------------------------------
+
+return [
+    'default'     => 'sync',
+    'connections' => [
+        'sync'     => [
+            'type' => 'sync',
+        ],
+        'database' => [
+            'type'       => 'database',
+            'queue'      => 'default',
+            'table'      => 'jobs',
+            'connection' => null,
+        ],
+        'redis'    => [
+            'type'       => 'redis',
+            'queue'      => 'default',
+            'host'       => '127.0.0.1',
+            'port'       => 6379,
+            'password'   => '',
+            'select'     => 0,
+            'timeout'    => 0,
+            'persistent' => false,
+        ],
+    ],
+    'failed'      => [
+        'type'  => 'none',
+        'table' => 'failed_jobs',
+    ],
+];

+ 13 - 0
config/redis.php

@@ -0,0 +1,13 @@
+<?php
+return [
+    'host'       => env('redis.host','127.0.0.1'),
+    'port'       => env('redis.port','6379'),
+    'password'   => env('redis.password',''),
+    'select'     => 0,
+    'timeout'    => 0,
+    'expire'     => 0,
+    'persistent' => false,
+    'prefix'     => '',
+    'tag_prefix' => 'tag:',
+    'serialize'  => [],
+];

+ 45 - 0
config/route.php

@@ -0,0 +1,45 @@
+<?php
+// +----------------------------------------------------------------------
+// | 路由设置
+// +----------------------------------------------------------------------
+
+return [
+    // pathinfo分隔符
+    'pathinfo_depr'         => '/',
+    // URL伪静态后缀
+    'url_html_suffix'       => 'html',
+    // URL普通方式参数 用于自动生成
+    'url_common_param'      => true,
+    // 是否开启路由延迟解析
+    'url_lazy_route'        => false,
+    // 是否强制使用路由
+    'url_route_must'        => true,
+    // 合并路由规则
+    'route_rule_merge'      => false,
+    // 路由是否完全匹配
+    'route_complete_match'  => false,
+    // 访问控制器层名称
+    'controller_layer'      => 'controller',
+    // 空控制器名
+    'empty_controller'      => 'Error',
+    // 是否使用控制器后缀
+    'controller_suffix'     => false,
+    // 默认的路由变量规则
+    'default_route_pattern' => '[\w\.]+',
+    // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
+    'request_cache_key'     => false,
+    // 请求缓存有效期
+    'request_cache_expire'  => null,
+    // 全局请求缓存排除规则
+    'request_cache_except'  => [],
+    // 默认控制器名
+    'default_controller'    => 'Index',
+    // 默认操作名
+    'default_action'        => 'index',
+    // 操作方法后缀
+    'action_suffix'         => '',
+    // 默认JSONP格式返回的处理方法
+    'default_jsonp_handler' => 'jsonpReturn',
+    // 默认JSONP处理方法
+    'var_jsonp_handler'     => 'callback',
+];

+ 19 - 0
config/session.php

@@ -0,0 +1,19 @@
+<?php
+// +----------------------------------------------------------------------
+// | 会话设置
+// +----------------------------------------------------------------------
+
+return [
+    // session name
+    'name'           => 'PHPSESSID',
+    // SESSION_ID的提交变量,解决flash上传跨域
+    'var_session_id' => '',
+    // 驱动方式 支持file cache
+    'type'           => 'file',
+    // 存储连接标识 当type使用cache的时候有效
+    'store'          => null,
+    // 过期时间
+    'expire'         => 1440,
+    // 前缀
+    'prefix'         => '',
+];

+ 10 - 0
config/trace.php

@@ -0,0 +1,10 @@
+<?php
+// +----------------------------------------------------------------------
+// | Trace设置 开启调试模式后有效
+// +----------------------------------------------------------------------
+return [
+    // 内置Html和Console两种方式 支持扩展
+    'type'    => 'Html',
+    // 读取的日志通道名
+    'channel' => '',
+];

+ 12 - 0
config/translation.php

@@ -0,0 +1,12 @@
+<?php
+/**
+ * 多语言配置
+ */
+return [
+    // 默认语言
+    'locale' => 'zh_CN',
+    // 回退语言
+    'fallback_locale' => ['zh_CN', 'en'],
+    // 语言文件存放的文件夹
+    'path' => base_path() . '/resource/translations',
+];

+ 25 - 0
config/view.php

@@ -0,0 +1,25 @@
+<?php
+// +----------------------------------------------------------------------
+// | 模板设置
+// +----------------------------------------------------------------------
+
+return [
+    // 模板引擎类型使用Think
+    'type'          => 'Think',
+    // 默认模板渲染规则 1 解析为小写+下划线 2 全部转换小写 3 保持操作方法
+    'auto_rule'     => 1,
+    // 模板目录名
+    'view_dir_name' => 'view',
+    // 模板后缀
+    'view_suffix'   => 'html',
+    // 模板文件名分隔符
+    'view_depr'     => DIRECTORY_SEPARATOR,
+    // 模板引擎普通标签开始标记
+    'tpl_begin'     => '{',
+    // 模板引擎普通标签结束标记
+    'tpl_end'       => '}',
+    // 标签库标签开始标记
+    'taglib_begin'  => '{',
+    // 标签库标签结束标记
+    'taglib_end'    => '}',
+];

+ 30 - 0
config/worker.php

@@ -0,0 +1,30 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | Workerman设置 仅对 php think worker 指令有效
+// +----------------------------------------------------------------------
+return [
+    // 扩展自身需要的配置
+    'host'                  => '0.0.0.0', // 监听地址
+    'port'                  => 2346, // 监听端口
+    'root'                  => '', // WEB 根目录 默认会定位public目录
+    'app_path'              => '', // 应用目录 守护进程模式必须设置(绝对路径)
+    'file_monitor'          => false, // 是否开启PHP文件更改监控(调试模式下自动开启)
+    'file_monitor_interval' => 2, // 文件监控检测时间间隔(秒)
+    'file_monitor_path'     => [], // 文件监控目录 默认监控application和config目录
+
+    // 支持workerman的所有配置参数
+    'name'                  => 'thinkphp',
+    'count'                 => 4,
+    'daemonize'             => false,
+    'pidFile'               => '',
+];

+ 55 - 0
config/worker_server.php

@@ -0,0 +1,55 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2018 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// +----------------------------------------------------------------------
+// | Workerman设置 仅对 php think worker:server 指令有效
+// +----------------------------------------------------------------------
+return [
+    // 扩展自身需要的配置
+    'protocol'       => 'websocket', // 协议 支持 tcp udp unix http websocket text
+    'host'           => '0.0.0.0', // 监听地址
+    'port'           => 2345, // 监听端口
+    'socket'         => '', // 完整监听地址
+    'context'        => [], // socket 上下文选项
+    'worker_class'   => '', // 自定义Workerman服务类名 支持数组定义多个服务
+
+    // 支持workerman的所有配置参数
+    'name'           => 'thinkphp',
+    'count'          => 4,
+    'daemonize'      => false,
+    'pidFile'        => '',
+
+    // 支持事件回调
+    // onWorkerStart
+    'onWorkerStart'  => function ($worker) {
+
+    },
+    // onWorkerReload
+    'onWorkerReload' => function ($worker) {
+
+    },
+    // onConnect
+    'onConnect'      => function ($connection) {
+
+    },
+    // onMessage
+    'onMessage'      => function ($connection, $data) {
+        $connection->send('receive success');
+    },
+    // onClose
+    'onClose'        => function ($connection) {
+
+    },
+    // onError
+    'onError'        => function ($connection, $code, $msg) {
+        echo "error [ $code ] $msg\n";
+    },
+];

+ 38 - 0
database/migrations/20210526031434_jj_auth_group.php

@@ -0,0 +1,38 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+
+class JjAuthGroup extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        // create the table
+        $table  =  $this->table('jj_auth_group',array('engine'=>'MyISAM','comment' => '用户组表','primary_key' => ['id'],'id'=>true));
+        $table->addColumn('title', 'char',array('limit'  =>  100,'default'=>'','comment'=>'用户组中文名称'))
+            ->addColumn('status', 'integer',array('limit'  =>  1,'default'=>1,'comment'=>'状态:为1正常,为0禁用'))
+            ->addColumn('rules', 'char',array('limit'  =>  100,'default'=>'','comment'=>'用户组拥有的规则id, 多个规则","隔开'))
+            ->create();
+    }
+}

+ 39 - 0
database/migrations/20210526034443_jj_auth_rule.php

@@ -0,0 +1,39 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+
+class JjAuthRule extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table  =  $this->table('jj_auth_rule',array('engine'=>'MyISAM','id'=>true,'comment' => '规则表','primary_key' => ['id']));
+        $table->addColumn('name', 'char',array('limit'  =>  80,'default'=>'','comment'=>'规则唯一标识'))
+            ->addColumn('title', 'char',array('limit'  =>  20,'default'=>'','comment'=>'规则中文名称'))
+            ->addColumn('status', 'integer',array('limit'  =>  1,'default'=>1,'comment'=>'状态:为1正常,为0禁用'))
+            ->addColumn('condition', 'char',array('limit'  =>  100,'default'=>'','comment'=>'规则表达式,为空表示存在就验证,不为空表示按照条件验证'))
+            ->addIndex(array('name'), array('unique'  =>  true))
+            ->create();
+    }
+}

+ 39 - 0
database/migrations/20210526034525_jj_auth_group_access.php

@@ -0,0 +1,39 @@
+<?php
+
+use think\migration\Migrator;
+use think\migration\db\Column;
+
+class JjAuthGroupAccess extends Migrator
+{
+    /**
+     * Change Method.
+     *
+     * Write your reversible migrations using this method.
+     *
+     * More information on writing migrations is available here:
+     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
+     *
+     * The following commands can be used in this method and Phinx will
+     * automatically reverse them when rolling back:
+     *
+     *    createTable
+     *    renameTable
+     *    addColumn
+     *    renameColumn
+     *    addIndex
+     *    addForeignKey
+     *
+     * Remember to call "create()" or "update()" and NOT "save()" when working
+     * with the Table class.
+     */
+    public function change()
+    {
+        $table  =  $this->table('jj_auth_group_access',array('engine'=>'MyISAM','id'=>false,'comment' => '用户组明细表'));
+        $table->addColumn('uid', 'integer',array('limit'  =>  8,'comment'=>'用户id'))
+            ->addColumn('group_id', 'integer',array('limit'  =>  8,'comment'=>'用户组id'))
+            ->addIndex(array('uid','group_id'), array('unique'  =>  true))
+            ->addIndex(array('uid'))
+            ->addIndex(array('group_id'))
+            ->create();
+    }
+}

+ 2 - 0
extend/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 8 - 0
public/.htaccess

@@ -0,0 +1,8 @@
+<IfModule mod_rewrite.c>
+  Options +FollowSymlinks -Multiviews
+  RewriteEngine On
+
+  RewriteCond %{REQUEST_FILENAME} !-d
+  RewriteCond %{REQUEST_FILENAME} !-f
+  RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
+</IfModule>

BIN
public/favicon.ico


+ 24 - 0
public/index.php

@@ -0,0 +1,24 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006-2019 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+
+// [ 应用入口文件 ]
+namespace think;
+
+require __DIR__ . '/../vendor/autoload.php';
+
+// 执行HTTP应用并响应
+$http = (new App())->http;
+
+$response = $http->run();
+
+$response->send();
+
+$http->end($response);

+ 2 - 0
public/robots.txt

@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:

+ 19 - 0
public/router.php

@@ -0,0 +1,19 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkPHP [ WE CAN DO IT JUST THINK ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2006~2019 http://thinkphp.cn All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: liu21st <liu21st@gmail.com>
+// +----------------------------------------------------------------------
+// $Id$
+
+if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
+    return false;
+} else {
+    $_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
+
+    require __DIR__ . "/index.php";
+}

+ 2 - 0
public/static/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 2 - 0
runtime/.gitignore

@@ -0,0 +1,2 @@
+*
+!.gitignore

+ 52 - 0
support/Translation.php

@@ -0,0 +1,52 @@
+<?php
+namespace support\bootstrap;
+
+use Symfony\Component\Translation\Translator;
+use Symfony\Component\Translation\Loader\PhpFileLoader;
+
+/**
+ * Class Translation
+ * @package support\bootstrap
+ * @method static string trans(?string $id, array $parameters = [], string $domain = null, string $locale = null)
+ * @method static void setLocale(string $locale)
+ * @method static string getLocale()
+ */
+class Translation{
+
+    /**
+     * @var array
+     */
+    protected static $_translator = [];
+
+    public static function start()
+    {
+        if (!class_exists('\Symfony\Component\Translation\Translator')) {
+            return;
+        }
+        $config = config('translation', []);
+        static::$_translator = $translator = new Translator($config['locale']);
+        $translator->addLoader('phpfile', new PhpFileLoader());
+        $translator->setFallbackLocales($config['fallback_locale']);
+        if (!$translations_path = realpath($config['path'])) {
+            return;
+        }
+        foreach (glob($translations_path . DIRECTORY_SEPARATOR . '*' . DIRECTORY_SEPARATOR . '*.php') as $file) {
+            $domain = basename($file, '.php');
+            $dir_name = pathinfo($file, PATHINFO_DIRNAME);
+            $locale = substr(strrchr($dir_name, DIRECTORY_SEPARATOR), 1);
+            if ($domain && $locale) {
+                $translator->addResource('phpfile', $file, $locale, $domain);
+            }
+        }
+    }
+
+    /**
+     * @param $name
+     * @param $arguments
+     * @return mixed
+     */
+    public static function __callStatic($name, $arguments)
+    {
+        return static::$_translator->{$name}(... $arguments);
+    }
+}

+ 61 - 0
support/lib/Instance.php

@@ -0,0 +1,61 @@
+<?php
+namespace support\lib;
+
+/**
+ * 单例容器   ,如果不需要 DI容器的可以用次单例模式
+ * Class Instance
+ * @package core\lib
+ */
+abstract class Instance
+{
+    /**
+     * 单例容器
+     * @var array
+     */
+    private static $_instances = [];
+
+    /**
+     * @var null
+     */
+    protected static $_class = null;
+
+
+    /**
+     * 单例模式
+     * 对象会存入单例容器,随着进程而保持
+     * @param bool $loadConfig
+     * @return static
+     */
+    final public static function instance($loadConfig = false)
+    {
+        self::$_class = get_called_class();
+        if (!isset(self::$_instances[self::$_class]) or !self::$_instances[self::$_class] instanceof Instance) {
+            self::$_instances[self::$_class] = new self::$_class($loadConfig);
+        }
+        return self::$_instances[self::$_class];
+    }
+
+
+    /**
+     * 工厂模式
+     *  对象不会存入单例容器,随着方法体执行完毕而被PHP GC主动回收
+     * @param bool $config
+     * @return static
+     */
+    final public static function factory($config = false)
+    {
+        $class = get_called_class();
+        return new $class($config);
+    }
+
+    /**
+     * 单例容器全清
+     *  清除后交给PHP GC进行回收
+     */
+    final public function instanceClean()
+    {
+        foreach (self::$_instances as $key => $instance) {
+            unset($key);
+        }
+    }
+}

+ 10 - 0
think

@@ -0,0 +1,10 @@
+#!/usr/bin/env php
+<?php
+namespace think;
+
+// 命令行入口文件
+// 加载基础文件
+require __DIR__ . '/vendor/autoload.php';
+
+// 应用初始化
+(new App())->console->run();

+ 1 - 0
view/README.md

@@ -0,0 +1 @@
+如果不使用模板,可以删除该目录