Browse Source

更新,修改sass问题

lzj500 3 years ago
parent
commit
8ee0ef08a2
100 changed files with 1362 additions and 1165 deletions
  1. 2 0
      .gitignore
  2. 1 0
      api/.example.env
  3. 2 1
      thinkphp6/.gitignore
  4. 0 0
      api/.travis.yml
  5. 0 0
      api/LICENSE.txt
  6. 5 1
      thinkphp6/README.md
  7. 0 0
      api/app/.htaccess
  8. 0 0
      api/app/AppService.php
  9. 0 0
      api/app/BaseController.php
  10. 0 0
      api/app/ExceptionHandle.php
  11. 0 0
      api/app/Request.php
  12. 11 0
      api/app/api/ErrorCode.php
  13. 0 0
      api/app/api/common.php
  14. 174 0
      api/app/api/controller/Base.php
  15. 0 0
      api/app/api/controller/BaseAuthorized.php
  16. 85 0
      api/app/api/controller/Index.php
  17. 137 0
      api/app/api/controller/Record.php
  18. 39 0
      api/app/api/controller/User.php
  19. 0 0
      api/app/api/event.php
  20. 0 0
      api/app/api/middleware.php
  21. 0 0
      api/app/common.php
  22. 11 7
      thinkphp6/app/api/ErrorCode.php
  23. 2 0
      api/app/common/common.php
  24. 5 0
      api/app/common/event.php
  25. 5 0
      api/app/common/middleware.php
  26. 119 0
      api/app/common/model/Base.php
  27. 35 0
      api/app/common/model/Record.php
  28. 10 0
      api/app/common/model/Type.php
  29. 135 0
      api/app/common/model/User.php
  30. 1 1
      thinkphp6/app/common/util/Rsa.php
  31. 0 0
      api/app/common/util/SingleObjectClass.php
  32. 130 0
      api/app/common/util/Util.php
  33. 17 0
      api/app/controller/Index.php
  34. 0 0
      api/app/event.php
  35. 0 0
      api/app/middleware.php
  36. 1 2
      thinkphp6/app/middleware/AllowCrossDomain.php
  37. 0 0
      api/app/provider.php
  38. 0 0
      api/app/service.php
  39. 0 0
      api/composer.json
  40. 67 68
      thinkphp6/composer.lock
  41. 0 2
      thinkphp6/config/app.php
  42. 0 0
      api/config/cache.php
  43. 0 0
      api/config/common.php
  44. 0 0
      api/config/console.php
  45. 2 0
      thinkphp6/config/cookie.php
  46. 20 19
      thinkphp6/config/database.php
  47. 0 0
      api/config/filesystem.php
  48. 2 0
      thinkphp6/config/lang.php
  49. 0 0
      api/config/log.php
  50. 0 0
      api/config/middleware.php
  51. 1 1
      thinkphp6/config/route.php
  52. 0 0
      api/config/session.php
  53. 0 0
      api/config/trace.php
  54. 0 0
      api/config/view.php
  55. 0 0
      api/extend/.gitignore
  56. 0 0
      api/public/.htaccess
  57. 0 0
      api/public/favicon.ico
  58. 0 13
      thinkphp6/public/index.php
  59. 0 0
      api/public/robots.txt
  60. 0 0
      api/public/router.php
  61. 0 0
      api/public/static/.gitignore
  62. 0 0
      api/route/app.php
  63. 2 0
      api/runtime/.gitignore
  64. 0 0
      api/think
  65. 100 0
      api/time_manager.sql
  66. 0 0
      api/view/README.md
  67. 6 0
      api/说明.md
  68. 0 1
      thinkphp6/.env
  69. 0 158
      thinkphp6/app/api/controller/Base.php
  70. 0 12
      thinkphp6/app/api/controller/Index.php
  71. 0 48
      thinkphp6/app/common/ErrorCode.php
  72. 0 129
      thinkphp6/app/common/controller/Base.php
  73. 0 18
      thinkphp6/app/common/model/Base.php
  74. 0 100
      thinkphp6/app/common/model/Demo.php
  75. 0 36
      thinkphp6/app/index/ErrorCode.php
  76. 0 49
      thinkphp6/app/index/controller/Base.php
  77. 0 62
      thinkphp6/app/index/controller/Demo.php
  78. 0 42
      thinkphp6/app/index/controller/Index.php
  79. 0 47
      thinkphp6/demo.sql
  80. 0 1
      thinkphp6/首次使用说明.txt
  81. 0 17
      uniapp/App.vue
  82. 0 9
      uniapp/config.js
  83. 0 71
      uniapp/libs/model/demo.js
  84. 0 39
      uniapp/libs/net/request.js
  85. 0 22
      uniapp/libs/net/sign.js
  86. 0 5
      uniapp/libs/net/urls.js
  87. 0 7
      uniapp/libs/util.js
  88. 0 11
      uniapp/main.js
  89. 0 71
      uniapp/manifest.json
  90. 0 16
      uniapp/package-lock.json
  91. 0 16
      uniapp/pages.json
  92. 0 59
      uniapp/pages/index/index.vue
  93. 5 4
      uniapp/.gitignore
  94. 9 0
      uniapp_cli/.prettierrc
  95. 19 0
      uniapp_cli/README.md
  96. 63 0
      uniapp_cli/babel.config.js
  97. 11 0
      uniapp_cli/jsconfig.json
  98. 106 0
      uniapp_cli/package.json
  99. 22 0
      uniapp_cli/postcss.config.js
  100. 0 0
      uniapp_cli/public/index.html

+ 2 - 0
.gitignore

@@ -83,3 +83,5 @@ fabric.properties
 sftp-config.json
 sftp-config.json
 
 
 /uniapp/node_modules
 /uniapp/node_modules
+/uniapp_cli/pnpm-lock.yaml
+/uniapp_cli/package-lock.json

+ 1 - 0
api/.example.env

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

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = time_manager
USERNAME = root
PASSWORD = root
HOSTPORT = 3306
CHARSET = utf8mb4
DEBUG = true

[LANG]
default_lang = zh-cn

+ 2 - 1
thinkphp6/.gitignore

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

thinkphp6/.travis.yml → api/.travis.yml


thinkphp6/LICENSE.txt → api/LICENSE.txt


+ 5 - 1
thinkphp6/README.md

@@ -1,7 +1,11 @@
 ThinkPHP 6.0
 ThinkPHP 6.0
 ===============
 ===============
 
 
