Kirin hai 2 meses
pai
achega
a0e91f5279

+ 6 - 6
app/Request.php

@@ -49,7 +49,7 @@ class Request extends \think\Request
      * @param callable|null $deal
      * @return array
      */
-    public function more(array $params, bool $suffix = false, callable $deal = null, bool $filter = true): array
+    public function more(array $params, bool $suffix = false, callable $deal = null, int $update_id = 0, bool $filter = true): array
     {
         $p = [];
         $i = 0;
@@ -72,7 +72,7 @@ class Request extends \think\Request
             }
         }
         if (!is_null($deal)) {
-            $deal($p);
+            $deal($p, $update_id);
         }
         if ($filter && $p) {
             $p = $this->filterArrayValues($p);
@@ -114,9 +114,9 @@ class Request extends \think\Request
      * @param bool $filter
      * @return array
      */
-    public function getMore(array $params, bool $suffix = false, callable $deal = null, bool $filter = true): array
+    public function getMore(array $params, bool $suffix = false, callable $deal = null, int $update_id = 0, bool $filter = true): array
     {
-        return $this->more($params, $suffix, $deal, $filter);
+        return $this->more($params, $suffix, $deal, $update_id, $filter);
     }
 
     /**
@@ -127,9 +127,9 @@ class Request extends \think\Request
      * @param bool $filter
      * @return array
      */
-    public function postMore(array $params, bool $suffix = false, callable $deal = null, bool $filter = true): array
+    public function postMore(array $params, bool $suffix = false, callable $deal = null, int $update_id = 0, bool $filter = true): array
     {
-        return $this->more($params, $suffix, $deal, $filter);
+        return $this->more($params, $suffix, $deal, $update_id, $filter);
     }
 
     /**

+ 2 - 2
app/common/AdminBaseController.php

@@ -108,7 +108,7 @@ abstract class AdminBaseController extends BaseController
         return $this->error('添加失败');
     }
 
-    public function validate($data, $validate, $s)
+    public function validate($data, $validate, $s = '')
     {
         $scene = $validate->allScene() ?? [];
         if (in_array($s, $scene))
@@ -127,7 +127,7 @@ abstract class AdminBaseController extends BaseController
         $data = $this->service->get($id);
         if (!$data)
             return $this->error('数据不存在');
-        $data = $this->request->postMore($this->createParams, false, $this->updateDeal);
+        $data = $this->request->postMore($this->createParams, false, $this->updateDeal, $id);
         if ($this->validate) {
             $this->validate($data, $this->validate, 'update');
         }

+ 4 - 1
app/controller/admin/Common.php

@@ -11,6 +11,7 @@ namespace app\controller\admin;
 
 use app\common\AdminBaseController;
 use app\services\system\admin\SystemMenusServices;
+use app\services\system\admin\SystemRoleServices;
 use app\services\system\CityAreaServices;
 use Psr\SimpleCache\InvalidArgumentException;
 use qiniu\services\CacheService;
@@ -21,7 +22,7 @@ use think\db\exception\ModelNotFoundException;
 class Common extends AdminBaseController
 {
 
-    public function adminInfo(SystemMenusServices $services)
+    public function adminInfo(SystemMenusServices $services, SystemRoleServices $roleServices)
     {
         $adminInfo = $this->request->adminInfo();
         [$menus, $uniqueAuth] = $services->getMenusList($adminInfo['roles'], (int)$adminInfo['level']);
@@ -32,8 +33,10 @@ class Common extends AdminBaseController
             'user_info' => [
                 'id' => $adminInfo['id'],
                 'account' => $adminInfo['account'],
+                'phone' => $adminInfo['phone'],
                 'real_name' => $adminInfo['real_name'],
                 'head_pic' => $adminInfo['head_pic'],
+                'roles' => $roleServices->getRolesNames($adminInfo['roles'])
             ]
         ]);
     }

+ 1 - 1
app/controller/admin/system/SystemMenus.php

@@ -55,7 +55,7 @@ class SystemMenus extends AdminBaseController
             }
             $data['is_show'] = ($data['auth_type'] == 2 ? 1 : $data['is_show']);
             if ($data['auth_type'] == 2) $data['extend'] = '';
-            $data['extend'] = json_encode($data['extend']);
+            $data['extend'] = $data['extend'] ? json_encode($data['extend']) : '';
         };
         $this->searchable = [
             ['type', 1],

+ 3 - 0
app/controller/api/Login.php

@@ -51,6 +51,9 @@ class Login extends ApiBaseController
         if (!$account || !$password) {
             return app('json')->fail('请输入账号和密码');
         }
+        if (!in_array($login_type, ['phone', 'account'])) {
+            return $this->error('请选择登录方式');
+        }
         validate(\app\validate\api\LoginValidate::class)->check(['account' => $account, 'pwd' => $password]);
 
         if ($login_type == 'phone') {

+ 56 - 1
app/controller/api/user/User.php

@@ -9,7 +9,62 @@
 namespace app\controller\api\user;
 
 
-class User
+use app\common\ApiBaseController;
+use app\Request;
+use app\services\user\UserLevelServices;
+use app\services\user\UserServices;
+use app\validate\api\LoginValidate;
+use think\exception\ValidateException;
+
+/**
+ * 用户基本类
+ * Class User
+ * @package app\controller\api\user
+ */
+class User extends ApiBaseController
 {
 
+    public function __construct(Request $request, UserServices $services)
+    {
+        parent::__construct($request);
+        $this->service = $services;
+    }
+
+    public function info()
+    {
+        //用户信息
+        $user = $this->request->user();
+        if (is_object($user)) $user = $user->toArray();
+        /** @var UserLevelServices $levelService */
+        $levelService = app()->make(UserLevelServices::class);
+        //用户等级
+        $level = $levelService->getUserLevelInfo($user['uid']);
+        $user['level_info'] = $level;
+        return $this->success('ok', $user);
+    }
+
+    public function setAccount()
+    {
+        $user = $this->request->user();
+        if ($user['change_account_time'] > strtotime(date('Y-01-01', time()) && $user['change_account_time'] < strtotime(date('Y-12-31', time())))) {
+            $this->error('今年已经修改过账号,不能再修改了');
+        }
+        $new = $this->request->post('new_account');
+        if ($this->service->be(['account' => $new])) $this->error('账号已存在');
+        try {
+            validate(LoginValidate::class)->check([
+                'account' => $new,
+            ]);
+        } catch (ValidateException $e) {
+            return $this->error($e->getError());
+        }
+        $res = $this->service->update($user['uid'], ['account' => $new, 'change_account_time' => time()]);
+        if ($res) {
+            return $this->success('修改成功');
+        } else {
+            return $this->error('修改失败');
+        }
+    }
+
+
 }

+ 4 - 0
app/model/system/config/SystemUserLevel.php

@@ -40,6 +40,10 @@ class SystemUserLevel extends BaseModel
 
     protected $order = 'grade asc,id asc';
 
+    public function setAddTimeAttr()
+    {
+        return time();
+    }
     /**
      * 时间获取器
      * @param $value

+ 1 - 8
app/services/system/admin/SystemAdminServices.php

@@ -326,14 +326,7 @@ class SystemAdminServices extends BaseServices
                 throw new AdminException('两次输入的密码不一致');
             $adminInfo->pwd = $this->passwordHash($data['new_pwd']);
         } elseif ($data['phone'] != '') {
-            $verifyCode = CacheService::get('code_' . $data['phone']);
-            if (!$verifyCode)
-                throw new AdminException('请先获取验证码');
-            $verifyCode = substr($verifyCode, 0, 6);
-            if ($verifyCode != $data['code']) {
-                CacheService::delete('code_' . $data['phone']);
-                throw new AdminException('验证码错误');
-            }
+            check_sms_captcha($data['phone'], 'admin_update', $data['code']);
             $adminInfo->phone = $data['phone'];
         }
         if ($adminInfo->save()) {

+ 2 - 2
app/services/system/config/SystemUserLevelTaskServices.php

@@ -44,13 +44,13 @@ class SystemUserLevelTaskServices extends BaseServices
         foreach ($task as &$v) {
             if (!$this->tasks[$v['name'] ?? '']) throw new ValidateException('任务不存在');
             if (($v['num1'] ?? 0) < 0) throw new ValidateException('任务数量不能小于0');
-            $v['info'] = str_replace('{%num1%}', $v['num'] . $this->tasks[$v['name']]['unit1'], $this->tasks[$v['name']]['info']);
+            $v['info'] = str_replace('{%num1%}', ($v['num1'] ?? 0) . $this->tasks[$v['name']]['unit1'], $this->tasks[$v['name']]['info']);
             for ($i = 2; ; $i++) {
                 $unit = 'unit' . $i;
                 $num = 'num' . $i;
                 if (isset($this->tasks[$v['name']][$unit])) {
                     if (($v[$num] ?? 0) < 0) throw new ValidateException('任务数量' . $i . '不能小于0');
-                    $v['info'] = str_replace('{%num' . $i . '%}', $v[$num] . $this->tasks[$v['name']][$unit], $v['info']);
+                    $v['info'] = str_replace('{%num' . $i . '%}', ($v[$num] ?? 0) . $this->tasks[$v['name']][$unit], $v['info']);
                 } else {
                     break;
                 }

+ 5 - 0
qiniu/basic/BaseController.php

@@ -30,4 +30,9 @@ abstract class BaseController
     {
         return app('json')->fail($msg, $data);
     }
+
+    public function status($code = 200, $msg = 'ok', ?array $data = null)
+    {
+        return app('json')->make($code, $msg, $data);
+    }
 }

+ 3 - 6
qiniu/basic/BaseModel.php

@@ -192,8 +192,7 @@ abstract class BaseModel extends Model
         }
     }
 
-    public
-    function getSum($where, $field)
+    public function getSum($where, $field)
     {
         return $this->search($where)->sum($field);
     }
@@ -205,15 +204,13 @@ abstract class BaseModel extends Model
      * @param string|null $key
      * @return Model|null
      */
-    public
-    function batchUpdate(array $ids, array $data, ?string $key = null)
+    public function batchUpdate(array $ids, array $data, ?string $key = null)
     {
         return $this->getModel()::whereIn(is_null($key) ? $this->getPk() : $key, $ids)->update($data);
     }
 
 
-    public
-    function modelName()
+    public function modelName()
     {
         return $this->getModel()->chsName ?? $this->getModel()->name;
     }

+ 77 - 18
qiniu/command/MakeAdmin.php

@@ -46,12 +46,17 @@ class MakeAdmin extends Command
     /**
      * Int类型识别为日期时间的结尾字符,默认会识别为日期文本框
      */
-    protected $intDateSuffix = ['_time'];
+    protected $intDateSuffix = ['time'];
+
+    /**
+     * Int类型识别为日期时间的结尾字符,默认会识别为日期文本框
+     */
+    protected $intListSuffix = ['images', 'ids', 'list'];
 
     /**
      * 开关后缀
      */
-    protected $switchSuffix = ['_switch'];
+    protected $switchSuffix = ['switch'];
 
     protected function configure()
     {
@@ -106,7 +111,7 @@ class MakeAdmin extends Command
         //模型
         list($modelNamespace, $modelName, $modelFile, $modelArr) = $this->getModelData($path, $table);
         list($serviceNamespace, $serviceName, $serviceFile, $serviceArr) = $this->getServicesData($path, $table);
-        list($controllerNamespace, $controllerName, $controllerFile, $controllerArr) = $this->getControllerData($path, $table);
+        list($controllerNamespace, $controllerName, $controllerFile, $controllerArr, $controllerPath, $resourceName) = $this->getControllerData($path, $table);
         list($validateNamespace, $validateName, $validateFile, $validateArr) = $this->getValidateData($path, $table);
 
         if ($delete) {
@@ -196,6 +201,8 @@ class MakeAdmin extends Command
             $appendAttrList = [];
             $exportAttr = [];
             $validateRules = [];
+            $searchAttr = [];
+            $searchFieldAttr = [];
             $validateMessage = [];
             $createParams = [];
 
@@ -260,12 +267,12 @@ class MakeAdmin extends Command
                             $this->setCreate($createParams, $v);
                             $this->appendAttr($appendAttrList, $field);
                             $exportAttr[$field . '_chs'] = $langList[$field] ?? parseName($field, 1);
-                            break;
                         } else {
                             $this->setCreate($createParams, $v);
                             $exportAttr[$field] = $langList[$field] ?? parseName($field, 1);
                         }
-                        $this->checkValidate($validateRules, $validateMessage, $v, $field, $langList[$field] ?? parseName($field, 1));
+                        $this->checkValidate($validateRules, $validateMessage, $v, $field, $langList[$field] ?? parseName($field, 1), $itemArr);
+                        $this->searchAttrHandel($searchAttr, $searchFieldAttr, $field, $langList[$field] ?? parseName($field, 1), $inputType);
                     }
                 }
             }