-> 运行环境要求PHP7.1+。
+> 运行环境要求PHP7.1+,兼容PHP8.0。
+
+[官方应用服务市场](https://market.topthink.com) | [`ThinkAPI`——官方统一API服务](https://docs.topthink.com/think-api)
+
+ThinkPHPV6.0版本由[亿速云](https://www.yisu.com/)独家赞助发布。
 
 
 ## 主要新特性
 ## 主要新特性
 
 

thinkphp6/app/.htaccess → api/app/.htaccess


thinkphp6/app/AppService.php → api/app/AppService.php


thinkphp6/app/BaseController.php → api/app/BaseController.php


thinkphp6/app/ExceptionHandle.php → api/app/ExceptionHandle.php


thinkphp6/app/Request.php → api/app/Request.php


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

@@ -0,0 +1,11 @@
+<?php
+
+
+namespace app\api;
+
+
+class ErrorCode extends \app\common\ErrorCode
+{
+
+
+}

thinkphp6/app/api/common.php → api/app/api/common.php


+ 174 - 0
api/app/api/controller/Base.php

@@ -0,0 +1,174 @@
+<?php
+
+
+namespace app\api\controller;
+
+
+use app\api\ErrorCode;
+use app\api\model\User;
+use app\BaseController;
+use app\common\model\Place;
+use think\exception\HttpResponseException;
+use think\exception\ValidateException;
+use think\facade\Log;
+use think\Response;
+
+class Base
+{
+
+    protected $checkTokenOpen = false;//是否校验token
+    public $user;//用户
+
+
+    public function __construct()
+    {
+        Log::record("---------------------------", "info");
+        Log::record($_SERVER['REQUEST_METHOD'] . '  ' . getUrl(), 'info');
+        Log::record('REFERER  ' . (array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : ""), 'info');
+        Log::record('GET  ' . json_encode($_GET, JSON_UNESCAPED_UNICODE), 'info');
+        Log::record('POST  ' . json_encode($_POST, JSON_UNESCAPED_UNICODE), 'info');
+        Log::record('cookie  ' . json_encode($_COOKIE, JSON_UNESCAPED_UNICODE), 'info');
+        Log::record('input  ' . json_encode(input('param.'), JSON_UNESCAPED_UNICODE), 'info');
+        $this->checkApiSign();
+
+        if ($this->checkTokenOpen) {
+            $this->checkToken();
+        }
+    }
+
+
+    /**
+     * 获取token
+     * @return array|mixed|string|null
+     */
+    protected function getToken()
+    {
+        $token = null;
+        if (!$token) {
+            //from header
+            $token = request()->header("token");
+        }
+        if (!$token) {
+            //from url
+            $token = input("token");
+        }
+        return $token;
+    }
+
+    /**
+     * 检测token
+     * token规则
+     * token由base64编码,解码后分为密文、主键、过期时间(时间戳)三部分,用竖线|隔开
+     */
+    public function checkToken()
+    {
+        $token = $this->getToken();
+        if (!$token) {
+            $this->error(ErrorCode::getError(ErrorCode::CODE_TOKEN_NONE), ErrorCode::CODE_TOKEN_NONE);
+        }
+        $tokerReal = base64_decode($token);
+        $tokenArr = explode("|", $tokerReal);//拆分token
+
+        if (count($tokenArr) != 3) {
+            $this->error(ErrorCode::getError(ErrorCode::CODE_TOKEN_FORMAT_ERR), ErrorCode::CODE_TOKEN_FORMAT_ERR);
+        }
+        //判断token有没有超时
+        if (time() > $tokenArr[2]) {
+            $this->error(ErrorCode::getError(ErrorCode::CODE_TOKEN_EXPIRE), ErrorCode::CODE_TOKEN_EXPIRE);
+        }
+        //以下部分根据自己的业务实现
+
+        //$field = "id,login_name,valid,last_login_time,login_count,token";
+        $user = \app\common\model\User::where("token", "=", $token)->find();//找到token
+        if (!$user) {
+            $this->error(ErrorCode::getError(ErrorCode::CODE_TOKEN_ERR), ErrorCode::CODE_TOKEN_ERR);
+        }
+        $this->user = $user;
+
+    }
+
+    /**
+     * 返回成功信息
+     * @param $data
+     * @param string $msg
+     */
+    public function success($data, $msg = "")
+    {
+
+        $res = returnFormat(0, $msg, $data);
+
+        Log::record("response:" . mb_substr(json_encode($res, JSON_UNESCAPED_UNICODE), 0, 1000) . ",code:0", "debug");
+        throw new HttpResponseException(Response::create($res, "json"));
+    }
+
+    /**
+     * 简易错误提示
+     * @param $code
+     */
+    public function errorSimple($code)
+    {
+        $this->error(ErrorCode::getError($code), $code);
+    }
+
+    /**
+     * 返回失败信息
+     * @param $msg
+     * @param int $code
+     * @param array $data
+     */
+    public function error($msg, $code = 999, $data = [])
+    {
+        $res = returnFormat($code, $msg, $data);
+        Log::record("response:" . mb_substr(json_encode($res, JSON_UNESCAPED_UNICODE), 0, 1000) . ",code:" . $code, "debug");
+        throw new HttpResponseException(Response::create($res, "json"));
+    }
+
+    /**
+     * 自动校验
+     * @param $class
+     * @param $param
+     */
+    public function autoValid($class, $param)
+    {
+        try {
+            validate($class)->check($param);
+        } catch (ValidateException $e) {
+            // 验证失败 输出错误信息
+            $this->error($e->getError());
+        }
+    }
+
+    /**
+     * 检查签名
+     */
+    public function checkApiSign()
+    {
+
+        $timestampLimit = 20;
+        $param = request()->param();
+
+        $this->autoValid([
+            "_timestamp" => "require",
+            "_sign" => "require",
+        ], $param);
+        if (!($param["_timestamp"] >= time() - $timestampLimit * 60 && $param["_timestamp"] <= time() + $timestampLimit * 60)) {
+            $this->error("时间戳不合法,请刷新");
+        }
+        $sign = $param["_sign"];
+        unset($param["_sign"]);
+        ksort($param);
+
+        $param['_timestamp'] = $param['_timestamp'];
+        $secret = config("common.api_sign_secret");
+        $signStr = stripslashes(json_encode($param, JSON_UNESCAPED_UNICODE) . $secret);
+
+        $sign2 = md5($signStr);
+
+        if ($sign !== $sign2) {
+            Log::record("签名错误:sign: $sign sign2: $sign2", "debug");
+            Log::record("sign2 签名key:".$secret,"debug");
+            Log::record("sign2 签名字符串:".$signStr,"debug");
+            $this->error("签名错误。" . $signStr);
+        }
+    }
+}

thinkphp6/app/api/controller/BaseAuthorized.php → api/app/api/controller/BaseAuthorized.php


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

@@ -0,0 +1,85 @@
+<?php
+declare (strict_types=1);
+
+namespace app\api\controller;
+
+use think\facade\Db;
+
+class Index extends Base
+{
+    public function index()
+    {
+        return '您好!这是一个[api]示例应用';
+    }
+
+    /**
+     * 注册
+     */
+    public function reg()
+    {
+        $param = request()->param();
+        $rules = [
+            "login_name" => "require|length:2,25",
+            'password' => 'require|length:6,25',
+            'repassword' => 'require|confirm:password',
+        ];
+        $this->autoValid($rules, $param);
+
+
+        // 启动事务,用事务实现注册
+        $res = $this->regTrans($param);
+        if ($res["code"] != 0) {
+            $this->error($res['msg'], $res["code"]);
+        }
+        $this->success($res['data']);
+    }
+
+    /**
+     * 注册事务
+     */
+    private function regTrans($param)
+    {
+        Db::startTrans();
+        try {
+            $res = \app\common\model\User::regUser($param["login_name"], $param["password"]);
+            if ($res["code"] != 0) {
+                // 回滚事务
+                Db::rollback();
+                return $res;
+            }
+            $res = \app\common\model\User::login($param["login_name"], $param["password"]);
+            if ($res["code"] != 0) {
+                // 回滚事务c
+                Db::rollback();
+                return $res;
+            }
+            Db::commit();
+        } catch (\Exception $e) {
+            // 回滚事务
+            Db::rollback();
+            return returnFormat(9999, (string)$e);
+        }
+
+
+        return $res;
+    }
+
+    /**
+     * 登录
+     */
+    public function login()
+    {
+        $param = request()->param();
+        $rules = [
+            "login_name" => "require|length:2,25",
+            'password' => 'require|length:6,25',
+        ];
+        $this->autoValid($rules, $param);
+        $res = \app\common\model\User::login($param["login_name"], $param["password"]);
+        if ($res["code"] != 0) {
+            $this->error($res['msg'], $res["code"]);
+        }
+        $this->success($res['data']);
+    }
+
+}

+ 137 - 0
api/app/api/controller/Record.php

@@ -0,0 +1,137 @@
+<?php
+
+
+namespace app\api\controller;
+
+
+use app\common\ErrorCode;
+use app\common\model\Type;
+
+class Record extends BaseAuthorized
+{
+    public function typeList()
+    {
+        $typeList = Type::where("valid", "=", "1")->select();
+        $this->success($typeList);
+    }
+
+    public function add()
+    {
+        ///^(20|21|22|23|[0-1]\d):[0-5]\d:[0-5]\d$/;
+        $param = request()->param();
+        $rules = [
+            "record_date" => "require|date",
+            "record_begin" => "require",
+            "record_end" => "require",
+            "type_id" => "require|number",
+            "remark" => "require|max:25",
+        ];
+        $this->autoValid($rules, $param);
+        $record = new \app\common\model\Record([
+            "record_date" => $param["record_date"],
+            "record_begin" => $param["record_begin"],
+            "record_end" => $param["record_end"],
+            "type_id" => $param["type_id"],
+            "remark" => $param["remark"],
+            "user_id" => $this->user->id,
+        ]);
+        $record->record_long = $record->computeRecordLong();
+        $res = $record->save();
+        if ($res === false) {
+            //数据库读写失败
+            $this->error(ErrorCode::getError(ErrorCode::CODE_DB_ERROR), ErrorCode::CODE_DB_ERROR);
+
+        }
+        $this->success(ErrorCode::CODE_SUCC);
+
+    }
+
+    public function detail(){
+        $param = request()->param();
+        $rules = [
+            "id" => "require|number",
+
+        ];
+        $this->autoValid($rules, $param);
+        $record = \app\common\model\Record::find($param["id"]);
+        $record->type;
+        if (!$record) {
+            $this->error("记录未找到", ErrorCode::CODE_RECORD_NOT_FOUND);
+        }
+        $this->success($record);
+    }
+
+    public function edit()
+    {
+        $param = request()->param();
+        $rules = [
+            "id" => "require|number",
+            "record_date" => "require|date",
+            "record_begin" => "require",
+            "record_end" => "require",
+            "type_id" => "require|number",
+            "remark" => "require|max:25",
+        ];
+        $this->autoValid($rules, $param);
+        $record = \app\common\model\Record::find($param["id"]);
+        if (!$record) {
+            $this->error("记录未找到", ErrorCode::CODE_RECORD_NOT_FOUND);
+        }
+        $record->record_date = $param["record_date"];
+        $record->record_begin = $param["record_begin"];
+        $record->record_end = $param["record_end"];
+        $record->type_id = $param["type_id"];
+        $record->remark = $param["remark"];
+        $record->record_long = $record->computeRecordLong();
+        $res = $record->save();
+        if ($res === false) {
+            //数据库读写失败
+            $this->error(ErrorCode::getError(ErrorCode::CODE_DB_ERROR), ErrorCode::CODE_DB_ERROR);
+
+        }
+        $this->success(ErrorCode::CODE_SUCC);
+    }
+
+    public function delete()
+    {
+        $param = request()->param();
+        $rules = [
+            "id" => "require|number",
+        ];
+        $this->autoValid($rules, $param);
+        $res = \app\common\model\Record::where("id", "=", $param["id"])->delete();
+        if ($res === false) {
+            //数据库读写失败
+            $this->error(ErrorCode::getError(ErrorCode::CODE_DB_ERROR), ErrorCode::CODE_DB_ERROR);
+
+        }
+        $this->success(ErrorCode::CODE_SUCC);
+    }
+
+    public function index()
+    {
+        $param = request()->param();
+        $rules = [
+            "date" => "require|date"
+        ];
+        $this->autoValid($rules, $param);
+        //找当月
+        $dateStamp = strtotime($param["date"]);//当天的时间戳
+        $beginDay = date("Y-m-1", $dateStamp);//月头
+        $endDay = date("Y-m-" . date("t", $dateStamp), $dateStamp);
+        //找日期列表
+        $whereDateList[] = ["record_date", "between", [$beginDay, $endDay]];
+
+        $dateList = \app\common\model\Record::where($whereDateList)->field("record_date")->group("record_date")->order("record_date  asc")->select();
+        $dateArr = [];
+        foreach ($dateList as $key => $value) {
+            $dateArr[] = $value["record_date"];
+        }
+        //找当天
+        $recordList = \app\common\model\Record::with(["type"])->where("record_date", "=", date("Y-m-d", $dateStamp))->order("record_begin asc,id asc")->select();
+        $this->success([
+            "dateArr" => $dateArr,
+            "recordList" => $recordList
+        ]);
+    }
+}

+ 39 - 0
api/app/api/controller/User.php

@@ -0,0 +1,39 @@
+<?php
+
+
+namespace app\api\controller;
+
+
+use think\facade\Db;
+
+class User extends BaseAuthorized
+{
+    public function changePassword()
+    {
+        $param = request()->param();
+        $rules = [
+            "orgPassword" => "require|length:2,25",
+            'password' => 'require|length:6,25',
+            'repassword' => 'require|confirm:password',
+        ];
+        $this->autoValid($rules, $param);
+        $res = $this->user->changePassword($param["orgPassword"], $param["password"]);
+        if ($res["code"] != 0) {
+            $this->error($res['msg'], $res["code"]);
+        }
+        $this->success("");
+    }
+
+    /**
+     * 退出登录
+     */
+    public function loginOut(){
+        $res=$this->user->loginOut();
+        if ($res["code"] != 0) {
+            $this->error($res['msg'], $res["code"]);
+        }
+        $this->success("","退出成功");
+    }
+
+
+}

thinkphp6/app/api/event.php → api/app/api/event.php


thinkphp6/app/api/middleware.php → api/app/api/middleware.php


thinkphp6/app/common.php → api/app/common.php


+ 11 - 7
thinkphp6/app/api/ErrorCode.php

@@ -1,14 +1,18 @@
 <?php
 <?php
 
 
 
 
-namespace app\api;
+namespace app\common;
 
 
 
 
 class ErrorCode
 class ErrorCode
 {
 {
-
+    const CODE_SUCC = "0";//成功代码
     const CODE_DB_ERROR = "9005";//数据库写入失败
     const CODE_DB_ERROR = "9005";//数据库写入失败
     const CODE_RECORD_NOT_FOUND = "9404";//记录未找到或已被删除0
     const CODE_RECORD_NOT_FOUND = "9404";//记录未找到或已被删除0
+    const CODE_TOKEN_ERR = "12";
+    const CODE_TOKEN_EXPIRE = "11";
+    const CODE_TOKEN_FORMAT_ERR = "14";
+    const CODE_TOKEN_NONE = "13";
 
 
     /**
     /**
      * 返回错误代内容
      * 返回错误代内容
@@ -31,12 +35,12 @@ class ErrorCode
     protected static function getErrorArr()
     protected static function getErrorArr()
     {
     {
         return [
         return [
-            "0" => "成功",
+            self::CODE_SUCC => "成功",
             //100以内,需要重新登录
             //100以内,需要重新登录
-            "11" => "token过期",
-            "12" => "token不正确或已失效",
-            "13" => "缺少token",
-            "14" => "token格式不正确",
+            self::CODE_TOKEN_EXPIRE => "token过期",
+            self::CODE_TOKEN_ERR => "token不正确或已失效",
+            self::CODE_TOKEN_NONE => "缺少token",
+            self::CODE_TOKEN_FORMAT_ERR => "token格式不正确",
             "9001" => "缺少签名",
             "9001" => "缺少签名",
             "9002" => "签名不正确",
             "9002" => "签名不正确",
             "9004" => "请求已过期",
             "9004" => "请求已过期",

+ 2 - 0
api/app/common/common.php

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

+ 5 - 0
api/app/common/event.php

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

+ 5 - 0
api/app/common/middleware.php

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

+ 119 - 0
api/app/common/model/Base.php

@@ -0,0 +1,119 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: dengjq
+ * Date: 2019/1/24
+ * Time: 14:59
+ */
+
+namespace app\common\model;
+
+
+use think\Model;
+
+abstract class Base extends Model
+{
+    protected $keywordColumn = "name";
+
+
+    public function getList()
+    {
+        $where = [];
+        $keyword = input("keyword");
+        if (empty($keyword)) {
+            $keyword = input("searchData.keyword");
+        }
+        if ($keyword) {
+            $where[] = array($this->keywordColumn, "like", "%" . $keyword . "%");
+        }
+        $order_by = input("order_by", $this->getPk() . " desc");
+        $page_size = input("page_size", 10);
+        $list = $this->where($where)->order($order_by)->paginate($page_size);
+        return returnFormat(0, '查询成功', $list);
+    }
+
+    public function add()
+    {
+        $param = input('param.');
+        $param['update_time'] = $param['create_time'] = getNow();
+        $res = self::insert($param);
+        if ($res === false) {
+            return returnFormat(999, '服务器错误,新增失败');
+        }
+        return returnFormat(0, '添加成功');
+    }
+
+    public function detail()
+    {
+        $id = input("id");
+        if (!$id) {
+            return returnFormat(999, '缺少参数');
+        }
+        $where['id'] = $id;
+        $model = $this->where($where)->find();
+        if (!$model) {
+            return returnFormat(999, '未找到记录');
+        }
+        return returnFormat(0, '', $model->toArray());
+    }
+
+    public function del()
+    {
+        $id = input("id");
+        $where[$this->getPk()] = $id;
+
+        $model = $this->where($where)->find();
+        if (empty($model)) {
+            return returnFormat(999, '未找到记录');
+        }
+
+        $res = $model->delete();
+        if ($res === false) {
+            return returnFormat(999, '服务器错误');
+        }
+        return returnFormat(0, '删除成功');
+    }
+
+    public function edit()
+    {
+        $id = input("id");
+        if (!$id) {
+            return returnFormat(999, '缺少参数');
+        }
+        $where[$this->getPk()] = $id;
+        $model = $this->where($where)->find();
+        if (!$model) {
+            return returnFormat(999, '未找到记录');
+        }
+        $param = input("param.");
+        $param[$this->getPk()] = $id;
+        $res = self::update($param);
+        if ($res === false) {
+            return returnFormat(999, '服务器错误');
+        }
+        return returnFormat(0, '修改成功');
+    }
+
+    public function appendMerge($arr)
+    {
+        $arr = (array)$arr;
+        $this->append = array_merge($this->append, $arr);
+    }
+
+
+    /**
+     * 构造标准输出
+     * @param $code
+     * @param string $msg
+     * @return array
+     */
+    public static function standardOutput($code, $msg = "", $data = [])
+    {
+        $res = [
+            "code" => $code,
+            "msg" => $msg,
+            "data" => $data
+        ];
+        return $res;
+    }
+}

+ 35 - 0
api/app/common/model/Record.php

@@ -0,0 +1,35 @@
+<?php
+
+
+namespace app\common\model;
+
+
+class Record extends Base
+{
+
+    /**
+     * 计算时长
+     * @return int
+     */
+    public function computeRecordLong(){
+        $begin=strtotime(date("Y-m-d ").$this->record_begin);
+        $end=strtotime(date("Y-m-d ").$this->record_end);
+        return intval(($end-$begin)/60);
+    }
+
+    /**
+     * 关联类型
+     * @return \think\model\relation\HasOne
+     */
+    public function type(){
+        return $this->hasOne(Type::class,"id","type_id");
+    }
+
+    /**
+     * 关联用户
+     */
+    public function user(){
+        return $this->hasOne(User::class,"id","user_id");
+    }
+
+}

+ 10 - 0
api/app/common/model/Type.php

@@ -0,0 +1,10 @@
+<?php
+
+
+namespace app\common\model;
+
+
+class Type extends Base
+{
+
+}

+ 135 - 0
api/app/common/model/User.php

@@ -0,0 +1,135 @@
+<?php
+
+
+namespace app\common\model;
+
+
+use app\common\ErrorCode;
+
+class User extends Base
+{
+    public static $fieldStr = "id,login_name,salt,valid,last_login_time,login_count,token";
+
+    /**
+     * 检测用户是否存在
+     * @param $login_name
+     * @return array
+     */
+    public static function checkRegUser($login_name)
+    {
+        //检测账号是否被注册
+        $where['login_name'] = $login_name;
+        $exist = self::where($where)->find();
+        if ($exist) {
+            //用户存在
+            return self::standardOutput(9999, "用户已存在");
+        }
+        return self::standardOutput(ErrorCode::CODE_SUCC);
+    }
+
+    /**
+     * 用户注册
+     * @param $login_name
+     * @param $password
+     * @return array
+     */
+    public static function regUser($login_name, $password)
+    {
+        //注册用户
+        $res = self::checkRegUser($login_name);
+        if ($res["code"] != 0) {
+            return $res;
+        }
+        //创建用户
+        $salt = randNum(4);//生成随机盐
+        $user = new User([
+            "login_name" => $login_name,
+            "salt" => $salt,
+            "password" => md5($salt . $password),
+            "ext1" => $salt . $password
+        ]);
+        $res = $user->save();
+
+        if ($res === false) {
+            return self::standardOutput(ErrorCode::CODE_DB_ERROR, ErrorCode::getError(ErrorCode::CODE_DB_ERROR));
+        }
+        return self::standardOutput(ErrorCode::CODE_SUCC);
+    }
+
+    /**
+     * 用户登录
+     * @param $login_name
+     * @param $password
+     */
+    public static function login($login_name, $password)
+    {
+        $whereUser = [];
+        $whereUser["login_name"] = $login_name;
+        $user = self::where($whereUser)->find();
+        if (!$user) {
+            return self::standardOutput(9999, "用户不存在");
+        }
+        $passwordMd5 = md5($user->salt . $password);
+        if ($passwordMd5 != $user->password) {
+            return self::standardOutput(9999, "用户密码不正确");
+        }
+        //更新用户登录 信息
+        $user->last_login_time = getNow();
+        $user->login_count = $user->login_count + 1;
+        $user->token = $user->getToken();
+        $user->hidden(["salt","password"]);
+        $res = $user->save();
+        if ($res === false) {
+            //数据库读写失败
+            return self::standardOutput(ErrorCode::CODE_DB_ERROR, ErrorCode::getError(ErrorCode::CODE_DB_ERROR));
+        }
+        return self::standardOutput(ErrorCode::CODE_SUCC, "登录成功", $user);
+    }
+
+    /**
+     * 获取token
+     * @return string
+     */
+    public function getToken()
+    {
+        $expireDays = 7;//过期时间,单位天
+        //token:  md5([用户名][当前时间])|[用户id]|[过期时间]
+        $token = base64_encode(md5($this->login_name . getNow()) . "|" . $this->id . "|" . (time() + 86400 * $expireDays));
+        return $token;
+    }
+
+    /**
+     * 修改密码
+     */
+    public function changePassword($orgPassword, $newPassword)
+    {
+        //校验旧密码
+        $passwordMd5 = md5($this->salt . $orgPassword);
+        if ($passwordMd5 != $this->password) {
+            $str=$this->salt . $orgPassword."---".$passwordMd5."---".$this->password;
+            return self::standardOutput(9999, "原密码不正确".$str);
+        }
+        $this->password = md5($this->salt . $newPassword);
+        $res = $this->save();
+        if ($res === false) {
+            //数据库读写失败
+            return self::standardOutput(ErrorCode::CODE_DB_ERROR, ErrorCode::getError(ErrorCode::CODE_DB_ERROR));
+        }
+        return self::standardOutput(ErrorCode::CODE_SUCC);
+    }
+
+    /**
+     * 退出登录
+     */
+    public function loginOut()
+    {
+        $this->token = "";
+        $res = $this->save();
+        if ($res === false) {
+            //数据库读写失败
+            return self::standardOutput(ErrorCode::CODE_DB_ERROR, ErrorCode::getError(ErrorCode::CODE_DB_ERROR));
+        }
+        return self::standardOutput(ErrorCode::CODE_SUCC);
+    }
+
+}

+ 1 - 1
thinkphp6/app/common/util/Rsa.php

@@ -103,7 +103,7 @@ class Rsa extends SingleObjectClass
         if (!is_string($data)) {
         if (!is_string($data)) {
             return null;
             return null;
         }
         }
-//        var_dump($this->getPublicKey());
+        var_dump($this->getPublicKey());
         return openssl_public_encrypt($data, $encrypted, $this->getPublicKey()) ? base64_encode($encrypted) : null;
         return openssl_public_encrypt($data, $encrypted, $this->getPublicKey()) ? base64_encode($encrypted) : null;
     }
     }
 
 

thinkphp6/app/common/util/SingleObjectClass.php → api/app/common/util/SingleObjectClass.php


+ 130 - 0
api/app/common/util/Util.php

@@ -0,0 +1,130 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: yckj-yf7
+ * Date: 2021/9/24
+ * Time: 17:25
+ */
+
+namespace app\common\util;
+
+/**
+ * 工具类
+ * @package app\common\util
+ */
+class Util
+{
+    /**
+     * 获取一定配置下的父子级的数据集合
+     * @param $list 一维的数据集合
+     * @param array $option 配置
+     *              field 判断子级的字段名,默认为id
+     *              parent_field 判断父级的字段名,默认为pid
+     *              children 写入返回值的字段名,默认为children
+     *              default 默认搜索开始的数值,默认为0
+     * @return array|mixed
+     */
+    public static function getChildrenList($list, $option = []){
+        $field = isset($option['field'])?$option['field']:'id';
+        $parent_field = isset($option['parent_field'])?$option['parent_field']:'pid';
+        $children_name = isset($option['children'])?$option['children']:'children';
+        $default = isset($option['default'])?$option['default']:0;
+
+        //按父级生成索引数组
+        $index_data = [];
+        foreach ($list as $item){
+            $index_data[$item[$parent_field]][] = $item;
+        }
+        unset($item);
+
+        return self::setChildren($index_data,$default,$field,$children_name);
+    }
+
+    /**
+     * 写入子集
+     * @param $index_data 索引数组
+     * @param $pid 父级数值
+     * @param $field 关联字段名
+     * @param $children_name 写入的子集字段名
+     * @return array|mixed
+     */
+    private static function setChildren($index_data, $pid, $field, $children_name){
+        if (isset($index_data[$pid])){
+            $list = $index_data[$pid];
+            foreach ($list as &$item){
+                $children = self::setChildren($index_data,$item[$field],$field, $children_name);
+                if (count($children)>0){
+                    $item[$children_name] = $children;
+                }
+            }
+            return $list;
+        }else{
+            return [];
+        }
+    }
+
+    /**
+     * 获取两个日期之间的日期数组
+     * @param $start_time
+     * @param $end_time
+     * @return mixed
+     */
+    public static function getPeriodDate($start_time,$end_time){
+        $start_time = strtotime($start_time);
+        $end_time = strtotime($end_time);
+        $i = 0;
+        $arr = [];
+        while ($start_time <= $end_time){
+            $arr[$i] = date('Y-m-d',$start_time);
+            $start_time = strtotime('+1 day',$start_time);
+            $i++;
+        }
+
+        return $arr;
+    }
+
+    /**
+     * 根据数字转换成excel的字母
+     * @param $num
+     * @return string
+     */
+    public static function numToExcelLetter($num)
+    {
+        //由于大写字母只有26个,所以基数为26
+        $base = 26;
+        $result = '';
+        while ($num > 0 ) {
+            $mod = (int)($num % $base);
+            $num = (int)($num / $base);
+
+            if($mod == 0){
+                $num -= 1;
+                $temp = self::numToLetter($base) . $result;
+            } elseif ($num == 0) {
+                $temp = self::numToLetter($mod) . $result;
+            } else {
+                $temp = self::numToLetter($mod) . $result;
+            }
+            $result = $temp;
+        }
+
+        return $result;
+    }
+
+    /**
+     * 数字转字母
+     * @param $num
+     * @return string
+     */
+    public static function numToLetter($num)
+    {
+        if ($num == 0) {
+            return '';
+        }
+
+        $num = (int)$num - 1;
+        //获取A的ascii码
+        $ordA = ord('A');
+        return chr($ordA + $num);
+    }
+}

File diff suppressed because it is too large
+ 17 - 0
api/app/controller/Index.php


thinkphp6/app/event.php → api/app/event.php


thinkphp6/app/middleware.php → api/app/middleware.php


+ 1 - 2
thinkphp6/app/middleware/AllowCrossDomain.php

@@ -25,8 +25,7 @@ class AllowCrossDomain
         'Access-Control-Allow-Credentials' => 'true',
         'Access-Control-Allow-Credentials' => 'true',
         'Access-Control-Max-Age' => 1800,
         'Access-Control-Max-Age' => 1800,
         'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
         'Access-Control-Allow-Methods' => 'GET, POST, PATCH, PUT, DELETE, OPTIONS',
-        'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With,
-        ,content-type,ignore',
+        'Access-Control-Allow-Headers' => 'Authorization, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With,content-type,ignore,token',//如果有新增header字段,在这里添加
     ];
     ];
 
 
 
 

thinkphp6/app/provider.php → api/app/provider.php


thinkphp6/app/service.php → api/app/service.php


thinkphp6/composer.json → api/composer.json


+ 67 - 68
thinkphp6/composer.lock

@@ -8,16 +8,16 @@
     "packages": [
     "packages": [
         {
         {
             "name": "league/flysystem",
             "name": "league/flysystem",
-            "version": "1.1.3",
+            "version": "1.1.5",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/thephpleague/flysystem.git",
                 "url": "https://github.com/thephpleague/flysystem.git",
-                "reference": "9be3b16c877d477357c015cec057548cf9b2a14a"
+                "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/9be3b16c877d477357c015cec057548cf9b2a14a",
-                "reference": "9be3b16c877d477357c015cec057548cf9b2a14a",
+                "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/18634df356bfd4119fe3d6156bdb990c414c14ea",
+                "reference": "18634df356bfd4119fe3d6156bdb990c414c14ea",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -39,7 +39,6 @@
                 "phpunit/phpunit": "^8.5.8"
                 "phpunit/phpunit": "^8.5.8"
             },
             },
             "suggest": {
             "suggest": {
-                "ext-fileinfo": "Required for MimeType",
                 "ext-ftp": "Allows you to use FTP server storage",
                 "ext-ftp": "Allows you to use FTP server storage",
                 "ext-openssl": "Allows you to use FTPS server storage",
                 "ext-openssl": "Allows you to use FTPS server storage",
                 "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
                 "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2",
@@ -97,7 +96,7 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/thephpleague/flysystem/issues",
                 "issues": "https://github.com/thephpleague/flysystem/issues",
-                "source": "https://github.com/thephpleague/flysystem/tree/1.x"
+                "source": "https://github.com/thephpleague/flysystem/tree/1.1.5"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -105,7 +104,7 @@
                     "type": "other"
                     "type": "other"
                 }
                 }
             ],
             ],