@@ -278,6 +285,8 @@ class MakeAdmin extends Command
                 'table' => $table,
                 'tableComment' => $tableComment,
                 'tableName' => $modelTableName,
+                'resourceName' => $resourceName,
+                'path' => $controllerPath,
                 'pk' => $priKey,
                 'controllerNamespace' => $controllerNamespace,
                 'controllerName' => $controllerName,
@@ -301,6 +310,8 @@ class MakeAdmin extends Command
                 'validateMessage' => implode(",\n", $this->handelArrayDate($validateMessage)),
                 'exportAttrList' => implode(",\n", $this->handelArrayDate($exportAttr)),
                 'createParams' => implode(",\n\t", $createParams),
+                'searchFieldAttr' => implode(",\n\t", $searchFieldAttr),
+                'searchAttrList' => implode("\n\n", $searchAttr),
             ];
 
             // 生成控制器文件
@@ -351,11 +362,11 @@ class MakeAdmin extends Command
     {
         $field = $item['COLUMN_NAME'];
         $type = $item['DATA_TYPE'];
-        if ($type == 'set' || $this->isMatchSuffix($field, ['_images', '_ids'])) {
+        if ($type == 'set' || $this->isMatchSuffix($field, $this->intListSuffix)) {
             $createParams[] = <<<EOD
         ['{$field}', []]
 EOD;
-        } else if (in_array($type, ['bigint', 'int', 'mediumint', 'smallint', 'tinyint', 'decimal', 'double', 'float'])) {
+        } else if (in_array($type, ['bigint', 'int', 'mediumint', 'smallint', 'tinyint', 'decimal', 'double', 'float']) && !$this->isMatchSuffix($field, $this->intDateSuffix)) {
             $default = !($item['COLUMN_DEFAULT'] == '' || $item['COLUMN_DEFAULT'] == 'null') ? $item['COLUMN_DEFAULT'] : 0;
             $createParams[] = <<<EOD
         ['{$field}', {$default}]
@@ -370,7 +381,7 @@ EOD;
     }
 
 
-    protected function checkValidate(&$validateArr, &$validateMessage, $item, $field, $fieldName)
+    protected function checkValidate(&$validateArr, &$validateMessage, $item, $field, $fieldName, $itemArr = [])
     {
         if (empty($validateArr[$field]))
             $validateArr[$field] = [];
@@ -379,11 +390,19 @@ EOD;
             $validateArr[$field][] = 'require';
             $validateMessage[$field . '.require'] = $fieldName . '是必需的';
         }
-        if ($item['DATA_TYPE'] == 'set' || $this->isMatchSuffix($field, ['_images', '_ids'])) {
+        if ($itemArr) {
+            $list = [];
+            foreach ($itemArr as $k => $v) {
+                $list[] = $k;
+            }
+            $validateArr[$field][] = 'in:' . implode(',', $list);
+            $validateMessage[$field . '.in'] = '请选择正确的' . $fieldName;
+        }
+        if ($item['DATA_TYPE'] == 'set' || $this->isMatchSuffix($field, $this->intListSuffix)) {
             $validateArr[$field][] = 'array';
-            $validateMessage[$field . '.array'] = $fieldName . '需要是数组';
+            $validateMessage[$field . '.array'] = $fieldName . '必须是数组';
         }
-        if (in_array($item['DATA_TYPE'], ['bigint', 'int', 'mediumint', 'smallint', 'tinyint'])) {
+        if (in_array($item['DATA_TYPE'], ['bigint', 'int', 'mediumint', 'smallint', 'tinyint']) && !$this->isMatchSuffix($field, $this->intDateSuffix)) {
             $validateArr[$field][] = 'number';
             $validateMessage[$field . '.number'] = $fieldName . '必须是整数';
         }
@@ -393,15 +412,19 @@ EOD;
         }
         if (stripos($item['COLUMN_TYPE'], 'unsigned') !== false) {
             $validateArr[$field][] = 'egt:0';
-            $validateMessage[$field . '.egt'] = $fieldName . '是必需大于等于0';
+            $validateMessage[$field . '.egt'] = $fieldName . '大于等于0';
         }
         if ($this->isMatchSuffix($field, ['phone', 'mobile'])) {
             $validateArr[$field][] = 'mobile';
-            $validateMessage[$field . '.mobile'] = $fieldName . '格式不正确';
+            $validateMessage[$field . '.mobile'] = $fieldName . '不是有效的手机号码';
         }
-        if ($this->isMatchSuffix($field, 'email')) {
+        if ($this->isMatchSuffix($field, ['email'])) {
             $validateArr[$field][] = 'email';
-            $validateMessage[$field . '.email'] = $fieldName . '格式不正确';
+            $validateMessage[$field . '.email'] = $fieldName . '不是有效的邮箱地址';
+        }
+        if ($this->isMatchSuffix($field, ['url', 'link'])) {
+            $validateArr[$field][] = 'url';
+            $validateMessage[$field . '.url'] = $fieldName . '不是有效的url';
         }
     }
 
@@ -543,6 +566,13 @@ EOD;
 EOD;
     }
 
+    protected function searchAttr(&$searchFieldAttr, $field)
+    {
+        $searchFieldAttr[] = <<<EOD
+        ['{$field}', '']
+EOD;
+    }
+
 
     protected function getFieldListName($field)
     {
@@ -558,7 +588,7 @@ EOD;
 
     protected function getAttr(&$getAttr, $field, $inputType = '')
     {
-        if (!in_array($inputType, ['datetime', 'select', 'multiple', 'add_time', 'add_time_datetime'])) {
+        if (!in_array($inputType, ['datetime', 'select', 'multiple', 'add_time', 'add_time_datetime', 'list'])) {
             return;
         }
         $attrField = ucfirst($this->getCamelizeName($field));
@@ -566,6 +596,29 @@ EOD;
     }
 
 
+    protected function searchAttrHandel(&$searchAttr, &$searchFieldAttr, $field, $fieldName, $inputType = '')
+    {
+        $type = 'default';
+        if ($this->isMatchSuffix($field, ['id'])) {
+            $type = 'id';
+        } else if ($this->isMatchSuffix($field, ['name', 'title', 'info'])) {
+            $type = 'like';
+        } else if (in_array($inputType, ['datetime'])) {
+            $type = 'time';
+        } else if (in_array($inputType, ['multiple', 'list'])) {
+            $type = 'find_in_set';
+        } else if (in_array($inputType, ['select'])) {
+            $type = 'default';
+        } else {
+            return;
+        }
+
+        $attrField = ucfirst($this->getCamelizeName($field));
+        $searchAttr[] = $this->getReplacedStub("search" . DS . $type, ['field' => $field, 'fieldName' => $fieldName, 'methodName' => "search{$attrField}Attr"]);
+        $this->searchAttr($searchFieldAttr, $field);
+    }
+
+
     /**
      * 获取替换后的数据
      * @param string $name
@@ -632,7 +685,7 @@ EOD;
             $inputType = "select";
         }
         // 指定后缀结尾且类型为enum,说明是个单选框
-        if ($this->isMatchSuffix($fieldsName, ['_ids', '_images'])) {
+        if ($this->isMatchSuffix($fieldsName, $this->intListSuffix)) {
             $inputType = "list";
         }
         // 指定后缀结尾且类型为char或tinyint且长度为1,说明是个Switch复选框
@@ -724,13 +777,19 @@ EOD;
             $path = str_replace(['.', '/', '\\'], '/', $path);
             $arr = explode('/', $path);
         }
+        $resourceName = $table;
+        foreach ($arr as $v) {
+            if (strpos($resourceName, $v . '_') === 0) {
+                $resourceName = substr($resourceName, strlen($v . '_'));
+            }
+        }
         $parseArr = $arr;
         array_push($parseArr, $parseName);
         $appNamespace = Config::get('app.app_namespace');
         $parseNamespace = "{$appNamespace}\\{$type}" . (in_array($type, ['controller', 'validate']) ? '\\admin' : '') . ($arr ? "\\" . implode("\\", $arr) : "");
         $moduleDir = $this->app->getRootPath() . 'app' . DS . $type . DS . ((in_array($type, ['controller', 'validate']) ? 'admin' : '') . DS);
         $parseFile = $moduleDir . ($arr ? implode(DS, $arr) . DS : '') . $parseName . '.php';
-        return [$parseNamespace, $parseName, $parseFile, $parseArr];
+        return [$parseNamespace, $parseName, $parseFile, $parseArr, ($arr ? implode('.', $arr) . '.' : ''), $resourceName];
     }
 
 

+ 25 - 2
qiniu/command/stubs/controller.stub

@@ -1,4 +1,10 @@
 <?php
+/**
+ * @Created by PhpStorm
+ * @Powered by Kirin
+ * @Version 1.0.0
+ * @Qiniu.TaiZhou.Co
+ */
 
 namespace {%controllerNamespace%};
 
@@ -25,13 +31,30 @@ class {%controllerName%} extends AdminBaseController
         parent::__construct($request);
         $this->service = $services;
         $this->validate = $validate;
-        $this->searchable = [];
+        $this->searchable = [
+    {%searchFieldAttr%}
+        ];
         $this->searchDeal = function (&$data){
         };
         $this->createParams = [
     {%createParams%}
         ];
-        $this->saveDeal = $this->updateDeal = function (&$data){
+        $this->saveDeal = $this->updateDeal = function (&$data, $id){
         };
     }
+
+    /*
+    简易路由
+
+    //{%tableComment%}路由
+    Route::resource('{%resourceName%}', '{%path%}{%controllerName%}')
+        ->only(['index', 'read', 'save', 'update', 'delete'])
+        ->option(['real_name' => [
+            'index' => '{%tableComment%}列表',
+            'read' => '{%tableComment%}详情',
+            'save' => '保存{%tableComment%}',
+            'update' => '修改{%tableComment%}',
+            'delete' => '删除{%tableComment%}'
+        ]]);
+    */
 }

+ 12 - 0
qiniu/command/stubs/model.stub

@@ -1,4 +1,11 @@
 <?php
+/**
+ * @Created by PhpStorm
+ * @Powered by Kirin
+ * @Version 1.0.0
+ * @Qiniu.TaiZhou.Co
+ */
+
 declare (strict_types = 1);
 
 namespace {%modelNamespace%};
@@ -22,6 +29,9 @@ class {%modelName%} extends BaseModel
     // 表名
     protected ${%modelTableType%} = '{%modelTableTypeName%}';
 
+    // 表中文名
+    protected $chsName = '{%tableComment%}';
+
     //主键
     protected $pk = '{%pk%}';
 
@@ -41,4 +51,6 @@ class {%modelName%} extends BaseModel
 
 {%setAttrList%}
 
+{%searchAttrList%}
+
 }

+ 12 - 0
qiniu/command/stubs/search/default.stub

@@ -0,0 +1,12 @@
+
+    /**
+     * {%fieldName%} 搜索器
+     * @param $query
+     * @param $value
+     */
+    public function {%methodName%}($query, $value)
+    {
+        if ($value != '') {
+            $query->where('{%field%}', $value);
+        }
+    }

+ 12 - 0
qiniu/command/stubs/search/find_in_set.stub

@@ -0,0 +1,12 @@
+
+    /**
+     * {%fieldName%} 搜索器
+     * @param $query
+     * @param $value
+     */
+    public function {%methodName%}($query, $value)
+    {
+        if ($value != '') {
+            $query->where("FIND_IN_SET(" . $value . ",{%field%})");
+        }
+    }

+ 13 - 0
qiniu/command/stubs/search/id.stub

@@ -0,0 +1,13 @@
+
+    /**
+     * {%fieldName%} 搜索器
+     * @param $query
+     * @param $value
+     */
+    public function {%methodName%}($query, $value)
+    {
+        if (is_array($value))
+            $query->whereIn('{%field%}', $value);
+        else
+            $query->where('{%field%}', $value);
+    }

+ 12 - 0
qiniu/command/stubs/search/like.stub

@@ -0,0 +1,12 @@
+
+    /**
+     * {%fieldName%} 搜索器
+     * @param $query
+     * @param $value
+     */
+    public function {%methodName%}($query, $value)
+    {
+        if ($value != '') {
+            $query->where('{%field%}', 'like', "%{$value}%");
+        }
+    }

+ 12 - 0
qiniu/command/stubs/search/time.stub

@@ -0,0 +1,12 @@
+
+    /**
+     * {%fieldName%} 搜索器
+     * @param $query
+     * @param $value
+     */
+    public function {%methodName%}($query, $value)
+    {
+        if ($value != '') {
+            $query->whereTime('{%field%}', $value);
+        }
+    }

+ 7 - 0
qiniu/command/stubs/services.stub

@@ -1,4 +1,11 @@
 <?php
+/**
+ * @Created by PhpStorm
+ * @Powered by Kirin
+ * @Version 1.0.0
+ * @Qiniu.TaiZhou.Co
+ */
+
 declare (strict_types=1);
 
 namespace {%servicesNamespace%};

+ 6 - 0
qiniu/command/stubs/validate.stub

@@ -1,4 +1,10 @@
 <?php
+/**
+ * @Created by PhpStorm
+ * @Powered by Kirin
+ * @Version 1.0.0
+ * @Qiniu.TaiZhou.Co
+ */
 
 namespace {%validateNamespace%};
 

+ 3 - 1
route/api.php

@@ -30,7 +30,7 @@ Route::group('api', function () {
             //图片验证码
             Route::get('sms_captcha', 'Login/captcha')->name('captcha');
             //验证码发送
-            Route::post('register/verify', 'Login/verify')->name('registerVerify');
+            Route::post('verify', 'Login/verify')->name('registerVerify');
             //手机号修改密码
             Route::post('pwd/reset', 'Login/reset')->name('resetPwd');
             //图形验证码
@@ -53,6 +53,8 @@ Route::group('api', function () {
             Route::post('trade_pwd/reset', 'Login/reset_trade_pwd')->middleware(BlockerMiddleware::class)->name('resetTradePwd');
             //上传图片
             Route::post('upload', 'Pub/upload_image')->middleware(BlockerMiddleware::class)->name('uploadImage');
+            //修改账号
+            Route::put('account', 'user.User/setAccount')->name('setAccount')->middleware(BlockerMiddleware::class)->name('setAccount');
             //用户相关
             Route::group('user', function () {
                 //用户信息