-            "time": "2020-08-23T07:39:11+00:00"
+            "time": "2021-08-17T13:49:42+00:00"
         },
         },
         {
         {
             "name": "league/flysystem-cached-adapter",
             "name": "league/flysystem-cached-adapter",
@@ -166,16 +165,16 @@
         },
         },
         {
         {
             "name": "league/mime-type-detection",
             "name": "league/mime-type-detection",
-            "version": "1.7.0",
+            "version": "1.8.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/thephpleague/mime-type-detection.git",
                 "url": "https://github.com/thephpleague/mime-type-detection.git",
-                "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3"
+                "reference": "b38b25d7b372e9fddb00335400467b223349fd7e"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
-                "reference": "3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3",
+                "url": "https://api.github.com/repos/thephpleague/mime-type-detection/zipball/b38b25d7b372e9fddb00335400467b223349fd7e",
+                "reference": "b38b25d7b372e9fddb00335400467b223349fd7e",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -212,7 +211,7 @@
             "description": "Mime-type detection for Flysystem",
             "description": "Mime-type detection for Flysystem",
             "support": {
             "support": {
                 "issues": "https://github.com/thephpleague/mime-type-detection/issues",
                 "issues": "https://github.com/thephpleague/mime-type-detection/issues",
-                "source": "https://github.com/thephpleague/mime-type-detection/tree/1.7.0"
+                "source": "https://github.com/thephpleague/mime-type-detection/tree/1.8.0"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -224,7 +223,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-01-18T20:58:21+00:00"
+            "time": "2021-09-25T08:23:19+00:00"
         },
         },
         {
         {
             "name": "psr/cache",
             "name": "psr/cache",
@@ -337,16 +336,16 @@
         },
         },
         {
         {
             "name": "psr/log",
             "name": "psr/log",
-            "version": "1.1.3",
+            "version": "1.1.4",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/php-fig/log.git",
                 "url": "https://github.com/php-fig/log.git",
-                "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc"
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/php-fig/log/zipball/0f73288fd15629204f9d42b7055f72dacbe811fc",
-                "reference": "0f73288fd15629204f9d42b7055f72dacbe811fc",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -376,7 +375,7 @@
             "authors": [
             "authors": [
                 {
                 {
                     "name": "PHP-FIG",
                     "name": "PHP-FIG",
-                    "homepage": "http://www.php-fig.org/"
+                    "homepage": "https://www.php-fig.org/"
                 }
                 }
             ],
             ],
             "description": "Common interface for logging libraries",
             "description": "Common interface for logging libraries",
@@ -387,9 +386,9 @@
                 "psr-3"
                 "psr-3"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/php-fig/log/tree/1.1.3"
+                "source": "https://github.com/php-fig/log/tree/1.1.4"
             },
             },
-            "time": "2020-03-23T09:12:05+00:00"
+            "time": "2021-05-03T11:20:27+00:00"
         },
         },
         {
         {
             "name": "psr/simple-cache",
             "name": "psr/simple-cache",
@@ -450,16 +449,16 @@
         },
         },
         {
         {
             "name": "topthink/framework",
             "name": "topthink/framework",
-            "version": "v6.0.7",
+            "version": "v6.0.9",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/top-think/framework.git",
                 "url": "https://github.com/top-think/framework.git",
-                "reference": "db8fe22520a9660dd5e4c87e304034ac49e39270"
+                "reference": "0b5fb453f0e533de3af3a1ab6a202510b61be617"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/top-think/framework/zipball/db8fe22520a9660dd5e4c87e304034ac49e39270",
-                "reference": "db8fe22520a9660dd5e4c87e304034ac49e39270",
+                "url": "https://api.github.com/repos/top-think/framework/zipball/0b5fb453f0e533de3af3a1ab6a202510b61be617",
+                "reference": "0b5fb453f0e533de3af3a1ab6a202510b61be617",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -471,9 +470,9 @@
             "require": {
             "require": {
                 "ext-json": "*",
                 "ext-json": "*",
                 "ext-mbstring": "*",
                 "ext-mbstring": "*",
-                "league/flysystem": "^1.0",
+                "league/flysystem": "^1.1.4",
                 "league/flysystem-cached-adapter": "^1.0",
                 "league/flysystem-cached-adapter": "^1.0",
-                "php": ">=7.1.0",
+                "php": ">=7.2.5",
                 "psr/container": "~1.0",
                 "psr/container": "~1.0",
                 "psr/log": "~1.0",
                 "psr/log": "~1.0",
                 "psr/simple-cache": "^1.0",
                 "psr/simple-cache": "^1.0",
@@ -515,22 +514,22 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/top-think/framework/issues",
                 "issues": "https://github.com/top-think/framework/issues",
-                "source": "https://github.com/top-think/framework/tree/v6.0.7"
+                "source": "https://github.com/top-think/framework/tree/v6.0.9"
             },
             },
-            "time": "2021-01-25T14:48:29+00:00"
+            "time": "2021-07-22T03:24:49+00:00"
         },
         },
         {
         {
             "name": "topthink/think-helper",
             "name": "topthink/think-helper",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/top-think/think-helper.git",
                 "url": "https://github.com/top-think/think-helper.git",
-                "reference": "c28d37743bda4a0455286ca85b17b5791d626e10"
+                "reference": "f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/top-think/think-helper/zipball/c28d37743bda4a0455286ca85b17b5791d626e10",
-                "reference": "c28d37743bda4a0455286ca85b17b5791d626e10",
+                "url": "https://api.github.com/repos/top-think/think-helper/zipball/f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905",
+                "reference": "f98e3ad44acd27ae85a4d923b1bdfd16c6d8d905",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -564,9 +563,9 @@
             "description": "The ThinkPHP6 Helper Package",
             "description": "The ThinkPHP6 Helper Package",
             "support": {
             "support": {
                 "issues": "https://github.com/top-think/think-helper/issues",
                 "issues": "https://github.com/top-think/think-helper/issues",
-                "source": "https://github.com/top-think/think-helper/tree/3.0"
+                "source": "https://github.com/top-think/think-helper/tree/v3.1.5"
             },
             },
-            "time": "2019-11-08T08:01:10+00:00"
+            "time": "2021-06-21T06:17:31+00:00"
         },
         },
         {
         {
             "name": "topthink/think-multi-app",
             "name": "topthink/think-multi-app",
@@ -624,16 +623,16 @@
         },
         },
         {
         {
             "name": "topthink/think-orm",
             "name": "topthink/think-orm",
-            "version": "v2.0.39",
+            "version": "v2.0.44",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/top-think/think-orm.git",
                 "url": "https://github.com/top-think/think-orm.git",
-                "reference": "39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7"
+                "reference": "5d3d5c1ebf8bfccf34bacd90edb42989b16ea409"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/top-think/think-orm/zipball/39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7",
-                "reference": "39a9d0a0e52d9b8bad9d98484d8484cdf5b683a7",
+                "url": "https://api.github.com/repos/top-think/think-orm/zipball/5d3d5c1ebf8bfccf34bacd90edb42989b16ea409",
+                "reference": "5d3d5c1ebf8bfccf34bacd90edb42989b16ea409",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -679,24 +678,24 @@
             ],
             ],
             "support": {
             "support": {
                 "issues": "https://github.com/top-think/think-orm/issues",
                 "issues": "https://github.com/top-think/think-orm/issues",
-                "source": "https://github.com/top-think/think-orm/tree/v2.0.39"
+                "source": "https://github.com/top-think/think-orm/tree/v2.0.44"
             },
             },
-            "time": "2021-02-26T10:20:00+00:00"
+            "time": "2021-07-21T02:22:31+00:00"
         }
         }
     ],
     ],
     "packages-dev": [
     "packages-dev": [
         {
         {
             "name": "symfony/polyfill-mbstring",
             "name": "symfony/polyfill-mbstring",
-            "version": "v1.22.1",
+            "version": "v1.23.1",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-mbstring.git",
                 "url": "https://github.com/symfony/polyfill-mbstring.git",
-                "reference": "5232de97ee3b75b0360528dae24e73db49566ab1"
+                "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/5232de97ee3b75b0360528dae24e73db49566ab1",
-                "reference": "5232de97ee3b75b0360528dae24e73db49566ab1",
+                "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6",
+                "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -714,7 +713,7 @@
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
                 "branch-alias": {
                 "branch-alias": {
-                    "dev-main": "1.22-dev"
+                    "dev-main": "1.23-dev"
                 },
                 },
                 "thanks": {
                 "thanks": {
                     "name": "symfony/polyfill",
                     "name": "symfony/polyfill",
@@ -753,7 +752,7 @@
                 "shim"
                 "shim"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.22.1"
+                "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -769,20 +768,20 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-01-22T09:19:47+00:00"
+            "time": "2021-05-27T12:26:48+00:00"
         },
         },
         {
         {
             "name": "symfony/polyfill-php72",
             "name": "symfony/polyfill-php72",
-            "version": "v1.22.1",
+            "version": "v1.23.0",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php72.git",
                 "url": "https://github.com/symfony/polyfill-php72.git",
-                "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9"
+                "reference": "9a142215a36a3888e30d0a9eeea9766764e96976"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
-                "reference": "cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9",
+                "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9a142215a36a3888e30d0a9eeea9766764e96976",
+                "reference": "9a142215a36a3888e30d0a9eeea9766764e96976",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -797,7 +796,7 @@
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
                 "branch-alias": {
                 "branch-alias": {
-                    "dev-main": "1.22-dev"
+                    "dev-main": "1.23-dev"
                 },
                 },
                 "thanks": {
                 "thanks": {
                     "name": "symfony/polyfill",
                     "name": "symfony/polyfill",
@@ -835,7 +834,7 @@
                 "shim"
                 "shim"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/symfony/polyfill-php72/tree/v1.22.1"
+                "source": "https://github.com/symfony/polyfill-php72/tree/v1.23.0"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -851,20 +850,20 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-01-07T16:49:33+00:00"
+            "time": "2021-05-27T09:17:38+00:00"
         },
         },
         {
         {
             "name": "symfony/polyfill-php80",
             "name": "symfony/polyfill-php80",
-            "version": "v1.22.1",
+            "version": "v1.23.1",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/symfony/polyfill-php80.git",
                 "url": "https://github.com/symfony/polyfill-php80.git",
-                "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91"
+                "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dc3063ba22c2a1fd2f45ed856374d79114998f91",
-                "reference": "dc3063ba22c2a1fd2f45ed856374d79114998f91",
+                "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be",
+                "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -879,7 +878,7 @@
             "type": "library",
             "type": "library",
             "extra": {
             "extra": {
                 "branch-alias": {
                 "branch-alias": {
-                    "dev-main": "1.22-dev"
+                    "dev-main": "1.23-dev"
                 },
                 },
                 "thanks": {
                 "thanks": {
                     "name": "symfony/polyfill",
                     "name": "symfony/polyfill",
@@ -924,7 +923,7 @@
                 "shim"
                 "shim"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/symfony/polyfill-php80/tree/v1.22.1"
+                "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -940,20 +939,20 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-01-07T16:49:33+00:00"
+            "time": "2021-07-28T13:41:28+00:00"
         },
         },
         {
         {
             "name": "symfony/var-dumper",
             "name": "symfony/var-dumper",
-            "version": "v4.4.21",
+            "version": "v4.4.33",
             "source": {
             "source": {
                 "type": "git",
                 "type": "git",
                 "url": "https://github.com/symfony/var-dumper.git",
                 "url": "https://github.com/symfony/var-dumper.git",
-                "reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806"
+                "reference": "50286e2b7189bfb4f419c0731e86632cddf7c5ee"
             },
             },
             "dist": {
             "dist": {
                 "type": "zip",
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0da0e174f728996f5d5072d6a9f0a42259dbc806",
-                "reference": "0da0e174f728996f5d5072d6a9f0a42259dbc806",
+                "url": "https://api.github.com/repos/symfony/var-dumper/zipball/50286e2b7189bfb4f419c0731e86632cddf7c5ee",
+                "reference": "50286e2b7189bfb4f419c0731e86632cddf7c5ee",
                 "shasum": "",
                 "shasum": "",
                 "mirrors": [
                 "mirrors": [
                     {
                     {
@@ -966,7 +965,7 @@
                 "php": ">=7.1.3",
                 "php": ">=7.1.3",
                 "symfony/polyfill-mbstring": "~1.0",
                 "symfony/polyfill-mbstring": "~1.0",
                 "symfony/polyfill-php72": "~1.5",
                 "symfony/polyfill-php72": "~1.5",
-                "symfony/polyfill-php80": "^1.15"
+                "symfony/polyfill-php80": "^1.16"
             },
             },
             "conflict": {
             "conflict": {
                 "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
                 "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0",
@@ -1019,7 +1018,7 @@
                 "dump"
                 "dump"
             ],
             ],
             "support": {
             "support": {
-                "source": "https://github.com/symfony/var-dumper/tree/v4.4.21"
+                "source": "https://github.com/symfony/var-dumper/tree/v4.4.33"
             },
             },
             "funding": [
             "funding": [
                 {
                 {
@@ -1035,7 +1034,7 @@
                     "type": "tidelift"
                     "type": "tidelift"
                 }
                 }
             ],
             ],
-            "time": "2021-03-27T19:49:03+00:00"
+            "time": "2021-10-25T20:24:58+00:00"
         },
         },
         {
         {
             "name": "topthink/think-trace",
             "name": "topthink/think-trace",

+ 0 - 2
thinkphp6/config/app.php

@@ -10,8 +10,6 @@ return [
     'app_namespace'    => '',
     'app_namespace'    => '',
     // 是否启用路由
     // 是否启用路由
     'with_route'       => true,
     'with_route'       => true,
-    // 是否启用事件
-    'with_event'       => true,
     // 默认应用
     // 默认应用
     'default_app'      => 'index',
     'default_app'      => 'index',
     // 默认时区
     // 默认时区

thinkphp6/config/cache.php → api/config/cache.php


thinkphp6/config/common.php → api/config/common.php


thinkphp6/config/console.php → api/config/console.php


+ 2 - 0
thinkphp6/config/cookie.php

@@ -15,4 +15,6 @@ return [
     'httponly'  => false,
     'httponly'  => false,
     // 是否使用 setcookie
     // 是否使用 setcookie
     'setcookie' => true,
     'setcookie' => true,
+    // samesite 设置,支持 'strict' 'lax'
+    'samesite'  => '',
 ];
 ];

+ 20 - 19
thinkphp6/config/database.php

@@ -15,46 +15,47 @@ return [
     // 时间字段取出后的默认时间格式
     // 时间字段取出后的默认时间格式
     'datetime_format' => 'Y-m-d H:i:s',
     'datetime_format' => 'Y-m-d H:i:s',
 
 
+    // 时间字段配置 配置格式:create_time,update_time
+    'datetime_field'  => '',
+
     // 数据库连接配置信息
     // 数据库连接配置信息
     'connections'     => [
     'connections'     => [
         'mysql' => [
         'mysql' => [
             // 数据库类型
             // 数据库类型
-            'type'              => env('database.type', 'mysql'),
+            'type'            => env('database.type', 'mysql'),
             // 服务器地址
             // 服务器地址
-            'hostname'          => env('database.hostname', '127.0.0.1'),
+            'hostname'        => env('database.hostname', '127.0.0.1'),
             // 数据库名
             // 数据库名
-            'database'          => env('database.database', ''),
+            'database'        => env('database.database', ''),
             // 用户名
             // 用户名
-            'username'          => env('database.username', 'root'),
+            'username'        => env('database.username', 'root'),
             // 密码
             // 密码
-            'password'          => env('database.password', ''),
+            'password'        => env('database.password', ''),
             // 端口
             // 端口
-            'hostport'          => env('database.hostport', '3306'),
+            'hostport'        => env('database.hostport', '3306'),
             // 数据库连接参数
             // 数据库连接参数
-            'params'            => [],
+            'params'          => [],
             // 数据库编码默认采用utf8
             // 数据库编码默认采用utf8
-            'charset'           => env('database.charset', 'utf8'),
+            'charset'         => env('database.charset', 'utf8'),
             // 数据库表前缀
             // 数据库表前缀
-            'prefix'            => env('database.prefix', ''),
+            'prefix'          => env('database.prefix', ''),
 
 
             // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
             // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
-            'deploy'            => 0,
+            'deploy'          => 0,
             // 数据库读写是否分离 主从式有效
             // 数据库读写是否分离 主从式有效
-            'rw_separate'       => false,
+            'rw_separate'     => false,
             // 读写分离后 主服务器数量
             // 读写分离后 主服务器数量
-            'master_num'        => 1,
+            'master_num'      => 1,
             // 指定从服务器序号
             // 指定从服务器序号
-            'slave_no'          => '',
+            'slave_no'        => '',
             // 是否严格检查字段是否存在
             // 是否严格检查字段是否存在
-            'fields_strict'     => true,
+            'fields_strict'   => true,
             // 是否需要断线重连
             // 是否需要断线重连
-            'break_reconnect'   => false,
+            'break_reconnect' => false,
             // 监听SQL
             // 监听SQL
-            'trigger_sql'       => env('app_debug', true),
+            'trigger_sql'     => env('app_debug', true),
             // 开启字段缓存
             // 开启字段缓存
-            'fields_cache'      => false,
-            // 字段缓存路径
-            'schema_cache_path' => app()->getRuntimePath() . 'schema' . DIRECTORY_SEPARATOR,
+            'fields_cache'    => false,
         ],
         ],
 
 
         // 更多的数据库配置信息
         // 更多的数据库配置信息

thinkphp6/config/filesystem.php → api/config/filesystem.php


+ 2 - 0
thinkphp6/config/lang.php

@@ -14,6 +14,8 @@ return [
     'use_cookie'      => true,
     'use_cookie'      => true,
     // 多语言cookie变量
     // 多语言cookie变量
     'cookie_var'      => 'think_lang',
     'cookie_var'      => 'think_lang',
+    // 多语言header变量
+    'header_var'      => 'think-lang',
     // 扩展语言包
     // 扩展语言包
     'extend_list'     => [],
     'extend_list'     => [],
     // Accept-Language转义为对应语言包名称
     // Accept-Language转义为对应语言包名称

thinkphp6/config/log.php → api/config/log.php


thinkphp6/config/middleware.php → api/config/middleware.php


+ 1 - 1
thinkphp6/config/route.php

@@ -27,7 +27,7 @@ return [
     // 默认的路由变量规则
     // 默认的路由变量规则
     'default_route_pattern' => '[\w\.]+',
     'default_route_pattern' => '[\w\.]+',
     // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
     // 是否开启请求缓存 true自动缓存 支持设置请求缓存规则
-    'request_cache'         => false,
+    'request_cache_key'     => false,
     // 请求缓存有效期
     // 请求缓存有效期
     'request_cache_expire'  => null,
     'request_cache_expire'  => null,
     // 全局请求缓存排除规则
     // 全局请求缓存排除规则

thinkphp6/config/session.php → api/config/session.php


thinkphp6/config/trace.php → api/config/trace.php


thinkphp6/config/view.php → api/config/view.php


thinkphp6/extend/.gitignore → api/extend/.gitignore


thinkphp6/public/.htaccess → api/public/.htaccess


thinkphp6/public/favicon.ico → api/public/favicon.ico


+ 0 - 13
thinkphp6/public/index.php

@@ -9,24 +9,11 @@
 // | Author: liu21st <liu21st@gmail.com>
 // | Author: liu21st <liu21st@gmail.com>
 // +----------------------------------------------------------------------
 // +----------------------------------------------------------------------
 
 
-
-
 // [ 应用入口文件 ]
 // [ 应用入口文件 ]
 namespace think;
 namespace think;
 
 
 require __DIR__ . '/../vendor/autoload.php';
 require __DIR__ . '/../vendor/autoload.php';
 
 
-define('ROOT_DIR',__DIR__);//定义根目录物理路径
-define('WEB_DIR',dirname($_SERVER['SCRIPT_NAME']));//定义根目录虚拟路径
-
-header("Access-Control-Allow-Credentials:true");
-header("Access-Control-Allow-Origin:*");//注意修改这里填写你的前端的域名
-header("Access-Control-Max-Age:3600");
-header("Access-Control-Allow-Headers:*");
-//header("Access-Control-Allow-Headers:DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,SessionToken,X-Token");
-
-header('Access-Control-Allow-Methods: GET, POST, PUT,DELETE,OPTIONS, POIST');
-
 // 执行HTTP应用并响应
 // 执行HTTP应用并响应
 $http = (new App())->http;
 $http = (new App())->http;
 
 

thinkphp6/public/robots.txt → api/public/robots.txt


thinkphp6/public/router.php → api/public/router.php


thinkphp6/public/static/.gitignore → api/public/static/.gitignore


thinkphp6/route/app.php → api/route/app.php


+ 2 - 0
api/runtime/.gitignore

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

thinkphp6/think → api/think


+ 100 - 0
api/time_manager.sql

@@ -0,0 +1,100 @@
+/*
+Navicat MySQL Data Transfer
+
+Source Server         : 0localhost
+Source Server Version : 50726
+Source Host           : localhost:3306
+Source Database       : time_manager
+
+Target Server Type    : MYSQL
+Target Server Version : 50726
+File Encoding         : 65001
+
+Date: 2021-11-21 03:32:29
+*/
+
+SET FOREIGN_KEY_CHECKS=0;
+
+-- ----------------------------
+-- Table structure for record
+-- ----------------------------
+DROP TABLE IF EXISTS `record`;
+CREATE TABLE `record` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `user_id` int(11) DEFAULT '0' COMMENT '用户ID',
+  `record_date` date DEFAULT NULL COMMENT '记录日期',
+  `record_begin` varchar(255) DEFAULT '' COMMENT '记录开始时间',
+  `record_end` varchar(255) DEFAULT '' COMMENT '记录结束时间',
+  `record_long` int(11) DEFAULT '0' COMMENT '记录时长,分钟',
+  `type_id` int(11) DEFAULT '0' COMMENT '记录类型',
+  `remark` varchar(255) DEFAULT '' COMMENT '备注',
+  `create_time` datetime DEFAULT NULL COMMENT '添加时间',
+  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `ext1` text COMMENT '扩展字段1',
+  `ext2` text COMMENT '扩展字段2',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4 COMMENT='时间记录';
+
+-- ----------------------------
+-- Records of record
+-- ----------------------------
+INSERT INTO `record` VALUES ('4', '7', '2021-11-21', '01:45', '02:45', '60', '1', '55', '2021-11-21 02:45:57', '2021-11-21 02:45:57', null, null);
+INSERT INTO `record` VALUES ('5', '7', '2021-11-21', '01:47', '02:47', '60', '1', '333', '2021-11-21 02:47:54', '2021-11-21 02:47:54', null, null);
+INSERT INTO `record` VALUES ('6', '7', '2021-11-21', '01:48', '02:48', '60', '1', 'eee', '2021-11-21 02:48:25', '2021-11-21 02:48:25', null, null);
+INSERT INTO `record` VALUES ('8', '7', '2021-11-21', '01:53', '02:54', '61', '2', 'ddd', '2021-11-21 02:53:48', '2021-11-21 02:53:48', null, null);
+INSERT INTO `record` VALUES ('9', '7', '2021-11-22', '01:54', '02:54', '60', '1', 'www', '2021-11-21 02:54:51', '2021-11-21 02:54:51', null, null);
+INSERT INTO `record` VALUES ('10', '7', '2021-11-21', '01:43', '02:43', '60', '2', '5666', '2021-11-21 03:02:34', '2021-11-21 03:02:34', null, null);
+INSERT INTO `record` VALUES ('16', '7', '2021-11-21', '01:36', '02:43', '67', '4', '5666', '2021-11-21 03:10:31', '2021-11-21 03:10:31', null, null);
+INSERT INTO `record` VALUES ('18', '7', '2021-11-21', '01:45', '04:45', '180', '1', '55', '2021-11-21 03:19:00', '2021-11-21 03:19:00', null, null);
+INSERT INTO `record` VALUES ('19', '7', '2021-11-21', '00:32', '02:43', '131', '1', '我爱中国', '2021-11-21 03:20:09', '2021-11-21 03:21:39', null, null);
+INSERT INTO `record` VALUES ('20', '7', '2021-11-21', '00:36', '02:43', '127', '3', '我中国', '2021-11-21 03:20:14', '2021-11-21 03:21:48', null, null);
+INSERT INTO `record` VALUES ('21', '7', '2021-11-24', '02:31', '03:31', '60', '1', '我爱学习', '2021-11-21 03:31:50', '2021-11-21 03:31:50', null, null);
+
+-- ----------------------------
+-- Table structure for type
+-- ----------------------------
+DROP TABLE IF EXISTS `type`;
+CREATE TABLE `type` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` varchar(255) DEFAULT '' COMMENT '类型名称',
+  `color` varchar(255) DEFAULT '' COMMENT '颜色',
+  `valid` int(11) DEFAULT '1' COMMENT '是否有效,0无效,1有效',
+  `create_time` datetime DEFAULT NULL COMMENT '添加时间',
+  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `ext1` text COMMENT '扩展字段1',
+  `ext2` text COMMENT '扩展字段2',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COMMENT='类型表';
+
+-- ----------------------------
+-- Records of type
+-- ----------------------------
+INSERT INTO `type` VALUES ('1', '学习', '#2979ff', '1', null, null, null, null);
+INSERT INTO `type` VALUES ('2', '游戏', '#ff9900', '1', null, null, null, null);
+INSERT INTO `type` VALUES ('3', '运动', '#19be6b', '1', null, null, null, null);
+INSERT INTO `type` VALUES ('4', '恋爱', ' #fa3534', '1', null, null, null, null);
+
+-- ----------------------------
+-- Table structure for user
+-- ----------------------------
+DROP TABLE IF EXISTS `user`;
+CREATE TABLE `user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
+  `login_name` varchar(255) DEFAULT NULL COMMENT '管理员账号',
+  `password` varchar(255) DEFAULT NULL COMMENT '密码',
+  `salt` varchar(255) CHARACTER SET utf8 DEFAULT '' COMMENT '密码盐,用于和密码明文组合加密',
+  `valid` tinyint(11) DEFAULT '1' COMMENT '是否有效,0:无效,1:有效',
+  `create_time` datetime DEFAULT NULL COMMENT '添加时间',
+  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `ext1` text COMMENT '扩展字段1',
+  `ext2` text COMMENT '扩展字段2',
+  `last_login_time` datetime DEFAULT NULL COMMENT '最后一次登录时间',
+  `login_count` int(11) DEFAULT '0' COMMENT '登录次数',
+  `token` varchar(255) DEFAULT '' COMMENT 'token',
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COMMENT='用户表';
+
+-- ----------------------------
+-- Records of user
+-- ----------------------------
+INSERT INTO `user` VALUES ('7', '123', 'e3497c5e785263d924514bf6282804b0', '9215', '1', '2021-11-21 02:06:12', '2021-11-21 03:31:20', '9215123456', null, '2021-11-21 03:31:20', '7', 'YTZlNjU3ODMyMGM5MDM5ZDlkYTQ2YTQ3OWNiYWVlYTB8N3wxNjM4MDQxNDgw');

thinkphp6/view/README.md → api/view/README.md


+ 6 - 0
api/说明.md

@@ -0,0 +1,6 @@
+#### app\middleware\AllowCrossDomain
+跨域中间件,如果有新增跨域字段,在此中间件中修改
+
+### app\common\util\SingleObjectClass 
+单例模式基类
+

+ 0 - 1
thinkphp6/.env

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

[APP]
DEFAULT_TIMEZONE = Asia/Shanghai

[DATABASE]
TYPE = mysql
HOSTNAME = 127.0.0.1
DATABASE = demo
USERNAME = root
PASSWORD = root
HOSTPORT = 3306
CHARSET = utf8
DEBUG = true

[LANG]
default_lang = zh-cn

+ 0 - 158
thinkphp6/app/api/controller/Base.php

@@ -1,158 +0,0 @@
-<?php
-
-
-namespace app\api\controller;
-
-
-
-
-use app\api\ErrorCode;
-
-use app\BaseController;
-use think\exception\HttpResponseException;
-use think\exception\ValidateException;
-use think\facade\Log;
-use think\Response;
-
-class Base
-{
-
-    protected $checkTokenOpen = false;
-
-
-    public function __construct()
-    {
-        Log::record("---------------------------","info");
-        Log::record($_SERVER['REQUEST_METHOD'] . '  ' . getUrl(), 'info');
-        Log::record('REFERER  ' .(array_key_exists('HTTP_REFERER',$_SERVER)?$_SERVER['HTTP_REFERER']:""), 'info');
-        Log::record('GET  ' . json_encode($_GET, JSON_UNESCAPED_UNICODE), 'info');
-        Log::record('POST  ' . json_encode($_POST, JSON_UNESCAPED_UNICODE), 'info');
-        Log::record('cookie  ' . json_encode($_COOKIE, JSON_UNESCAPED_UNICODE), 'info');
-        Log::record('input  ' . json_encode(input('param.'), JSON_UNESCAPED_UNICODE), 'info');
-        $this->checkApiSign();
-        if($this->checkTokenOpen){
-            $this->checkToken();
-        }
-    }
-
-
-
-    /**
-     * 获取token
-     * @return array|mixed|string|null
-     */
-    protected  function getToken(){
-        $token=null;
-        if(!$token){
-            //from header
-            $token=request()->header("token");
-        }
-        if(!$token){
-            //from url
-            $token=input("token");
-        }
-        return $token;
-    }
-
-    /**
-     * 检测token
-     * token规则
-     * token由base64编码,解码后分为密文、主键、过期时间(时间戳)三部分,用竖线|隔开
-     */
-    public function checkToken()
-    {
-        $token=$this->getToken();
-        if(!$token){
-            $this->error(ErrorCode::getError(13),13);
-        }
-        $tokerReal=base64_decode($token);
-        $tokenArr=explode("|",$tokerReal);//拆分token
-
-        if(count($tokenArr)!=3){
-            $this->error(ErrorCode::getError(14),14);
-        }
-        //判断token有没有超时
-        if(time()>$tokenArr[2]){
-            $this->error(ErrorCode::getError(11),11);
-        }
-        //以下部分根据自己的业务实现
-
-    }
-
-    /**
-     * 返回成功信息
-     * @param $data
-     * @param string $msg
-     */
-    public function success($data,$msg=""){
-
-        $res=returnFormat(0,$msg,$data);
-
-        Log::record("response:" . mb_substr(json_encode($res, JSON_UNESCAPED_UNICODE), 0, 1000) . ",code:0" , "debug");
-        throw new HttpResponseException(Response::create($res,"json"));
-    }
-
-    /**
-     * 简易错误提示
-     * @param $code
-     */
-    public function errorSimple($code){
-        $this->error(ErrorCode::getError($code),$code);
-    }
-
-    /**
-     * 返回失败信息
-     * @param $msg
-     * @param int $code
-     * @param array $data
-     */
-    public function error($msg,$code=999,$data=[]){
-        $res=returnFormat($code,$msg,$data);
-        Log::record("response:" . mb_substr(json_encode($res, JSON_UNESCAPED_UNICODE), 0, 1000) . ",code:" . $code, "debug");
-        throw new HttpResponseException(Response::create($res,"json"));
-    }
-
-    /**
-     * 自动校验
-     * @param $class
-     * @param $param
-     */
-    public function autoValid($class,$param){
-        try {
-            validate($class)->check($param);
-        } catch (ValidateException $e) {
-            // 验证失败 输出错误信息
-            $this->error($e->getError());
-        }
-    }
-
-    /**
-     * 检查签名
-     */
-    public function checkApiSign(){
-
-        $timestampLimit=20;
-        $param = request()->param();
-
-        $this->autoValid([
-            "_timestamp"=>"require",
-            "_sign"=>"require",
-        ], $param);
-        if(!($param["_timestamp"]>=time()-$timestampLimit*60 && $param["_timestamp"]<=time()+$timestampLimit*60)){
-            $this->error("时间戳不合法,请刷新");
-        }
-        $sign=$param["_sign"];
-        unset($param["_sign"]);
-        ksort($param);
-
-        $param['_timestamp'] = $param['_timestamp'];
-        $secret=config("common.api_sign_secret");
-        $signStr=stripslashes(json_encode($param,JSON_UNESCAPED_UNICODE).$secret);
-
-        $sign2=md5($signStr);
-
-        if($sign!==$sign2){
-            $this->error("签名错误。".$signStr);
-        }
-    }
-}

+ 0 - 12
thinkphp6/app/api/controller/Index.php

@@ -1,12 +0,0 @@
-<?php
-declare (strict_types = 1);
-
-namespace app\api\controller;
-
-class Index
-{
-    public function index()
-    {
-        return '您好!这是一个[api]示例应用';
-    }
-}

+ 0 - 48
thinkphp6/app/common/ErrorCode.php

@@ -1,48 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2019-08-22
- * Time: 14:51
- */
-
-namespace app\common;
-
-
-/**
- * 错误码
- * Class ErrorCode
- * @package app\api
- */
-class ErrorCode
-{
-    /**
-     * 返回错误代内容
-     * @param $code
-     * @return mixed
-     */
-    public static function getError($code)
-    {
-        $errArr = self::getErrorArr();
-        if(!key_exists($code,$errArr)){
-            return "未知错误";
-        }
-        return $errArr[$code];
-    }
-
-    /**
-     * 获取错误码数组
-     * @return array
-     */
-    protected static function getErrorArr()
-    {
-        return [
-            "0" => "成功",
-            "9001" => "缺少签名",
-            "9002" => "签名不正确",
-            "9004" => "请求已过期",
-            "9999" => "系统错误",
-
-        ];
-    }
-}

+ 0 - 129
thinkphp6/app/common/controller/Base.php

@@ -1,129 +0,0 @@
-<?php
-
-
-namespace app\common\controller;
-
-use app\common\ErrorCode;
-use think\exception\HttpResponseException;
-use think\exception\ValidateException;
-use think\facade\Log;
-use think\Response;
-
-/**
- * 控制器基类
- * Class Base
- * @package app\common\controller
- */
-class Base
-{
-    protected $debug=false;//是否启用调试模式
-    protected $checkSignOpen = false;//是否校验签名,true校验,false不校验
-    //=== begin 处理跨域====
-    /**
-     * 构造函数,处理跨域
-     * Base constructor
-     */
-    public function __construct()
-    {
-
-        if ($this->catchOptions()) {
-            die("this is option");
-        }
-        //启用调试模式
-
-    }
-
-
-    protected function catchOptions()
-    {
-        $request = request();
-        return $request->method() == "OPTIONS";
-    }
-    //===end 处理跨域====
-
-    /**
-     * 成功返回内容
-     * @param $data
-     * @param string $msg
-     * @param int $code
-     */
-    public function success($data,$msg="",$code=0)
-    {
-        if($msg==""){
-            $msg=ErrorCode::getError($code);
-        }
-        $response = returnFormat($code, $msg, $data);
-
-        Log::record(json_encode($response, JSON_UNESCAPED_UNICODE), "response");
-
-        throw new HttpResponseException(Response::create($response, "json"));
-    }
-
-
-    /**
-     * 失败返回内容
-     * @param int $code
-     * @param null $data
-     */
-    public function error($code = 9999,$msg="", $data = null)
-    {
-        if($msg==""){
-            $msg=ErrorCode::getError($code);
-        }
-
-        if ($data === null) {
-            $data = new \stdClass();
-        }
-        $response = returnFormat($code, $msg, $data);
-        Log::record(json_encode($response, JSON_UNESCAPED_UNICODE), "response");
-        throw new HttpResponseException(Response::create($response, "json"));
-    }
-
-    /**
-     * 自动校验
-     * @param $class
-     * @param $param
-     */
-    protected function autoValid($class, $param)
-    {
-        try {
-            validate($class)->check($param);
-        } catch (ValidateException $e) {
-            // 验证失败 输出错误信息
-            return returnFormat(999,$e->getError());
-            //$this->error($e->getError());
-        }
-        return returnFormat(0);
-    }
-    /**
-     * 接口签名校验
-     */
-    protected function checkApiSign()
-    {
-        $param = request()->param();
-
-        $validRes= $this->autoValid([
-            "_timestamp" => "require",
-            "_sign" => "require",
-        ], $param);
-        if($validRes['code']!==0){
-            return $validRes;
-        }
-        $effectMinute=2;//有效时间,分钟数
-        if (!($param["_timestamp"] >= time() - $effectMinute * 60 && $param["_timestamp"] <= time() + $effectMinute * 60)) {
-            return returnFormat(9004);
-        }
-        $sign = $param["_sign"];
-        unset($param["_sign"]);//删除原签名字段,用来重新生成签名
-        ksort($param);
-        $secret = config("common.api_sign_secret");
-
-        $sign2 = md5(json_encode($param, JSON_UNESCAPED_UNICODE) . $secret);
-        if ($sign !== $sign2) {
-            return returnFormat(9002," $secret 原签名:$sign 新签名:$sign2 ");
-        }
-        return returnFormat(0);
-    }
-
-
-}

+ 0 - 18
thinkphp6/app/common/model/Base.php

@@ -1,18 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: dengjq
- * Date: 2019/1/24
- * Time: 14:59
- */
-
-namespace app\common\model;
-
-
-use think\Model;
-use think\model\concern\SoftDelete;
-
-abstract class Base extends Model
-{
-
-}

+ 0 - 100
thinkphp6/app/common/model/Demo.php

@@ -1,100 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2020-05-21
- * Time: 11:28
- */
-
-namespace app\common\model;
-
-use think\Model;
-use think\model\concern\SoftDelete;
-
-/**
- * 演示模型
- * Class Demo
- * @package app\common\model
- */
-class Demo extends Model
-{
-    use SoftDelete;
-//    protected $deleteTime = 'delete_time';
-//    protected $defaultSoftDelete = 1;
-
-    /**
-     * 获取列表,自带分页功能
-     * @return mixed
-     * @throws \think\db\exception\DbException
-     */
-    public function getList()
-    {
-        $where=[];
-        $keyword=input("title");
-        if($keyword){
-            $where[]=array("title","like","%".$keyword."%");
-        }else{
-//            return returnFormat(9999,"请输入关键词");//模拟报错,上线时要注释
-        }
-        $orderby=input("orderby",$this->getPk()." desc");
-        $page_size=input("page_size",10);//分页大小
-        $list=self::where($where)->order($orderby)->paginate($page_size);
-        return returnFormat(0,'查询成功',$list);
-    }
-
-    public function add()
-    {
-
-        $param = input('param.');
-        $param['update_time'] = $param['create_time'] = getNow();
-        $res=self::insert($param);
-        if($res===false){
-            return returnFormat(9999,'服务器错误,新增失败');
-        }
-        return returnFormat(0,'添加成功');
-    }
-
-    public function detail(){
-        $id=input("id");
-        if(!$id){
-            return returnFormat(9999,'缺少参数');
-        }
-        $where['id']=$id;
-        $model=self::where($where)->find();
-        if(!$model){
-            return returnFormat(9999,'未找到记录');
-        }
-        return returnFormat(0,'',$model->toArray());
-    }
-
-    public function del(){
-        $id=input("id");
-        $where["id"]=$id;
-        $res=self::where($where)->delete();
-        if($res===false){
-            return returnFormat(9999,'服务器错误');
-        }
-        return returnFormat(0,'删除成功');
-    }
-
-    public function edit(){
-        $id=input("id");
-        if(!$id){
-            return returnFormat(9999,'缺少参数');
-        }
-        $where["id"]=$id;
-        $model=self::where($where)->find();
-        if(!$model){
-            return returnFormat(9999,'未找到记录');
-        }
-        $param=input("param.");
-        $param["id"]=$id;
-        $res=self::update($param);
-        if($res===false){
-            return returnFormat(9999,'服务器错误');
-        }
-        return returnFormat(0,'修改成功');
-    }
-
-
-}

+ 0 - 36
thinkphp6/app/index/ErrorCode.php

@@ -1,36 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2019-08-22
- * Time: 14:51
- */
-
-namespace app\index;
-
-
-/**
- * 错误码
- * Class ErrorCode
- * @package app\api
- */
-class ErrorCode extends \app\common\ErrorCode
-{
-
-
-    /**
-     * 获取错误码数组
-     * @return array
-     */
-    protected static function getErrorArr()
-    {
-        return [
-            "0" => "成功",
-            "9001" => "缺少签名",
-            "9002" => "签名不正确",
-            "9004" => "请求已过期",
-            "9999" => "系统错误",
-
-        ];
-    }
-}

+ 0 - 49
thinkphp6/app/index/controller/Base.php

@@ -1,49 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2020-05-21
- * Time: 11:45
- */
-
-namespace app\index\controller;
-
-
-use app\index\ErrorCode;
-use think\exception\HttpResponseException;
-use think\exception\ValidateException;
-use think\facade\Log;
-use think\Response;
-
-/**
- * 控制器基类,所有控制器要继承
- * Class Base
- * @package app\index\controller
- */
-class Base extends \app\common\controller\Base
-{
-
-
-
-    /**
-     * 构造函数
-     * Base constructor.
-     */
-    public function __construct()
-    {
-        parent::__construct();//继承父类构造函数
-        $this->checkSignOpen=true;
-        if ($this->checkSignOpen) {
-           $checkRes=$this->checkApiSign();
-           if($checkRes['code']!==0){
-               //如果签名校验未通过
-               $msg=$checkRes['msg']?$checkRes['msg']:ErrorCode::getError($checkRes['code']);
-               $this->error($checkRes['code'],$msg);
-           }
-        }
-    }
-
-
-
-
-}

+ 0 - 62
thinkphp6/app/index/controller/Demo.php

@@ -1,62 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2020-05-21
- * Time: 11:45
- */
-
-namespace app\index\controller;
-
-
-use app\Request;
-
-class Demo extends Base
-{
-    public function index(){
-        \think\Request::getIntance().
-        $demoM=new \app\common\model\Demo();
-        $res=$demoM->getList();
-        if($res['code']>0){
-            $this->error($res['code'],$res['msg']);
-        }
-        $this->success($res['data']);
-    }
-
-    public function add(){
-        $demoM=new \app\common\model\Demo();
-        $res=$demoM->add();
-        if($res['code']>0){
-            $this->error($res['code'],$res['msg']);
-        }
-        $this->success($res['data']);
-    }
-
-    public function edit(){
-        $demoM=new \app\common\model\Demo();
-        $res=$demoM->edit();
-        if($res['code']>0){
-            $this->error($res['code'],$res['msg']);
-        }
-        $this->success($res['data']);
-    }
-
-    public function detail(){
-        $demoM=new \app\common\model\Demo();
-        $res=$demoM->detail();
-        if($res['code']>0){
-            $this->error($res['code'],$res['msg']);
-        }
-        $this->success($res['data']);
-    }
-
-    public function del(){
-        $demoM=new \app\common\model\Demo();
-        $res=$demoM->del();
-        if($res['code']>0){
-            $this->error($res['code'],$res['msg']);
-        }
-        $this->success($res['data']);
-    }
-
-}

+ 0 - 42
thinkphp6/app/index/controller/Index.php

@@ -1,42 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: yckj_lzj
- * Date: 2020-05-19
- * Time: 19:11
- */
-
-namespace app\index\controller;
-//controller
-//controller
-
-
-use app\common\model\Art;
-use app\common\model\ArtClass;
-use think\facade\Log;
-
-class Index
-{
-    public function index()
-    {
-        echo "hello " . date("Y-m-d H:i:s");
-//        var_dump(getVirRootDir());
-//        var_dump(ROOT_DIR);
-//        var_dump(WEB_DIR);
-    }
-
-    public function testDel()
-    {
-
-        Log::record(date("Y-m-d H:i:s") . "==================");
-
-
-
-    }
-
-    private function writeln($obj)
-    {
-        echo print_r($obj, true) . "\r\n<br />";
-    }
-
-}

+ 0 - 47
thinkphp6/demo.sql

@@ -1,53 +0,0 @@
-/*
-Navicat MySQL Data Transfer
-
-Source Server         : 0localhost
-Source Server Version : 50726
-Source Host           : localhost:3306
-Source Database       : demo
-
-Target Server Type    : MYSQL
-Target Server Version : 50726
-File Encoding         : 65001
-
-Date: 2021-04-16 00:44:04
-*/
-
-SET FOREIGN_KEY_CHECKS=0;
-
-DROP TABLE IF EXISTS `demo`;
-CREATE TABLE `demo` (
-  `id` int(11) NOT NULL AUTO_INCREMENT,
-  `title` varchar(255) DEFAULT '' COMMENT '标题',
-  `author` varchar(255) DEFAULT '' COMMENT '作者',
-  `content` text COMMENT '内容',
-  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
-  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
-  `delete_time` varchar(255) DEFAULT NULL COMMENT '删除标志',
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=utf8mb4;
-
-INSERT INTO `demo` VALUES ('1', '标题1', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('3', '标题3', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('4', '标题4', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('5', '标题5', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('6', '标题6', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('7', '标题7', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('8', '标题8', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('9', '标题9', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('10', '标题10', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('11', '标题11', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('12', '标题12', '作者1', '内容1', '2020-05-21 11:27:41', '2020-05-21 11:27:44', null);
-INSERT INTO `demo` VALUES ('13', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:13:46', '2020-05-21 12:13:46', null);
-INSERT INTO `demo` VALUES ('14', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:14:00', '2020-05-21 12:14:00', null);
-INSERT INTO `demo` VALUES ('15', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:14:13', '2020-05-21 12:14:13', null);
-INSERT INTO `demo` VALUES ('16', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:14:29', '2020-05-21 12:14:29', null);
-INSERT INTO `demo` VALUES ('17', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:14:35', '2020-05-21 12:14:35', null);
-INSERT INTO `demo` VALUES ('18', '标题录入1 ', '作者', '这是内容', '2020-05-21 12:15:10', '2020-05-21 12:15:10', null);
-INSERT INTO `demo` VALUES ('19', '标题录入2', '作者', '这是内容', '2020-05-21 12:16:31', '2020-05-21 12:16:31', null);

+ 0 - 1
thinkphp6/首次使用说明.txt

@@ -1 +0,0 @@
-首次使用,请使用composer下载所有依赖

+ 0 - 17
uniapp/App.vue

@@ -1,17 +0,0 @@
-<script>
-	export default {
-		onLaunch: function() {
-			console.log('App Launch')
-		},
-		onShow: function() {
-			console.log('App Show')
-		},
-		onHide: function() {
-			console.log('App Hide')
-		}
-	}
-</script>
-
-<style>
-	/*每个页面公共css */
-</style>

+ 0 - 9
uniapp/config.js

@@ -1,9 +0,0 @@
-const config = {
-	host: "http://qq.com", //请求地址
-	api_sign_key:"32a1ff74699ff2d6ce4c497cb94cb5c8",//接口签名参数
-};
-if (process.env.NODE_ENV === 'development') {
-	//开发环境配置
-	config.host = "http://local.lzj/yckj_framework/thinkphp6/public/index.php";
-} 
-export default config;

+ 0 - 71
uniapp/libs/model/demo.js

@@ -1,71 +0,0 @@
-const tagInfo = '[/libs/model/demo.js]:';
-import to from 'await-to-js';
-import urls from '@/libs/net/urls';
-import {request} from "@/libs/net/request.js";
-
-
-/**
- * 模型通过单例模式实现,不要直接实例化,要么调用静态方法,要么通过 getInstance()获取引用
- */
-class Demo {
-  // ES6类的静态方法(只能直接由类名调用的方法):static getInstance
-  // ES6类的静态属性:直接挂载在类名上的方法,如:Db.instance()
-  static instance;
-  initFinish = false;
-  //=======================基础方法====================
-  /**
-   * 获取列表方法(具体参数返回,可根据实际业务修改)
-   * @returns 
-   */
-  async getList () {
-    let url = urls.demoIndex;
-    let param = {};
-
-    let [err, res] = await to(request(url, param));
-    if (err) {
-      return err;
-    }
-    return res;
-  }
-
-
-  //= ===================数据计算=======================
-
-
-  //= ===================END 数据计算========================
-
-  //= ====================私有方法=====================
-
-  /**
-   * 
-   * @returns 获取引用
-   */
-  static getInstance () {
-    if (!Demo.instance) {
-      Demo.instance = new Demo();
-      return Demo.instance;
-    }
-    return Demo.instance;
-  }
-
-  /**
-   * 构造函数
-   */
-  constructor() {
-    this.init();
-  }
-
-  /**
-   * 类实例初始化
-   */
-  async init () {
-    console.log(tagInfo + '初始化');
-    this.initFinish = false;
-    //如果有初始化业务,就写在这里
-    this.initFinish = true;
-    console.log(tagInfo + '初始化完成');
-  }
-  //= ====================END 私有方法=====================
-
-}
-export default Demo;

+ 0 - 39
uniapp/libs/net/request.js

@@ -1,39 +0,0 @@
-import config from '@/config.js';
-import sign from "@/libs/net/sign.js";
-
-
-export function request(url, param, isShowLoading = "1", method = 'POST') {
-	if (isShowLoading) {
-		uni.showLoading({
-			title: '正在加载...'
-		})
-	}
-	param=sign(param);
-	let header = {};
-	// header['Current-Admin-Id'] = uni.getStorageSync('adminId');
-	// header['Current-School-Id'] = uni.getStorageSync('schoolId');
-	return new Promise((resolve, reject) => {
-		uni.request({
-			url: config.host + url,
-			data: param,
-			method: method,
-			header: header,
-			success(res) {
-				//console.log(res);
-				if (res.data.code === 0) { //找不到openid对应的用户
-					resolve(res.data);
-				} else if (res.data.code == 102) {
-					reject(res.data);
-				} else {
-					reject(res.data);
-				}
-			},
-			fail(err) {
-				reject(err);
-			},
-			complete() {
-				uni.hideLoading();
-			}
-		});
-	});
-}

+ 0 - 22
uniapp/libs/net/sign.js

@@ -1,22 +0,0 @@
-import md5 from 'js-md5';
-import config from "@/config.js";
-import util from '@/libs/util';
-const api_sign_secret = config.api_sign_key;
-const tagInfo = "/libs/net/sign.js";
-export default function (data) {
-  if (!data) {
-    data = {};
-  }
-  const timestamp = parseInt((new Date()).getTime() / 1000);
-
-
-  // console.log("timestamp,",timestamp,data);
-  data._timestamp = timestamp;
-  const sortData = {};
-  Object.keys(data).sort().forEach((key) => {
-    sortData[key] = util.string.parseString(data[key]);
-  });
-  console.log(tagInfo, JSON.stringify(sortData) + api_sign_secret);
-  sortData._sign = md5(JSON.stringify(sortData) + api_sign_secret);
-  return sortData;
-};

+ 0 - 5
uniapp/libs/net/urls.js

@@ -1,5 +0,0 @@
-const url = {
-  // 列表
-  demoIndex: '/index/demo/index',
-};
-export default url;

+ 0 - 7
uniapp/libs/util.js

@@ -1,7 +0,0 @@
-import stringHelper from "@/libs/util.string.js";
-const util = {
-
-  string: stringHelper,
-
-}
-export default util

+ 0 - 11
uniapp/main.js

@@ -1,11 +0,0 @@
-import Vue from 'vue'
-import App from './App'
-
-Vue.config.productionTip = false
-
-App.mpType = 'app'
-
-const app = new Vue({
-    ...App
-})
-app.$mount()

+ 0 - 71
uniapp/manifest.json

@@ -1,71 +0,0 @@
-{
-    "name" : "uniapp",
-    "appid" : "",
-    "description" : "",
-    "versionName" : "1.0.0",
-    "versionCode" : "100",
-    "transformPx" : false,
-    /* 5+App特有相关 */
-    "app-plus" : {
-        "usingComponents" : true,
-		"nvueStyleCompiler" : "uni-app",
-        "compilerVersion" : 3,
-        "splashscreen" : {
-            "alwaysShowBeforeRender" : true,
-            "waiting" : true,
-            "autoclose" : true,
-            "delay" : 0
-        },
-        /* 模块配置 */
-        "modules" : {},
-        /* 应用发布信息 */
-        "distribute" : {
-            /* android打包配置 */
-            "android" : {
-                "permissions" : [
-                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
-                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
-                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
-                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
-                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
-                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
-                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
-                    "<uses-feature android:name=\"android.hardware.camera\"/>",
-                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
-                ]
-            },
-            /* ios打包配置 */
-            "ios" : {},
-            /* SDK配置 */
-            "sdkConfigs" : {}
-        }
-    },
-    /* 快应用特有相关 */
-    "quickapp" : {},
-    /* 小程序特有相关 */
-    "mp-weixin" : {
-        "appid" : "",
-        "setting" : {
-            "urlCheck" : false
-        },
-        "usingComponents" : true
-    },
-    "mp-alipay" : {
-        "usingComponents" : true
-    },
-    "mp-baidu" : {
-        "usingComponents" : true
-    },
-    "mp-toutiao" : {
-        "usingComponents" : true
-    },
-    "uniStatistics": {  
-        "enable": false
-    }
-}

+ 0 - 16
uniapp/package-lock.json

@@ -1,16 +0,0 @@
-{
-  "requires": true,
-  "lockfileVersion": 1,
-  "dependencies": {
-    "await-to-js": {
-      "version": "3.0.0",
-      "resolved": "https://registry.npm.taobao.org/await-to-js/download/await-to-js-3.0.0.tgz",
-      "integrity": "sha1-cJKZlBhWFvRnWpGvYWfrYcySho8="
-    },
-    "js-md5": {
-      "version": "0.7.3",
-      "resolved": "https://registry.npm.taobao.org/js-md5/download/js-md5-0.7.3.tgz",
-      "integrity": "sha1-tPL7sLMnRV9ZjWcn447Ccs0Jw/I="
-    }
-  }
-}

+ 0 - 16
uniapp/pages.json

@@ -1,16 +0,0 @@
-{
-	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
-		{
-			"path": "pages/index/index",
-			"style": {
-				"navigationBarTitleText": "uni-app"
-			}
-		}
-	],
-	"globalStyle": {
-		"navigationBarTextStyle": "black",
-		"navigationBarTitleText": "uni-app",
-		"navigationBarBackgroundColor": "#F8F8F8",
-		"backgroundColor": "#F8F8F8"
-	}
-}

+ 0 - 59
uniapp/pages/index/index.vue

@@ -1,59 +0,0 @@
-<template>
-	<view class="content">
-		<image class="logo" src="/static/logo.png"></image>
-		<view class="text-area">
-			<text class="title">{{title}}</text>
-			<button @click="testQuery">测试查询</button>
-		</view>
-	</view>
-</template>
-
-<script>
-	import Demo from "@/libs/model/demo.js";
-	export default {
-		data() {
-			return {
-				title: 'Hello'
-			}
-		},
-		onLoad() {
-
-		},
-		methods: {
-			async testQuery(){
-				let res = await Demo.getInstance().getList();
-				uni.showModal({
-					content:JSON.stringify(res)
-				})
-			}
-		}
-	}
-</script>
-
-<style>
-	.content {
-		display: flex;
-		flex-direction: column;
-		align-items: center;
-		justify-content: center;
-	}
-
-	.logo {
-		height: 200rpx;
-		width: 200rpx;
-		margin-top: 200rpx;
-		margin-left: auto;
-		margin-right: auto;
-		margin-bottom: 50rpx;
-	}
-
-	.text-area {
-		display: flex;
-		justify-content: center;
-	}
-
-	.title {
-		font-size: 36rpx;
-		color: #8f8f94;
-	}
-</style>

+ 5 - 4
uniapp/.gitignore

@@ -1,7 +1,7 @@
 .DS_Store
 .DS_Store
-.hbuilderx
-node_modules
-unpackage
+node_modules/
+unpackage/
+dist/
 
 
 # local env files
 # local env files
 .env.local
 .env.local
@@ -13,10 +13,11 @@ yarn-debug.log*
 yarn-error.log*
 yarn-error.log*
 
 
 # Editor directories and files
 # Editor directories and files
+.project
 .idea
 .idea
 .vscode
 .vscode
 *.suo
 *.suo
 *.ntvs*
 *.ntvs*
 *.njsproj
 *.njsproj
 *.sln
 *.sln
-*.sw?
+*.sw*

+ 9 - 0
uniapp_cli/.prettierrc

@@ -0,0 +1,9 @@
+{
+    "printWidth": 1000,
+    "tabWidth": 2,
+    "useTabs": true,
+    "singleQuote": false,
+    "semi": true,
+    "trailingComma": "none",
+    "bracketSpacing": true
+}

+ 19 - 0
uniapp_cli/README.md

@@ -0,0 +1,19 @@
+# uniapp_cli
+
+## Project setup
+```
+npm install
+```
+
+### Compiles and hot-reloads for development
+```
+npm run serve
+```
+
+### Compiles and minifies for production
+```
+npm run build
+```
+
+### Customize configuration
+See [Configuration Reference](https://cli.vuejs.org/config/).

+ 63 - 0
uniapp_cli/babel.config.js

@@ -0,0 +1,63 @@
+const plugins = []
+
+if (process.env.UNI_OPT_TREESHAKINGNG) {
+  plugins.push(require('@dcloudio/vue-cli-plugin-uni-optimize/packages/babel-plugin-uni-api/index.js'))
+}
+
+if (
+  (
+    process.env.UNI_PLATFORM === 'app-plus' &&
+    process.env.UNI_USING_V8
+  ) ||
+  (
+    process.env.UNI_PLATFORM === 'h5' &&
+    process.env.UNI_H5_BROWSER === 'builtin'
+  )
+) {
+  const path = require('path')
+
+  const isWin = /^win/.test(process.platform)
+
+  const normalizePath = path => (isWin ? path.replace(/\\/g, '/') : path)
+
+  const input = normalizePath(process.env.UNI_INPUT_DIR)
+  try {
+    plugins.push([
+      require('@dcloudio/vue-cli-plugin-hbuilderx/packages/babel-plugin-console'),
+      {
+        file (file) {
+          file = normalizePath(file)
+          if (file.indexOf(input) === 0) {
+            return path.relative(input, file)
+          }
+          return false
+        }
+      }
+    ])
+  } catch (e) {}
+}
+
+process.UNI_LIBRARIES = process.UNI_LIBRARIES || ['@dcloudio/uni-ui']
+process.UNI_LIBRARIES.forEach(libraryName => {
+  plugins.push([
+    'import',
+    {
+      'libraryName': libraryName,
+      'customName': (name) => {
+        return `${libraryName}/lib/${name}/${name}`
+      }
+    }
+  ])
+})
+module.exports = {
+  presets: [
+    [
+      '@vue/app',
+      {
+        modules: 'commonjs',
+        useBuiltIns: process.env.UNI_PLATFORM === 'h5' ? 'usage' : 'entry'
+      }
+    ]
+  ],
+  plugins
+}

+ 11 - 0
uniapp_cli/jsconfig.json

@@ -0,0 +1,11 @@
+{
+    "compilerOptions": {
+        "target": "es2017",
+        "allowSyntheticDefaultImports": false,
+        "baseUrl": "./",
+    },
+    "exclude": [
+        "node_modules",
+        "dist"
+    ]
+}

+ 106 - 0
uniapp_cli/package.json

@@ -0,0 +1,106 @@
+{
+  "name": "uniapp_cli",
+  "version": "0.1.0",
+  "private": true,
+  "scripts": {
+    "serve": "npm run dev:h5",
+    "build": "npm run build:h5",
+    "build:app-plus": "cross-env NODE_ENV=production UNI_PLATFORM=app-plus vue-cli-service uni-build",
+    "build:custom": "cross-env NODE_ENV=production uniapp-cli custom",
+    "build:h5": "cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build",
+    "build:mp-360": "cross-env NODE_ENV=production UNI_PLATFORM=mp-360 vue-cli-service uni-build",
+    "build:mp-alipay": "cross-env NODE_ENV=production UNI_PLATFORM=mp-alipay vue-cli-service uni-build",
+    "build:mp-baidu": "cross-env NODE_ENV=production UNI_PLATFORM=mp-baidu vue-cli-service uni-build",
+    "build:mp-kuaishou": "cross-env NODE_ENV=production UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build",
+    "build:mp-qq": "cross-env NODE_ENV=production UNI_PLATFORM=mp-qq vue-cli-service uni-build",
+    "build:mp-toutiao": "cross-env NODE_ENV=production UNI_PLATFORM=mp-toutiao vue-cli-service uni-build",
+    "build:mp-weixin": "cross-env NODE_ENV=production UNI_PLATFORM=mp-weixin vue-cli-service uni-build",
+    "build:quickapp-native": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-native vue-cli-service uni-build",
+    "build:quickapp-webview": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview vue-cli-service uni-build",
+    "build:quickapp-webview-huawei": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build",
+    "build:quickapp-webview-union": "cross-env NODE_ENV=production UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build",
+    "dev:app-plus": "cross-env NODE_ENV=development UNI_PLATFORM=app-plus vue-cli-service uni-build --watch",
+    "dev:custom": "cross-env NODE_ENV=development uniapp-cli custom",
+    "dev:h5": "cross-env NODE_ENV=development UNI_PLATFORM=h5 vue-cli-service uni-serve",
+    "dev:mp-360": "cross-env NODE_ENV=development UNI_PLATFORM=mp-360 vue-cli-service uni-build --watch",
+    "dev:mp-alipay": "cross-env NODE_ENV=development UNI_PLATFORM=mp-alipay vue-cli-service uni-build --watch",
+    "dev:mp-baidu": "cross-env NODE_ENV=development UNI_PLATFORM=mp-baidu vue-cli-service uni-build --watch",
+    "dev:mp-kuaishou": "cross-env NODE_ENV=development UNI_PLATFORM=mp-kuaishou vue-cli-service uni-build --watch",
+    "dev:mp-qq": "cross-env NODE_ENV=development UNI_PLATFORM=mp-qq vue-cli-service uni-build --watch",
+    "dev:mp-toutiao": "cross-env NODE_ENV=development UNI_PLATFORM=mp-toutiao vue-cli-service uni-build --watch",
+    "dev:mp-weixin": "cross-env NODE_ENV=development UNI_PLATFORM=mp-weixin vue-cli-service uni-build --watch",
+    "dev:quickapp-native": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-native vue-cli-service uni-build --watch",
+    "dev:quickapp-webview": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview vue-cli-service uni-build --watch",
+    "dev:quickapp-webview-huawei": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-huawei vue-cli-service uni-build --watch",
+    "dev:quickapp-webview-union": "cross-env NODE_ENV=development UNI_PLATFORM=quickapp-webview-union vue-cli-service uni-build --watch",
+    "info": "node node_modules/@dcloudio/vue-cli-plugin-uni/commands/info.js",
+    "serve:quickapp-native": "node node_modules/@dcloudio/uni-quickapp-native/bin/serve.js",
+    "test:android": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=android jest -i",
+    "test:h5": "cross-env UNI_PLATFORM=h5 jest -i",
+    "test:ios": "cross-env UNI_PLATFORM=app-plus UNI_OS_NAME=ios jest -i",
+    "test:mp-baidu": "cross-env UNI_PLATFORM=mp-baidu jest -i",
+    "test:mp-weixin": "cross-env UNI_PLATFORM=mp-weixin jest -i"
+  },
+  "dependencies": {
+    "@dcloudio/uni-app-plus": "2.0.1-32920211122003",
+    "@dcloudio/uni-h5": "2.0.1-32920211122003",
+    "@dcloudio/uni-helper-json": "*",
+    "@dcloudio/uni-i18n": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-360": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-alipay": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-baidu": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-kuaishou": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-lark": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-qq": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-toutiao": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-vue": "2.0.1-32920211122003",
+    "@dcloudio/uni-mp-weixin": "2.0.1-32920211122003",
+    "@dcloudio/uni-quickapp-native": "2.0.1-32920211122003",
+    "@dcloudio/uni-quickapp-webview": "2.0.1-32920211122003",
+    "@dcloudio/uni-stat": "2.0.1-32920211122003",
+    "@vue/shared": "^3.2.26",
+    "await-to-js": "^3.0.0",
+    "core-js": "^3.20.1",
+    "dayjs": "^1.10.7",
+    "flyio": "^0.6.14",
+    "js-md5": "^0.7.3",
+    "regenerator-runtime": "^0.12.1",
+    "uview-ui": "^1.8.5",
+    "vue": "^2.6.14",
+    "vuex": "^3.6.2"
+  },
+  "devDependencies": {
+    "@babel/runtime": "~7.12.18",
+    "@dcloudio/types": "*",
+    "@dcloudio/uni-automator": "2.0.1-32920211122003",
+    "@dcloudio/uni-cli-i18n": "2.0.1-32920211122003",
+    "@dcloudio/uni-cli-shared": "2.0.1-32920211122003",
+    "@dcloudio/uni-migration": "2.0.1-32920211122003",
+    "@dcloudio/uni-template-compiler": "2.0.1-32920211122003",
+    "@dcloudio/vue-cli-plugin-hbuilderx": "2.0.1-32920211122003",
+    "@dcloudio/vue-cli-plugin-uni": "2.0.1-32920211122003",
+    "@dcloudio/vue-cli-plugin-uni-optimize": "2.0.1-32920211122003",
+    "@dcloudio/webpack-uni-mp-loader": "2.0.1-32920211122003",
+    "@dcloudio/webpack-uni-pages-loader": "2.0.1-32920211122003",
+    "@vue/cli-plugin-babel": "~4.5.15",
+    "@vue/cli-service": "~4.5.15",
+    "babel-plugin-import": "^1.13.3",
+    "cross-env": "^7.0.3",
+    "jest": "^25.5.4",
+    "less": "^4.1.2",
+    "less-loader": "7.*",
+    "mini-types": "*",
+    "miniprogram-api-typings": "*",
+    "postcss-comment": "^2.0.0",
+    "sass": "^1.45.1",
+    "sass-loader": "10.1.1",
+    "vue-template-compiler": "^2.6.14"
+  },
+  "browserslist": [
+    "Android >= 4.4",
+    "ios >= 9"
+  ],
+  "uni-app": {
+    "scripts": {}
+  }
+}

+ 22 - 0
uniapp_cli/postcss.config.js

@@ -0,0 +1,22 @@
+const path = require('path')
+module.exports = {
+  parser: require('postcss-comment'),
+  plugins: [
+    require('postcss-import')({
+      resolve (id, basedir, importOptions) {
+        if (id.startsWith('~@/')) {
+          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(3))
+        } else if (id.startsWith('@/')) {
+          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(2))
+        } else if (id.startsWith('/') && !id.startsWith('//')) {
+          return path.resolve(process.env.UNI_INPUT_DIR, id.substr(1))
+        }
+        return id
+      }
+    }),
+    require('autoprefixer')({
+      remove: process.env.UNI_PLATFORM !== 'h5'
+    }),
+    require('@dcloudio/vue-cli-plugin-uni/packages/postcss')
+  ]
+}

+ 0 - 0
uniapp_cli/public/index.html


Some files were not shown because too many files changed in this diff