diff --git a/server/app/BaseController.php b/server/app/BaseController.php index 4dbc18ae1192a932a4f1a54a014b1f707f0a5ff9..a4b5297ab25d8b9b5bc42c8fd3e131b7810285f1 100644 --- a/server/app/BaseController.php +++ b/server/app/BaseController.php @@ -1,11 +1,14 @@ request = $request; + } + /** * 每次请求在 EndMiddleware拦截器 中进行的初始化 - * @return void */ // 初始化 - protected function initialize() + public function initialize(): void { - $this->request = request(); } /** * 验证数据 * @access protected - * @param array $data 数据 - * @param string|array $validate 验证器名或者验证规则数组 - * @param array $message 提示信息 - * @param bool $batch 是否批量验证 - * @return array|string|true + * @param array $data 数据 + * @param array|string $validate 验证器名或者验证规则数组 + * @param array $message 提示信息 + * @param bool $batch 是否批量验证 * @throws ValidateException + * @throws ReflectionException */ - protected function validate(array $data, $validate, array $message = [], bool $batch = false) + protected function validate(array $data, array|string $validate, array $message = [], bool $batch = false): true|array|string { if (is_array($validate)) { $v = new Validate(); @@ -70,9 +74,13 @@ abstract class BaseController // 支持场景 [$validate, $scene] = explode('.', $validate); } - $class = str_contains($validate, '\\') ? $validate : $this->app->parseClass('validate', $validate); - $v = new $class(); - if (!empty($scene)) { + $class = new ReflectionClass($validate); + // 验证器是否存在 + if (! $class->isInstantiable()) { + throw new ValidateException('class not exists:' . $class->getName()); + } + $v = $class->newInstance(); + if (! empty($scene)) { $v->scene($scene); } } @@ -86,6 +94,4 @@ abstract class BaseController return $v->failException(true)->check($data); } - - } diff --git a/server/app/Request.php b/server/app/Request.php index b1151b770dc33fa08095b897ad33d25de4b227d3..a56e9c7f4aea0847eb1fe72f086fc4dec6c3f7c4 100644 --- a/server/app/Request.php +++ b/server/app/Request.php @@ -7,5 +7,5 @@ namespace app; class Request extends \support\Request { // 全局过滤规则 - protected $filter = ['trim']; + protected array $filter = ['trim']; } \ No newline at end of file diff --git a/server/app/adminapi/controller/BaseAdminController.php b/server/app/adminapi/controller/BaseAdminController.php index 40df4b3e59c4c46a4932c44798dfb89e4ba9e4ae..a10c50b94384906e8356d32ce243d394999861f5 100644 --- a/server/app/adminapi/controller/BaseAdminController.php +++ b/server/app/adminapi/controller/BaseAdminController.php @@ -11,14 +11,10 @@ class BaseAdminController extends BaseLikeAdminController { public array $notNeedLogin = []; - protected $adminId = 0; - protected $adminInfo = []; + protected int $adminId = 0; + protected array $adminInfo = []; - public function initialize() - { - parent::initialize(); - } - public function setAdmin($adminId,$adminInfo): void + public function setAdmin(int $adminId,array $adminInfo): void { $this->adminId = $adminId; $this->adminInfo = $adminInfo; diff --git a/server/app/adminapi/controller/ConfigController.php b/server/app/adminapi/controller/ConfigController.php index 69fb1cf49a991be83528b62c0e1d8eede0fd9e58..02741225c89df3a91d699207de80a70e4c7c60e2 100644 --- a/server/app/adminapi/controller/ConfigController.php +++ b/server/app/adminapi/controller/ConfigController.php @@ -16,6 +16,10 @@ namespace app\adminapi\controller; use app\adminapi\logic\auth\AuthLogic; use app\adminapi\logic\ConfigLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 配置控制器 @@ -32,7 +36,7 @@ class ConfigController extends BaseAdminController * @author 乔峰 * @date 2021/12/31 11:01 */ - public function getConfig() + public function getConfig(): Response { $data = ConfigLogic::getConfig(); return $this->data($data); @@ -41,13 +45,13 @@ class ConfigController extends BaseAdminController /** * @notes 根据类型获取字典数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/27 19:10 */ - public function dict() + public function dict(): Response { $type = $this->request->get('type', ''); $data = ConfigLogic::getDictByType($type); diff --git a/server/app/adminapi/controller/DownloadController.php b/server/app/adminapi/controller/DownloadController.php index 0224fa3661a031ec2aa4e2c69c38ccc91d0f55be..31b51a07fb8533eec42b8407cf1ac56f723e66b5 100644 --- a/server/app/adminapi/controller/DownloadController.php +++ b/server/app/adminapi/controller/DownloadController.php @@ -7,6 +7,7 @@ namespace app\adminapi\controller; use app\common\cache\ExportCache; use app\common\service\JsonService; use think\facade\Cache; +use Webman\Http\Response; class DownloadController extends BaseAdminController { @@ -17,7 +18,7 @@ class DownloadController extends BaseAdminController * @author 乔峰 * @date 2022/11/24 16:10 */ - public function export() + public function export(): \support\Response|Response { //获取文件缓存的key $fileKey = request()->get('file'); diff --git a/server/app/adminapi/controller/FileController.php b/server/app/adminapi/controller/FileController.php index 924a75f52522449556e1956323cc1d22622448f1..4a8c067cc4218a410d748b556e2e83b15f55fd04 100644 --- a/server/app/adminapi/controller/FileController.php +++ b/server/app/adminapi/controller/FileController.php @@ -8,6 +8,7 @@ use app\adminapi\lists\file\FileCateLists; use app\adminapi\lists\file\FileLists; use app\adminapi\logic\FileLogic; use app\adminapi\validate\FileValidate; +use support\Response; class FileController extends BaseAdminController { @@ -23,7 +24,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:30 */ - public function lists() + public function lists(): Response { return $this->dataLists(new FileLists()); } @@ -34,7 +35,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:30 */ - public function move() + public function move(): Response { $params = $this->validateObj->post()->goCheck('move'); FileLogic::move($params); @@ -47,7 +48,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:31 */ - public function rename() + public function rename(): Response { $params = $this->validateObj->post()->goCheck('rename'); FileLogic::rename($params); @@ -60,7 +61,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:31 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); FileLogic::delete($params); @@ -73,7 +74,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:31 */ - public function listCate() + public function listCate(): Response { return $this->dataLists(new FileCateLists()); } @@ -84,7 +85,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:31 */ - public function addCate() + public function addCate(): Response { $params = $this->validateObj->post()->goCheck('addCate'); FileLogic::addCate($params); @@ -97,7 +98,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:31 */ - public function editCate() + public function editCate(): Response { $params = $this->validateObj->post()->goCheck('editCate'); FileLogic::editCate($params); @@ -110,7 +111,7 @@ class FileController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:32 */ - public function delCate() + public function delCate(): Response { $params = $this->validateObj->post()->goCheck('id'); FileLogic::delCate($params); diff --git a/server/app/adminapi/controller/LoginController.php b/server/app/adminapi/controller/LoginController.php index 2ca7c7f109efb4ed216704cd9fffbedcd75a1c5d..b2664fe43636e378a7ab1a59fc9640fdd2a29669 100644 --- a/server/app/adminapi/controller/LoginController.php +++ b/server/app/adminapi/controller/LoginController.php @@ -16,6 +16,10 @@ namespace app\adminapi\controller; use app\adminapi\logic\LoginLogic; use app\adminapi\validate\LoginValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\facade\Cache; /** @@ -36,12 +40,12 @@ class LoginController extends BaseAdminController /** * @notes 账号登录 * @date 2021/6/30 17:01 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 */ - public function account() + public function account(): Response { $params = $this->validateObj->post()->goCheck(); return $this->data((new LoginLogic())->login($params)); @@ -49,13 +53,13 @@ class LoginController extends BaseAdminController /** * @notes 退出登录 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/8 00:36 */ - public function logout() + public function logout(): Response { //退出登录情况特殊,只有成功的情况,也不需要token验证 (new LoginLogic())->logout($this->adminInfo); diff --git a/server/app/adminapi/controller/UploadController.php b/server/app/adminapi/controller/UploadController.php index 71c00089df06003e6eb1d0ef3737d1f21244b294..7e2652e78a590661c6f2a4afdd0b61f83ba9208a 100644 --- a/server/app/adminapi/controller/UploadController.php +++ b/server/app/adminapi/controller/UploadController.php @@ -6,15 +6,16 @@ namespace app\adminapi\controller; use app\common\service\UploadService; use Exception; +use support\Response; use Tinywan\Storage\Storage; class UploadController extends BaseAdminController { /** * 获取上传凭证 - * @return \support\Response + * @return Response */ - public function getUploadToken(): \support\Response + public function getUploadToken(): Response { $name = $this->request->post('name', ''); @@ -30,9 +31,9 @@ class UploadController extends BaseAdminController * @notes 上传图片 * @author 乔峰 * @date 2021/12/29 16:27 - * @return \support\Response + * @return Response */ - public function image(): \support\Response + public function image(): Response { $cid = $this->request->post('cid', 0); $uploadObj = (new UploadService()); @@ -47,9 +48,9 @@ class UploadController extends BaseAdminController * @notes 上传视频 * @author 乔峰 * @date 2021/12/29 16:27 - * @return \support\Response + * @return Response */ - public function video(): \support\Response + public function video(): Response { $cid = $this->request->post('cid', 0); $uploadObj = (new UploadService()); diff --git a/server/app/adminapi/controller/WorkbenchController.php b/server/app/adminapi/controller/WorkbenchController.php index e269abe0bfb52842f04ba2bc13b17102594554e1..5a4fe9076bef683f6bcfc560572bdc8d07691b0c 100644 --- a/server/app/adminapi/controller/WorkbenchController.php +++ b/server/app/adminapi/controller/WorkbenchController.php @@ -15,6 +15,7 @@ namespace app\adminapi\controller; use app\adminapi\logic\WorkbenchLogic; +use support\Response; /** * 工作台 @@ -29,7 +30,7 @@ class WorkbenchController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 17:01 */ - public function index() + public function index(): Response { $result = WorkbenchLogic::index(); return $this->data($result); diff --git a/server/app/adminapi/controller/article/ArticleCateController.php b/server/app/adminapi/controller/article/ArticleCateController.php index b1027e4b44f8c84de7bbad9c4e6adaa26eacb482..d6ad402201afe339e3e1803db3842dc0db48b375 100644 --- a/server/app/adminapi/controller/article/ArticleCateController.php +++ b/server/app/adminapi/controller/article/ArticleCateController.php @@ -18,6 +18,10 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\article\ArticleCateLists; use app\adminapi\logic\article\ArticleCateLogic; use app\adminapi\validate\article\ArticleCateValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 资讯分类管理控制器 @@ -35,11 +39,11 @@ class ArticleCateController extends BaseAdminController } /** * @notes 查看资讯分类列表 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 17:11 */ - public function lists() + public function lists(): Response { return $this->dataLists(new ArticleCateLists()); } @@ -47,11 +51,11 @@ class ArticleCateController extends BaseAdminController /** * @notes 添加资讯分类 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 17:31 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); ArticleCateLogic::add($params); @@ -61,11 +65,11 @@ class ArticleCateController extends BaseAdminController /** * @notes 编辑资讯分类 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 17:49 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = ArticleCateLogic::edit($params); @@ -78,11 +82,11 @@ class ArticleCateController extends BaseAdminController /** * @notes 删除资讯分类 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 17:52 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); ArticleCateLogic::delete($params); @@ -92,11 +96,11 @@ class ArticleCateController extends BaseAdminController /** * @notes 资讯分类详情 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 17:54 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = ArticleCateLogic::detail($params); @@ -106,11 +110,11 @@ class ArticleCateController extends BaseAdminController /** * @notes 更改资讯分类状态 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/21 10:15 */ - public function updateStatus() + public function updateStatus(): Response { $params = $this->validateObj->post()->goCheck('status'); $result = ArticleCateLogic::updateStatus($params); @@ -123,14 +127,14 @@ class ArticleCateController extends BaseAdminController /** * @notes 获取文章分类 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/10/13 10:54 */ - public function all() + public function all(): Response { $result = ArticleCateLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/article/ArticleController.php b/server/app/adminapi/controller/article/ArticleController.php index 48053d07d7bf14983a3f9f8a8655fe99e122c154..5f0049e8cde8992db405d0fb86cc64ea928a3404 100644 --- a/server/app/adminapi/controller/article/ArticleController.php +++ b/server/app/adminapi/controller/article/ArticleController.php @@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\article\ArticleLists; use app\adminapi\logic\article\ArticleLogic; use app\adminapi\validate\article\ArticleValidate; +use support\Response; /** * 资讯管理控制器 @@ -35,22 +36,22 @@ class ArticleController extends BaseAdminController } /** * @notes 查看资讯列表 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 9:47 */ - public function lists() + public function lists(): Response { return $this->dataLists(new ArticleLists()); } /** * @notes 添加资讯 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 9:57 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); ArticleLogic::add($params); @@ -59,11 +60,11 @@ class ArticleController extends BaseAdminController /** * @notes 编辑资讯 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 10:12 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = ArticleLogic::edit($params); @@ -75,11 +76,11 @@ class ArticleController extends BaseAdminController /** * @notes 删除资讯 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 10:17 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); ArticleLogic::delete($params); @@ -88,11 +89,11 @@ class ArticleController extends BaseAdminController /** * @notes 资讯详情 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 10:15 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = ArticleLogic::detail($params); @@ -102,11 +103,11 @@ class ArticleController extends BaseAdminController /** * @notes 更改资讯状态 - * @return \support\Response + * @return Response * @author heshihu * @date 2022/2/22 10:18 */ - public function updateStatus() + public function updateStatus(): Response { $params = $this->validateObj->post()->goCheck('status'); $result = ArticleLogic::updateStatus($params); diff --git a/server/app/adminapi/controller/auth/AdminController.php b/server/app/adminapi/controller/auth/AdminController.php index 2254ae4a001476e104aeab001684f8b7d49accb2..2f6d583a8572d62ced6ef2ea3cd7cb8c542bda83 100644 --- a/server/app/adminapi/controller/auth/AdminController.php +++ b/server/app/adminapi/controller/auth/AdminController.php @@ -20,6 +20,7 @@ use app\adminapi\validate\auth\AdminValidate; use app\adminapi\logic\auth\AdminLogic; use app\adminapi\validate\auth\editSelfValidate; use app\common\model\auth\Admin; +use support\Response; /** * 管理员控制器 @@ -41,7 +42,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 9:55 */ - public function lists() + public function lists(): Response { return $this->dataLists(new AdminLists()); } @@ -52,7 +53,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 10:21 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); $result = AdminLogic::add($params); @@ -68,7 +69,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 11:03 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = AdminLogic::edit($params); @@ -84,7 +85,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 11:03 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); $result = AdminLogic::delete($params); @@ -100,7 +101,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 11:07 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = AdminLogic::detail($params); @@ -113,7 +114,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2021/12/31 10:53 */ - public function mySelf() + public function mySelf(): Response { $result = AdminLogic::detail(['id' => $this->adminId], 'auth'); return $this->data($result); @@ -125,7 +126,7 @@ class AdminController extends BaseAdminController * @author 乔峰 * @date 2022/4/8 17:54 */ - public function editSelf() + public function editSelf(): Response { $params = (new editSelfValidate())->post()->goCheck('', ['admin_id' => $this->adminId]); $result = AdminLogic::editSelf($params); diff --git a/server/app/adminapi/controller/auth/MenuController.php b/server/app/adminapi/controller/auth/MenuController.php index 42307cf8751f78efe5dbd98d14f47a2d2ff2ae4b..9f83ef7b045a1b5cf219954f635b3b16d7548ebb 100644 --- a/server/app/adminapi/controller/auth/MenuController.php +++ b/server/app/adminapi/controller/auth/MenuController.php @@ -19,6 +19,10 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\auth\MenuLists; use app\adminapi\logic\auth\MenuLogic; use app\adminapi\validate\auth\MenuValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -40,7 +44,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/29 17:41 */ - public function route() + public function route(): Response { $result = MenuLogic::getMenuByAdminId($this->adminId); return $this->data($result); @@ -52,7 +56,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/29 17:23 */ - public function lists() + public function lists(): Response { return $this->dataLists(new MenuLists()); } @@ -63,7 +67,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/30 10:07 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); return $this->data(MenuLogic::detail($params)); @@ -75,7 +79,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/30 10:07 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); MenuLogic::add($params); @@ -88,7 +92,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/30 10:07 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); MenuLogic::edit($params); @@ -101,7 +105,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/6/30 10:07 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); MenuLogic::delete($params); @@ -114,7 +118,7 @@ class MenuController extends BaseAdminController * @author 乔峰 * @date 2022/7/6 17:04 */ - public function updateStatus() + public function updateStatus(): Response { $params = $this->validateObj->post()->goCheck('status'); MenuLogic::updateStatus($params); @@ -124,13 +128,13 @@ class MenuController extends BaseAdminController /** * @notes 获取菜单数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 11:03 */ - public function all() + public function all(): Response { $result = MenuLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/auth/RoleController.php b/server/app/adminapi/controller/auth/RoleController.php index b0d2677d8254ccd2ca107f90e27eceba3f1f7fc6..a981a07a338f965eb02f95bac62277dc1687ae95 100644 --- a/server/app/adminapi/controller/auth/RoleController.php +++ b/server/app/adminapi/controller/auth/RoleController.php @@ -20,6 +20,10 @@ use app\adminapi\{ validate\auth\RoleValidate, controller\BaseAdminController }; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 角色控制器 @@ -40,7 +44,7 @@ class RoleController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 11:49 */ - public function lists() + public function lists(): Response { return $this->dataLists(new RoleLists()); } @@ -51,7 +55,7 @@ class RoleController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 11:49 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); $res = RoleLogic::add($params); @@ -67,7 +71,7 @@ class RoleController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:18 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $res = RoleLogic::edit($params); @@ -83,7 +87,7 @@ class RoleController extends BaseAdminController * @author 乔峰 * @date 2021/12/29 14:18 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('del'); RoleLogic::delete($params['id']); @@ -93,13 +97,13 @@ class RoleController extends BaseAdminController /** * @notes 查看角色详情 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 14:18 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $detail = RoleLogic::detail($params['id']); @@ -109,13 +113,13 @@ class RoleController extends BaseAdminController /** * @notes 获取角色数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:39 */ - public function all() + public function all(): Response { $result = RoleLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/channel/AppSettingController.php b/server/app/adminapi/controller/channel/AppSettingController.php index 77ff7ec04c03745e6763b52840a12eedcb563286..84e6bc872a167da11be79d156e52396c8c786c0b 100644 --- a/server/app/adminapi/controller/channel/AppSettingController.php +++ b/server/app/adminapi/controller/channel/AppSettingController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\AppSettingLogic; +use support\Response; /** * APP设置控制器 @@ -27,11 +28,11 @@ class AppSettingController extends BaseAdminController /** * @notes 获取App设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:24 */ - public function getConfig() + public function getConfig(): Response { $result = AppSettingLogic::getConfig(); return $this->data($result); @@ -40,11 +41,11 @@ class AppSettingController extends BaseAdminController /** * @notes App设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:25 */ - public function setConfig() + public function setConfig(): Response { $params = $this->request->post(); AppSettingLogic::setConfig($params); diff --git a/server/app/adminapi/controller/channel/MnpSettingsController.php b/server/app/adminapi/controller/channel/MnpSettingsController.php index 7070c6a6d4b946acff677f972a3d45d86790de72..ab13a4a48b6705ef9612f38bd0600f0ab55b787d 100644 --- a/server/app/adminapi/controller/channel/MnpSettingsController.php +++ b/server/app/adminapi/controller/channel/MnpSettingsController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\MnpSettingsLogic; use app\adminapi\validate\channel\MnpSettingsValidate; +use support\Response; /** * 小程序设置 @@ -27,11 +28,11 @@ class MnpSettingsController extends BaseAdminController { /** * @notes 获取小程序配置 - * @return \support\Response + * @return Response * @author ljj * @date 2022/2/16 9:38 上午 */ - public function getConfig() + public function getConfig(): Response { $result = (new MnpSettingsLogic())->getConfig(); return $this->data($result); @@ -39,11 +40,11 @@ class MnpSettingsController extends BaseAdminController /** * @notes 设置小程序配置 - * @return \support\Response + * @return Response * @author ljj * @date 2022/2/16 9:51 上午 */ - public function setConfig() + public function setConfig(): Response { $params = (new MnpSettingsValidate())->post()->goCheck(); (new MnpSettingsLogic())->setConfig($params); diff --git a/server/app/adminapi/controller/channel/OfficialAccountMenuController.php b/server/app/adminapi/controller/channel/OfficialAccountMenuController.php index 2c7f4bb6a7133815f131fbaab356536fe635cb8a..fc745ae9ff9000cfbe5c547d99adbabdb56c6e49 100644 --- a/server/app/adminapi/controller/channel/OfficialAccountMenuController.php +++ b/server/app/adminapi/controller/channel/OfficialAccountMenuController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\OfficialAccountMenuLogic; +use support\Response; /** * 微信公众号菜单控制器 @@ -27,11 +28,11 @@ class OfficialAccountMenuController extends BaseAdminController /** * @notes 保存菜单 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:41 */ - public function save() + public function save(): Response { $params = $this->request->post(); $result = OfficialAccountMenuLogic::save($params); @@ -44,11 +45,11 @@ class OfficialAccountMenuController extends BaseAdminController /** * @notes 保存发布菜单 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:42 */ - public function saveAndPublish() + public function saveAndPublish(): Response { $params = $this->request->post(); $result = OfficialAccountMenuLogic::saveAndPublish($params); @@ -62,11 +63,11 @@ class OfficialAccountMenuController extends BaseAdminController /** * @notes 查看菜单详情 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:42 */ - public function detail() + public function detail(): Response { $result = OfficialAccountMenuLogic::detail(); return $this->data($result); diff --git a/server/app/adminapi/controller/channel/OfficialAccountReplyController.php b/server/app/adminapi/controller/channel/OfficialAccountReplyController.php index a0ae11ece8521bc5211c23ceb343a5508f20c4b0..2b25ab8ee5ac0c5e30c8e07518d41ac40da266e1 100644 --- a/server/app/adminapi/controller/channel/OfficialAccountReplyController.php +++ b/server/app/adminapi/controller/channel/OfficialAccountReplyController.php @@ -18,6 +18,8 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\channel\OfficialAccountReplyLists; use app\adminapi\logic\channel\OfficialAccountReplyLogic; use app\adminapi\validate\channel\OfficialAccountReplyValidate; +use ReflectionException; +use support\Response; /** * 微信公众号回复控制器 @@ -38,11 +40,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 查看回复列表(关注/关键词/默认) - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:58 */ - public function lists() + public function lists(): Response { return $this->dataLists(new OfficialAccountReplyLists()); } @@ -50,11 +52,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 添加回复(关注/关键词/默认) - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:58 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); $result = OfficialAccountReplyLogic::add($params); @@ -67,11 +69,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 查看回复详情 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:58 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = OfficialAccountReplyLogic::detail($params); @@ -81,11 +83,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 编辑回复(关注/关键词/默认) - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:58 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = OfficialAccountReplyLogic::edit($params); @@ -98,11 +100,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 删除回复(关注/关键词/默认) - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:59 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); OfficialAccountReplyLogic::delete($params); @@ -112,11 +114,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 更新排序 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:59 */ - public function sort() + public function sort(): Response { $params = $this->validateObj->post()->goCheck('sort'); OfficialAccountReplyLogic::sort($params); @@ -126,11 +128,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 更新状态 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:59 */ - public function status() + public function status(): Response { $params = $this->validateObj->post()->goCheck('status'); OfficialAccountReplyLogic::status($params); @@ -140,11 +142,11 @@ class OfficialAccountReplyController extends BaseAdminController /** * @notes 微信公众号回调 - * @throws \ReflectionException + * @throws ReflectionException * @author 段誉 * @date 2022/3/29 10:59 */ - public function index() + public function index(): Response { $result = OfficialAccountReplyLogic::index(); return response($result->getBody())->header([ diff --git a/server/app/adminapi/controller/channel/OfficialAccountSettingController.php b/server/app/adminapi/controller/channel/OfficialAccountSettingController.php index 3d43435617f837df71da3faa44645d40a1adbe7f..10abf8b38ccc2c9214e5d13912b1c50db8ddc941 100644 --- a/server/app/adminapi/controller/channel/OfficialAccountSettingController.php +++ b/server/app/adminapi/controller/channel/OfficialAccountSettingController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\OfficialAccountSettingLogic; use app\adminapi\validate\channel\OfficialAccountSettingValidate; +use support\Response; /** * 公众号设置 @@ -34,11 +35,11 @@ class OfficialAccountSettingController extends BaseAdminController } /** * @notes 获取公众号配置 - * @return \support\Response + * @return Response * @author ljj * @date 2022/2/16 10:09 上午 */ - public function getConfig() + public function getConfig(): Response { $result = (new OfficialAccountSettingLogic())->getConfig(); return $this->data($result); @@ -46,11 +47,11 @@ class OfficialAccountSettingController extends BaseAdminController /** * @notes 设置公众号配置 - * @return \support\Response + * @return Response * @author ljj * @date 2022/2/16 10:09 上午 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck(); (new OfficialAccountSettingLogic())->setConfig($params); diff --git a/server/app/adminapi/controller/channel/OpenSettingController.php b/server/app/adminapi/controller/channel/OpenSettingController.php index a99c570465aaa48806103fa6ec49461f4ad9fb24..2eb350e879091cfe99bb4d0c83071dcf8d93cc9c 100644 --- a/server/app/adminapi/controller/channel/OpenSettingController.php +++ b/server/app/adminapi/controller/channel/OpenSettingController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\OpenSettingLogic; use app\adminapi\validate\channel\OpenSettingValidate; +use support\Response; /** * 微信开放平台 @@ -34,11 +35,11 @@ class OpenSettingController extends BaseAdminController } /** * @notes 获取微信开放平台设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 11:03 */ - public function getConfig() + public function getConfig(): Response { $result = OpenSettingLogic::getConfig(); return $this->data($result); @@ -47,11 +48,11 @@ class OpenSettingController extends BaseAdminController /** * @notes 微信开放平台设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 11:03 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck(); OpenSettingLogic::setConfig($params); diff --git a/server/app/adminapi/controller/channel/WebPageSettingController.php b/server/app/adminapi/controller/channel/WebPageSettingController.php index 214cff6889dc7ef35f97bf56874a719d2767afe3..a5eb7d323ac4b43e9a5e39f25ed2be223673e641 100644 --- a/server/app/adminapi/controller/channel/WebPageSettingController.php +++ b/server/app/adminapi/controller/channel/WebPageSettingController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\channel; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\channel\WebPageSettingLogic; use app\adminapi\validate\channel\WebPageSettingValidate; +use support\Response; /** * H5设置控制器 @@ -34,11 +35,11 @@ class WebPageSettingController extends BaseAdminController } /** * @notes 获取H5设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:36 */ - public function getConfig() + public function getConfig(): Response { $result = WebPageSettingLogic::getConfig(); return $this->data($result); @@ -47,11 +48,11 @@ class WebPageSettingController extends BaseAdminController /** * @notes H5设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/3/29 10:36 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck(); WebPageSettingLogic::setConfig($params); diff --git a/server/app/adminapi/controller/crontab/CrontabController.php b/server/app/adminapi/controller/crontab/CrontabController.php index 9e0b2fff57a59e61d076359bcc137b333452b63a..6b90d3f651cf89651fed85e49f763e844ebf6b7e 100644 --- a/server/app/adminapi/controller/crontab/CrontabController.php +++ b/server/app/adminapi/controller/crontab/CrontabController.php @@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\crontab\CrontabLists; use app\adminapi\logic\crontab\CrontabLogic; use app\adminapi\validate\crontab\CrontabValidate; +use support\Response; /** * 定时任务控制器 @@ -38,7 +39,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:27 */ - public function lists() + public function lists(): Response { return $this->dataLists(new CrontabLists()); } @@ -49,7 +50,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:27 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); $result = CrontabLogic::add($params); @@ -65,7 +66,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:27 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = CrontabLogic::detail($params); @@ -78,7 +79,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:27 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = CrontabLogic::edit($params); @@ -94,7 +95,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:27 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); $result = CrontabLogic::delete($params); @@ -110,7 +111,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:28 */ - public function operate() + public function operate(): Response { $params = $this->validateObj->post()->goCheck('operate'); $result = CrontabLogic::operate($params); @@ -126,7 +127,7 @@ class CrontabController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 14:28 */ - public function expression() + public function expression(): Response { $params = $this->validateObj->goCheck('expression'); $result = CrontabLogic::expression($params); diff --git a/server/app/adminapi/controller/decorate/DataController.php b/server/app/adminapi/controller/decorate/DataController.php index 07988c9d22368907cb56e97f7b3680c3d0e1c0d3..785fef8d627372ebce59d5cd581b511851b9a93a 100644 --- a/server/app/adminapi/controller/decorate/DataController.php +++ b/server/app/adminapi/controller/decorate/DataController.php @@ -15,6 +15,10 @@ namespace app\adminapi\controller\decorate; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\decorate\DecorateDataLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -28,14 +32,14 @@ class DataController extends BaseAdminController /** * @notes 文章列表 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/22 16:50 */ - public function article() + public function article(): Response { $limit = $this->request->get('limit', 10); $result = DecorateDataLogic::getArticleLists($limit); diff --git a/server/app/adminapi/controller/decorate/PageController.php b/server/app/adminapi/controller/decorate/PageController.php index 439e431d87d6e61c763d844e699c727089cbff96..55d40c19e8d3f9d5ac3c1fe7c80807d104fb89c2 100644 --- a/server/app/adminapi/controller/decorate/PageController.php +++ b/server/app/adminapi/controller/decorate/PageController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\decorate; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\decorate\DecoratePageLogic; use app\adminapi\validate\decorate\DecoratePageValidate; +use support\Response; /** @@ -35,11 +36,11 @@ class PageController extends BaseAdminController } /** * @notes 获取装修修页面详情 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/14 18:43 */ - public function detail() + public function detail(): Response { $id = $this->request->get('id'); $result = DecoratePageLogic::getDetail($id); @@ -49,11 +50,11 @@ class PageController extends BaseAdminController /** * @notes 保存装修配置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/15 9:57 */ - public function save() + public function save(): Response { $params = $this->validateObj->post()->goCheck(); $result = DecoratePageLogic::save($params); diff --git a/server/app/adminapi/controller/decorate/TabbarController.php b/server/app/adminapi/controller/decorate/TabbarController.php index 561d869836fbd213ef0d9aa52ab3893a5711ab42..b7304ae866b71d8be5125f7b2acb05392c94043b 100644 --- a/server/app/adminapi/controller/decorate/TabbarController.php +++ b/server/app/adminapi/controller/decorate/TabbarController.php @@ -16,6 +16,10 @@ namespace app\adminapi\controller\decorate; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\decorate\DecorateTabbarLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 装修-底部导航 @@ -27,14 +31,14 @@ class TabbarController extends BaseAdminController /** * @notes 底部导航详情 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/7 16:39 */ - public function detail() + public function detail(): Response { $data = DecorateTabbarLogic::detail(); return $this->success('', $data); @@ -43,11 +47,11 @@ class TabbarController extends BaseAdminController /** * @notes 底部导航保存 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/6 9:58 */ - public function save() + public function save(): Response { $params = $this->request->post(); DecorateTabbarLogic::save($params); diff --git a/server/app/adminapi/controller/dept/DeptController.php b/server/app/adminapi/controller/dept/DeptController.php index f7218fb67d1430b316db4b084adbef4ef1191b52..087993d9d2a5d2de2332c9d42e2d644869fd2af9 100644 --- a/server/app/adminapi/controller/dept/DeptController.php +++ b/server/app/adminapi/controller/dept/DeptController.php @@ -17,6 +17,10 @@ namespace app\adminapi\controller\dept; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\dept\DeptLogic; use app\adminapi\validate\dept\DeptValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 部门管理控制器 @@ -37,7 +41,7 @@ class DeptController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:07 */ - public function lists() + public function lists(): Response { $params = $this->request->get(); $result = DeptLogic::lists($params); @@ -47,13 +51,13 @@ class DeptController extends BaseAdminController /** * @notes 上级部门 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/5/26 18:36 */ - public function leaderDept() + public function leaderDept(): Response { $result = DeptLogic::leaderDept(); return $this->success('',$result); @@ -65,7 +69,7 @@ class DeptController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:40 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); DeptLogic::add($params); @@ -78,7 +82,7 @@ class DeptController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = DeptLogic::edit($params); @@ -94,7 +98,7 @@ class DeptController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); DeptLogic::delete($params); @@ -107,7 +111,7 @@ class DeptController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = DeptLogic::detail($params); @@ -117,13 +121,13 @@ class DeptController extends BaseAdminController /** * @notes 获取部门数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:28 */ - public function all() + public function all(): Response { $result = DeptLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/dept/JobsController.php b/server/app/adminapi/controller/dept/JobsController.php index 452639bea195678298b0290ad92ddaccc645ce64..85b224c2b38dff45c2000be0974a79c37db99352 100644 --- a/server/app/adminapi/controller/dept/JobsController.php +++ b/server/app/adminapi/controller/dept/JobsController.php @@ -18,6 +18,10 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\dept\JobsLists; use app\adminapi\logic\dept\JobsLogic; use app\adminapi\validate\dept\JobsValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -39,7 +43,7 @@ class JobsController extends BaseAdminController * @author 乔峰 * @date 2022/5/26 10:00 */ - public function lists() + public function lists(): Response { return $this->dataLists(new JobsLists()); } @@ -50,7 +54,7 @@ class JobsController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:40 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); JobsLogic::add($params); @@ -63,7 +67,7 @@ class JobsController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = JobsLogic::edit($params); @@ -79,7 +83,7 @@ class JobsController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); JobsLogic::delete($params); @@ -92,7 +96,7 @@ class JobsController extends BaseAdminController * @author 乔峰 * @date 2022/5/25 18:41 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = JobsLogic::detail($params); @@ -102,13 +106,13 @@ class JobsController extends BaseAdminController /** * @notes 获取岗位数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:31 */ - public function all() + public function all(): Response { $result = JobsLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/finance/AccountLogController.php b/server/app/adminapi/controller/finance/AccountLogController.php index 9ef88b05f6a7a6d87e70830e9741cf87c01ab48e..efcf3a8a32f775ad660d0edf68f07597bdd3995c 100644 --- a/server/app/adminapi/controller/finance/AccountLogController.php +++ b/server/app/adminapi/controller/finance/AccountLogController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\finance; use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\finance\AccountLogLists; use app\common\enum\user\AccountLogEnum; +use support\Response; /*** * 账户流水控制器 @@ -29,11 +30,11 @@ class AccountLogController extends BaseAdminController /** * @notes 账户流水明细 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 15:25 */ - public function lists() + public function lists(): Response { return $this->dataLists(new AccountLogLists()); } @@ -41,11 +42,11 @@ class AccountLogController extends BaseAdminController /** * @notes 用户余额变动类型 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 15:25 */ - public function getUmChangeType() + public function getUmChangeType(): Response { return $this->data(AccountLogEnum::getUserMoneyChangeTypeDesc()); } diff --git a/server/app/adminapi/controller/finance/RefundController.php b/server/app/adminapi/controller/finance/RefundController.php index ce2b1090c4469835127a2da8e435819f7bc4f530..bfee22abba617636d78b774b4408f241afb44c6c 100644 --- a/server/app/adminapi/controller/finance/RefundController.php +++ b/server/app/adminapi/controller/finance/RefundController.php @@ -18,6 +18,10 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\finance\RefundLogLists; use app\adminapi\lists\finance\RefundRecordLists; use app\adminapi\logic\finance\RefundLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 退款控制器 @@ -30,14 +34,14 @@ class RefundController extends BaseAdminController /** * @notes 退还统计 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/3/3 12:10 */ - public function stat() + public function stat(): Response { $result = RefundLogic::stat(); return $this->success('', $result); @@ -46,11 +50,11 @@ class RefundController extends BaseAdminController /** * @notes 退款记录 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/3/1 9:47 */ - public function record() + public function record(): Response { return $this->dataLists(new RefundRecordLists()); } @@ -58,11 +62,11 @@ class RefundController extends BaseAdminController /** * @notes 退款日志 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/3/1 9:47 */ - public function log() + public function log(): Response { $recordId = $this->request->get('record_id', 0); $result = RefundLogic::refundLog($recordId); diff --git a/server/app/adminapi/controller/notice/NoticeController.php b/server/app/adminapi/controller/notice/NoticeController.php index 5943985ef88b59e3b88ad171bfbf4d70602d90ac..f448b625fcd065d042faccc8101951d67590b40d 100644 --- a/server/app/adminapi/controller/notice/NoticeController.php +++ b/server/app/adminapi/controller/notice/NoticeController.php @@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\notice\NoticeSettingLists; use app\adminapi\logic\notice\NoticeLogic; use app\adminapi\validate\notice\NoticeValidate; +use support\Response; /** * 通知控制器 @@ -38,7 +39,7 @@ class NoticeController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:18 */ - public function settingLists() + public function settingLists(): Response { return $this->dataLists(new NoticeSettingLists()); } @@ -49,7 +50,7 @@ class NoticeController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:18 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = NoticeLogic::detail($params); @@ -62,7 +63,7 @@ class NoticeController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:18 */ - public function set() + public function set(): Response { $params = $this->request->post(); $result = NoticeLogic::set($params); diff --git a/server/app/adminapi/controller/notice/SmsConfigController.php b/server/app/adminapi/controller/notice/SmsConfigController.php index 491c088b6cee35f6fd3fa05a6cc166918dca74d3..2fa5aedca86d45e6c987b3a64d4da4fb47a9346f 100644 --- a/server/app/adminapi/controller/notice/SmsConfigController.php +++ b/server/app/adminapi/controller/notice/SmsConfigController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\notice; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\notice\SmsConfigLogic; use app\adminapi\validate\notice\SmsConfigValidate; +use support\Response; /** * 短信配置控制器 @@ -37,7 +38,7 @@ class SmsConfigController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:36 */ - public function getConfig() + public function getConfig(): Response { $result = SmsConfigLogic::getConfig(); return $this->data($result); @@ -49,7 +50,7 @@ class SmsConfigController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:36 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck('setConfig'); SmsConfigLogic::setConfig($params); @@ -62,7 +63,7 @@ class SmsConfigController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 11:36 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = SmsConfigLogic::detail($params); diff --git a/server/app/adminapi/controller/recharge/RechargeController.php b/server/app/adminapi/controller/recharge/RechargeController.php index b21e6e22263d57d67df355cd171b2c2c39c4f407..89cfa5e1f3114b8273ca2df4f4e755789c894840 100644 --- a/server/app/adminapi/controller/recharge/RechargeController.php +++ b/server/app/adminapi/controller/recharge/RechargeController.php @@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\recharge\RechargeLists; use app\adminapi\logic\recharge\RechargeLogic; use app\adminapi\validate\recharge\RechargeRefundValidate; +use support\Response; /** * 充值控制器 @@ -35,11 +36,11 @@ class RechargeController extends BaseAdminController } /** * @notes 获取充值设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/22 16:48 */ - public function getConfig() + public function getConfig(): Response { $result = RechargeLogic::getConfig(); return $this->data($result); @@ -48,11 +49,11 @@ class RechargeController extends BaseAdminController /** * @notes 充值设置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/22 16:48 */ - public function setConfig() + public function setConfig(): Response { $params = $this->request->post(); $result = RechargeLogic::setConfig($params); @@ -65,11 +66,11 @@ class RechargeController extends BaseAdminController /** * @notes 充值记录 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 16:01 */ - public function lists() + public function lists(): Response { return $this->dataLists(new RechargeLists()); } @@ -77,11 +78,11 @@ class RechargeController extends BaseAdminController /** * @notes 退款 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/28 17:29 */ - public function refund() + public function refund(): Response { $params = $this->validateObj->post()->goCheck('refund'); $result = RechargeLogic::refund($params, $this->adminId); @@ -95,11 +96,11 @@ class RechargeController extends BaseAdminController /** * @notes 重新退款 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/28 19:17 */ - public function refundAgain() + public function refundAgain(): Response { $params = $this->validateObj->post()->goCheck('again'); $result = RechargeLogic::refundAgain($params, $this->adminId); diff --git a/server/app/adminapi/controller/setting/CustomerServiceController.php b/server/app/adminapi/controller/setting/CustomerServiceController.php index 57249f8e4e2ed45f8900dc9e4ed5d993e2d689bf..4f751935c2176e32e89c6ed0a6d61b1fff3a1480 100644 --- a/server/app/adminapi/controller/setting/CustomerServiceController.php +++ b/server/app/adminapi/controller/setting/CustomerServiceController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\setting; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\CustomerServiceLogic; +use support\Response; /** * 客服设置 @@ -29,7 +30,7 @@ class CustomerServiceController extends BaseAdminController * @author ljj * @date 2022/2/15 12:05 下午 */ - public function getConfig() + public function getConfig(): Response { $result = CustomerServiceLogic::getConfig(); return $this->data($result); @@ -40,7 +41,7 @@ class CustomerServiceController extends BaseAdminController * @author ljj * @date 2022/2/15 12:11 下午 */ - public function setConfig() + public function setConfig(): Response { $params = $this->request->post(); CustomerServiceLogic::setConfig($params); diff --git a/server/app/adminapi/controller/setting/HotSearchController.php b/server/app/adminapi/controller/setting/HotSearchController.php index af59b36ea8b07d363a5b398cad96fa6e8cc01fb8..463c592b959a703a7ec22693cc4533371193d5bc 100644 --- a/server/app/adminapi/controller/setting/HotSearchController.php +++ b/server/app/adminapi/controller/setting/HotSearchController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\setting; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\HotSearchLogic; +use support\Response; /** * 热门搜索设置 @@ -30,7 +31,7 @@ class HotSearchController extends BaseAdminController * @author 乔峰 * @date 2022/9/5 19:00 */ - public function getConfig() + public function getConfig(): Response { $result = HotSearchLogic::getConfig(); return $this->data($result); @@ -42,7 +43,7 @@ class HotSearchController extends BaseAdminController * @author 乔峰 * @date 2022/9/5 19:00 */ - public function setConfig() + public function setConfig(): Response { $params = $this->request->post(); $result = HotSearchLogic::setConfig($params); diff --git a/server/app/adminapi/controller/setting/StorageController.php b/server/app/adminapi/controller/setting/StorageController.php index 07707379fac9d9cebab230d3c3961a540eb4ea59..445ad49c443294d5bcddb20713842a29c16e45d2 100644 --- a/server/app/adminapi/controller/setting/StorageController.php +++ b/server/app/adminapi/controller/setting/StorageController.php @@ -7,6 +7,7 @@ namespace app\adminapi\controller\setting; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\StorageLogic; use app\adminapi\validate\setting\StorageValidate; +use support\Response; class StorageController extends BaseAdminController { @@ -22,7 +23,7 @@ class StorageController extends BaseAdminController * @author 乔峰 * @date 2022/4/20 16:13 */ - public function lists() + public function lists(): Response { return $this->success('获取成功', StorageLogic::lists()); } @@ -33,7 +34,7 @@ class StorageController extends BaseAdminController * @author 乔峰 * @date 2022/4/20 16:19 */ - public function detail() + public function detail(): Response { $param = $this->validateObj->get()->goCheck('detail'); return $this->success('获取成功', StorageLogic::detail($param)); @@ -45,7 +46,7 @@ class StorageController extends BaseAdminController * @author 乔峰 * @date 2022/4/20 16:19 */ - public function setup() + public function setup(): Response { $params = $this->validateObj->post()->goCheck('setup'); $result = StorageLogic::setup($params); @@ -61,7 +62,7 @@ class StorageController extends BaseAdminController * @author 乔峰 * @date 2022/4/20 16:19 */ - public function change() + public function change(): Response { $params = $this->validateObj->post()->goCheck('change'); StorageLogic::change($params); diff --git a/server/app/adminapi/controller/setting/TransactionSettingsController.php b/server/app/adminapi/controller/setting/TransactionSettingsController.php index 2938783b20913bcbd93fe437ff98832cd895f25c..74e0c0c209654251edc630e35495a482e1914aef 100644 --- a/server/app/adminapi/controller/setting/TransactionSettingsController.php +++ b/server/app/adminapi/controller/setting/TransactionSettingsController.php @@ -18,6 +18,7 @@ namespace app\adminapi\controller\setting; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\TransactionSettingsLogic; use app\adminapi\validate\setting\TransactionSettingsValidate; +use support\Response; /** * 交易设置 @@ -38,7 +39,7 @@ class TransactionSettingsController extends BaseAdminController * @author ljj * @date 2022/2/15 11:40 上午 */ - public function getConfig() + public function getConfig(): Response { $result = TransactionSettingsLogic::getConfig(); return $this->data($result); @@ -49,7 +50,7 @@ class TransactionSettingsController extends BaseAdminController * @author ljj * @date 2022/2/15 11:50 上午 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck('setConfig'); TransactionSettingsLogic::setConfig($params); diff --git a/server/app/adminapi/controller/setting/dict/DictDataController.php b/server/app/adminapi/controller/setting/dict/DictDataController.php index c56625561285c62993e3a220a95d5d0cc0cb907d..d304c19c1b0902cb471651d22f4b7e2a60b37dc7 100644 --- a/server/app/adminapi/controller/setting/dict/DictDataController.php +++ b/server/app/adminapi/controller/setting/dict/DictDataController.php @@ -18,6 +18,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\setting\dict\DictDataLists; use app\adminapi\logic\setting\dict\DictDataLogic; use app\adminapi\validate\dict\DictDataValidate; +use support\Response; /** @@ -39,7 +40,7 @@ class DictDataController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 16:35 */ - public function lists() + public function lists(): Response { return $this->dataLists(new DictDataLists()); } @@ -50,7 +51,7 @@ class DictDataController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 17:13 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); DictDataLogic::save($params); @@ -63,7 +64,7 @@ class DictDataController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 17:13 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); DictDataLogic::save($params); @@ -76,7 +77,7 @@ class DictDataController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 17:13 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('id'); DictDataLogic::delete($params); @@ -89,7 +90,7 @@ class DictDataController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 17:14 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('id'); $result = DictDataLogic::detail($params); diff --git a/server/app/adminapi/controller/setting/dict/DictTypeController.php b/server/app/adminapi/controller/setting/dict/DictTypeController.php index 2c41740602d3b6c3ec0f7988bac410fc34a36277..5a9de569debf72e5ba43aed87c7e18448b7e4b9e 100644 --- a/server/app/adminapi/controller/setting/dict/DictTypeController.php +++ b/server/app/adminapi/controller/setting/dict/DictTypeController.php @@ -18,6 +18,10 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\setting\dict\DictTypeLists; use app\adminapi\logic\setting\dict\DictTypeLogic; use app\adminapi\validate\dict\DictTypeValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -40,7 +44,7 @@ class DictTypeController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 15:50 */ - public function lists() + public function lists(): Response { return $this->dataLists(new DictTypeLists()); } @@ -51,7 +55,7 @@ class DictTypeController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 16:24 */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); DictTypeLogic::add($params); @@ -64,7 +68,7 @@ class DictTypeController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 16:25 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); DictTypeLogic::edit($params); @@ -77,7 +81,7 @@ class DictTypeController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 16:25 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); DictTypeLogic::delete($params); @@ -90,7 +94,7 @@ class DictTypeController extends BaseAdminController * @author 乔峰 * @date 2022/6/20 16:25 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = DictTypeLogic::detail($params); @@ -100,13 +104,13 @@ class DictTypeController extends BaseAdminController /** * @notes 获取字典类型数据 - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:46 */ - public function all() + public function all(): Response { $result = DictTypeLogic::getAllData(); return $this->data($result); diff --git a/server/app/adminapi/controller/setting/pay/PayConfigController.php b/server/app/adminapi/controller/setting/pay/PayConfigController.php index f9a4baebd9ad418b6360d4f2ce6db29be7c3caed..8ccf50776870ab9fe04a12394af5b78a994fa243 100644 --- a/server/app/adminapi/controller/setting/pay/PayConfigController.php +++ b/server/app/adminapi/controller/setting/pay/PayConfigController.php @@ -19,6 +19,7 @@ use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\setting\pay\PayConfigLists; use app\adminapi\logic\setting\pay\PayConfigLogic; use app\adminapi\validate\setting\PayConfigValidate; +use support\Response; /** * 支付配置 @@ -37,11 +38,11 @@ class PayConfigController extends BaseAdminController } /** * @notes 设置支付配置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/23 16:14 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck(); PayConfigLogic::setConfig($params); @@ -51,11 +52,11 @@ class PayConfigController extends BaseAdminController /** * @notes 获取支付配置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/23 16:14 */ - public function getConfig() + public function getConfig(): Response { $id = $this->validateObj->goCheck('get'); $result = PayConfigLogic::getConfig($id); @@ -65,11 +66,11 @@ class PayConfigController extends BaseAdminController /** * @notes - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/23 16:15 */ - public function lists() + public function lists(): Response { return $this->dataLists(new PayConfigLists()); } diff --git a/server/app/adminapi/controller/setting/pay/PayWayController.php b/server/app/adminapi/controller/setting/pay/PayWayController.php index 8df765e4c7269dd0857b606aefe02be056408363..86bf1cb5f88b3967dcacbc8fd2a13257bdf96c7e 100644 --- a/server/app/adminapi/controller/setting/pay/PayWayController.php +++ b/server/app/adminapi/controller/setting/pay/PayWayController.php @@ -16,6 +16,11 @@ namespace app\adminapi\controller\setting\pay; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\pay\PayWayLogic; +use Exception; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -28,14 +33,14 @@ class PayWayController extends BaseAdminController /** * @notes 获取支付方式 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:27 */ - public function getPayWay() + public function getPayWay(): Response { $result = PayWayLogic::getPayWay(); return $this->success('获取成功',$result); @@ -44,12 +49,12 @@ class PayWayController extends BaseAdminController /** * @notes 设置支付方式 - * @return \support\Response - * @throws \Exception + * @return Response + * @throws Exception * @author 段誉 * @date 2023/2/23 16:27 */ - public function setPayWay() + public function setPayWay(): Response { $params = $this->request->post(); $result = (new PayWayLogic())->setPayWay($params); diff --git a/server/app/adminapi/controller/setting/system/CacheController.php b/server/app/adminapi/controller/setting/system/CacheController.php index 38586fd9c37f2d8280d4b698dbe4315a1249fe8c..8467d0f387852895fe0f8e9078553c16558968ea 100644 --- a/server/app/adminapi/controller/setting/system/CacheController.php +++ b/server/app/adminapi/controller/setting/system/CacheController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\setting\system; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\system\CacheLogic; +use support\Response; /** * 系统缓存 @@ -30,7 +31,7 @@ class CacheController extends BaseAdminController * @author 乔峰 * @date 2022/4/8 16:34 */ - public function clear() + public function clear(): Response { CacheLogic::clear(); return $this->success('清除成功', [], 1, 1); diff --git a/server/app/adminapi/controller/setting/system/LogController.php b/server/app/adminapi/controller/setting/system/LogController.php index 4a0878fff1704d82dc69e6ac880207118fb91a00..a1c6d63663ee9dbc7a9059a51080d1da114e98f3 100644 --- a/server/app/adminapi/controller/setting/system/LogController.php +++ b/server/app/adminapi/controller/setting/system/LogController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\setting\system; use app\adminapi\controller\BaseAdminController; use app\adminapi\lists\setting\system\LogLists; +use support\Response; /** * 系统日志 @@ -30,7 +31,7 @@ class LogController extends BaseAdminController * @author ljj * @date 2021/8/3 4:25 下午 */ - public function lists() + public function lists(): Response { return $this->dataLists(new LogLists()); } diff --git a/server/app/adminapi/controller/setting/system/SystemController.php b/server/app/adminapi/controller/setting/system/SystemController.php index 2a76f9d854f8373bdbe80e24f69c20b68492bf5c..96322c12a7957c0f31424024b0ac983a6be1047a 100644 --- a/server/app/adminapi/controller/setting/system/SystemController.php +++ b/server/app/adminapi/controller/setting/system/SystemController.php @@ -16,6 +16,7 @@ namespace app\adminapi\controller\setting\system; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\system\SystemLogic; +use support\Response; /** @@ -31,7 +32,7 @@ class SystemController extends BaseAdminController * @author 乔峰 * @date 2021/12/28 18:36 */ - public function info() + public function info(): Response { $result = SystemLogic::getInfo(); return $this->data($result); diff --git a/server/app/adminapi/controller/setting/user/UserController.php b/server/app/adminapi/controller/setting/user/UserController.php index 245d55fc257d7e1cc4f46b9a02883e585a5ab1d5..f46dc8ff13ef39951acece992c476717ec643d1d 100644 --- a/server/app/adminapi/controller/setting/user/UserController.php +++ b/server/app/adminapi/controller/setting/user/UserController.php @@ -18,6 +18,7 @@ use app\adminapi\{ logic\setting\user\UserLogic, validate\setting\UserConfigValidate }; +use support\Response; /** @@ -39,7 +40,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 10:08 */ - public function getConfig() + public function getConfig(): Response { $result = (new UserLogic())->getConfig(); return $this->data($result); @@ -51,7 +52,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 10:08 */ - public function setConfig() + public function setConfig(): Response { $params = $this->validateObj->post()->goCheck('user'); (new UserLogic())->setConfig($params); @@ -64,7 +65,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 10:08 */ - public function getRegisterConfig() + public function getRegisterConfig(): Response { $result = (new UserLogic())->getRegisterConfig(); return $this->data($result); @@ -76,7 +77,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/3/29 10:08 */ - public function setRegisterConfig() + public function setRegisterConfig(): Response { $params = $this->validateObj->post()->goCheck('register'); (new UserLogic())->setRegisterConfig($params); diff --git a/server/app/adminapi/controller/setting/web/WebSettingController.php b/server/app/adminapi/controller/setting/web/WebSettingController.php index ca98ef83b9afd146cbfff071db3db1081a7ddf65..8c5f737e7618eb1fcad1a9c524c8abcec7879b39 100644 --- a/server/app/adminapi/controller/setting/web/WebSettingController.php +++ b/server/app/adminapi/controller/setting/web/WebSettingController.php @@ -17,6 +17,7 @@ namespace app\adminapi\controller\setting\web; use app\adminapi\controller\BaseAdminController; use app\adminapi\logic\setting\web\WebSettingLogic; use app\adminapi\validate\setting\WebSettingValidate; +use support\Response; /** * 网站设置 @@ -32,12 +33,13 @@ class WebSettingController extends BaseAdminController parent::initialize(); $this->validateObj = new WebSettingValidate(); } + /** * @notes 获取网站信息 * @author 乔峰 * @date 2021/12/28 15:44 */ - public function getWebsite() + public function getWebsite(): Response { $result = WebSettingLogic::getWebsiteInfo(); return $this->data($result); @@ -49,7 +51,7 @@ class WebSettingController extends BaseAdminController * @author 乔峰 * @date 2021/12/28 15:45 */ - public function setWebsite() + public function setWebsite(): Response { $params = $this->validateObj->post()->goCheck('website'); WebSettingLogic::setWebsiteInfo($params); @@ -57,13 +59,12 @@ class WebSettingController extends BaseAdminController } - /** * @notes 获取备案信息 * @author 乔峰 * @date 2021/12/28 16:10 */ - public function getCopyright() + public function getCopyright(): Response { $result = WebSettingLogic::getCopyright(); return $this->data($result); @@ -75,7 +76,7 @@ class WebSettingController extends BaseAdminController * @author 乔峰 * @date 2021/12/28 16:10 */ - public function setCopyright() + public function setCopyright(): Response { $params = $this->request->post(); $result = WebSettingLogic::setCopyright($params); @@ -91,7 +92,7 @@ class WebSettingController extends BaseAdminController * @author ljj * @date 2022/2/15 11:00 上午 */ - public function setAgreement() + public function setAgreement(): Response { $params = $this->request->post(); WebSettingLogic::setAgreement($params); @@ -104,7 +105,7 @@ class WebSettingController extends BaseAdminController * @author ljj * @date 2022/2/15 11:16 上午 */ - public function getAgreement() + public function getAgreement(): Response { $result = WebSettingLogic::getAgreement(); return $this->data($result); diff --git a/server/app/adminapi/controller/tools/GeneratorController.php b/server/app/adminapi/controller/tools/GeneratorController.php index 12cf114fe5b38bc022cb9557d9de32e2b62ebdce..63258cfd1784021fbd264e0056e8f97cb140642c 100644 --- a/server/app/adminapi/controller/tools/GeneratorController.php +++ b/server/app/adminapi/controller/tools/GeneratorController.php @@ -10,6 +10,7 @@ use app\adminapi\lists\tools\GenerateTableLists; use app\adminapi\logic\tools\GeneratorLogic; use app\adminapi\validate\tools\EditTableValidate; use app\adminapi\validate\tools\GenerateTableValidate; +use support\Response; /** * 代码生成器控制器 @@ -34,7 +35,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/14 10:57 */ - public function dataTable() + public function dataTable(): Response { return $this->dataLists(new DataTableLists()); } @@ -46,7 +47,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/14 10:57 */ - public function generateTable() + public function generateTable(): Response { return $this->dataLists(new GenerateTableLists()); } @@ -58,7 +59,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/15 10:09 */ - public function selectTable() + public function selectTable(): Response { $params = $this->validateObj->post()->goCheck('select'); $result = GeneratorLogic::selectTable($params, $this->adminId); @@ -75,7 +76,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/23 19:08 */ - public function generate() + public function generate(): Response { $params = $this->validateObj->post()->goCheck('id'); $result = GeneratorLogic::generate($params); @@ -91,7 +92,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/24 9:51 */ - public function download() + public function download(): Response|\Webman\Http\Response { $params = $this->validateObj->goCheck('download'); $result = GeneratorLogic::download($params['file']); @@ -108,7 +109,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/23 19:07 */ - public function preview() + public function preview(): Response { $params = $this->validateObj->post()->goCheck('id'); $result = GeneratorLogic::preview($params); @@ -125,7 +126,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/17 15:22 */ - public function syncColumn() + public function syncColumn(): Response { $params = $this->validateObj->post()->goCheck('id'); $result = GeneratorLogic::syncColumn($params); @@ -142,7 +143,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/20 10:44 */ - public function edit() + public function edit(): Response { $params = (new EditTableValidate())->post()->goCheck(); $result = GeneratorLogic::editTable($params); @@ -159,7 +160,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/15 19:00 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('id'); $result = GeneratorLogic::getTableDetail($params); @@ -173,7 +174,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/6/15 19:00 */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('id'); $result = GeneratorLogic::deleteTable($params); @@ -190,7 +191,7 @@ class GeneratorController extends BaseAdminController * @author bingo * @date 2022/12/14 11:07 */ - public function getModels() + public function getModels(): Response { $result = GeneratorLogic::getAllModels(); return $this->success('', $result, 1, 1); diff --git a/server/app/adminapi/controller/user/UserController.php b/server/app/adminapi/controller/user/UserController.php index ac1c5849446d11632cf1ba925b5b205946dcdccf..1251b6232a3cc70027d6c738bef060316000be55 100644 --- a/server/app/adminapi/controller/user/UserController.php +++ b/server/app/adminapi/controller/user/UserController.php @@ -9,6 +9,7 @@ use app\adminapi\lists\user\UserLists; use app\adminapi\logic\user\UserLogic; use app\adminapi\validate\user\AdjustUserMoney; use app\adminapi\validate\user\UserValidate; +use support\Response; class UserController extends BaseAdminController { @@ -24,7 +25,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022//22 16:16 */ - public function lists() + public function lists(): Response { return $this->dataLists(new UserLists()); } @@ -35,7 +36,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/9/22 16:34 */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $detail = UserLogic::detail($params['id']); @@ -48,7 +49,7 @@ class UserController extends BaseAdminController * @author 乔峰 * @date 2022/9/22 16:34 */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('setInfo'); UserLogic::setUserInfo($params); @@ -57,11 +58,11 @@ class UserController extends BaseAdminController /** * @notes 调整用户余额 - * @return \support\Response + * @return Response * @author bingo * @date 2023/2/23 14:33 */ - public function adjustMoney() + public function adjustMoney(): Response { $params = (new AdjustUserMoney())->post()->goCheck(); $res = UserLogic::adjustUserMoney($params); diff --git a/server/app/adminapi/listener/OperationLog.php b/server/app/adminapi/listener/OperationLog.php index 539cff394018cea549a4050a9058f0b64db306c3..aa11c20e85f1fb8edca1131e1f4261f453c4d01b 100644 --- a/server/app/adminapi/listener/OperationLog.php +++ b/server/app/adminapi/listener/OperationLog.php @@ -5,6 +5,7 @@ namespace app\adminapi\listener; use ReflectionClass; +use ReflectionException; use support\Log; use Webman\Http\Request; use think\Exception; @@ -17,17 +18,20 @@ class OperationLog * @param Request $request * @param Response $response * @return bool - * @throws \ReflectionException + * @throws ReflectionException * @author bingo * @date 2022/4/8 17:09 */ public static function handle(Request $request, Response $response): bool { $controllerObject = make($request->controller); + if (!$controllerObject){ + return false; + } [$adminId,$adminInfo] = $controllerObject->getAdmin(); //需要登录的接口,无效访问时不记录 - if (!$controllerObject||!$controllerObject->isNotNeedLogin($request->action) && empty($adminInfo)) { + if (!$controllerObject->isNotNeedLogin($request->action) && empty($adminInfo)) { return false; } $pathLower = strtolower($request->path()); diff --git a/server/app/adminapi/lists/BaseAdminDataLists.php b/server/app/adminapi/lists/BaseAdminDataLists.php index 748ad346deacf905dddb1939edfc0923a8447814..ecd77475a7328f6a59c5b11523ae72410f94a302 100644 --- a/server/app/adminapi/lists/BaseAdminDataLists.php +++ b/server/app/adminapi/lists/BaseAdminDataLists.php @@ -25,8 +25,8 @@ use app\common\lists\BaseDataLists; */ abstract class BaseAdminDataLists extends BaseDataLists { - protected $adminInfo; - protected $adminId; + protected array $adminInfo; + protected int $adminId; public function __construct() { diff --git a/server/app/adminapi/lists/article/ArticleCateLists.php b/server/app/adminapi/lists/article/ArticleCateLists.php index 251605ac272840f35f1c6d6b2ef8d486eca5b5d4..2178c86022e674cfebd572cca806e1ad7349627f 100644 --- a/server/app/adminapi/lists/article/ArticleCateLists.php +++ b/server/app/adminapi/lists/article/ArticleCateLists.php @@ -91,7 +91,7 @@ class ArticleCateLists extends BaseAdminDataLists implements ListsSearchInterfac return ArticleCate::where($this->searchWhere)->count(); } - public function extend() + public function extend(): array { return []; } diff --git a/server/app/adminapi/lists/article/ArticleLists.php b/server/app/adminapi/lists/article/ArticleLists.php index 0428ccfbbda09710e3671245790d8baa79bc388e..dfccaea81c988c3726750927548dd55a94576177 100644 --- a/server/app/adminapi/lists/article/ArticleLists.php +++ b/server/app/adminapi/lists/article/ArticleLists.php @@ -76,7 +76,7 @@ class ArticleLists extends BaseAdminDataLists implements ListsSearchInterface, L return Article::where($this->searchWhere)->count(); } - public function extend() + public function extend(): array { return []; } diff --git a/server/app/adminapi/lists/auth/AdminLists.php b/server/app/adminapi/lists/auth/AdminLists.php index b416cffbaeda617fabcd614ec66916a40c2979f4..2c0bd71927619d1969813224cd7e07f14569a6eb 100644 --- a/server/app/adminapi/lists/auth/AdminLists.php +++ b/server/app/adminapi/lists/auth/AdminLists.php @@ -24,6 +24,9 @@ use app\common\model\auth\AdminRole; use app\common\model\auth\SystemRole; use app\common\model\dept\Dept; use app\common\model\dept\Jobs; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 管理员列表 @@ -67,7 +70,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2021/12/29 10:07 */ @@ -125,9 +128,9 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis /** * @notes 获取管理列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 10:05 */ @@ -199,7 +202,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis ->count(); } - public function extend() + public function extend(): array { return []; } diff --git a/server/app/adminapi/lists/auth/MenuLists.php b/server/app/adminapi/lists/auth/MenuLists.php index 9216461e58e73ea9e6be55d601f7e5781636844f..de58ff3f8915ada4d68b4fd05233c1722bd434ba 100644 --- a/server/app/adminapi/lists/auth/MenuLists.php +++ b/server/app/adminapi/lists/auth/MenuLists.php @@ -16,6 +16,9 @@ namespace app\adminapi\lists\auth; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\auth\SystemMenu; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -29,9 +32,9 @@ class MenuLists extends BaseAdminDataLists /** * @notes 获取菜单列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/6/29 16:41 */ diff --git a/server/app/adminapi/lists/auth/RoleLists.php b/server/app/adminapi/lists/auth/RoleLists.php index 8c5c751f4b50424dc9cbbc6a8eb2591f1b8821c2..68a857162dd24af028078f65bee0c4a081678252 100644 --- a/server/app/adminapi/lists/auth/RoleLists.php +++ b/server/app/adminapi/lists/auth/RoleLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\auth; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\auth\AdminRole; use app\common\model\auth\SystemRole; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 角色列表 @@ -54,9 +57,9 @@ class RoleLists extends BaseAdminDataLists /** * @notes 角色列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author cjhao * @date 2021/8/25 18:00 */ diff --git a/server/app/adminapi/lists/channel/OfficialAccountReplyLists.php b/server/app/adminapi/lists/channel/OfficialAccountReplyLists.php index aa593262f0ece5855846594b4aafc0ad783856ae..4f2279e745cf2bd1a0fd36c70a40297c92e56a26 100644 --- a/server/app/adminapi/lists/channel/OfficialAccountReplyLists.php +++ b/server/app/adminapi/lists/channel/OfficialAccountReplyLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\channel; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\channel\OfficialAccountReply; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 微信公众号回复列表 @@ -28,7 +31,7 @@ class OfficialAccountReplyLists extends BaseAdminDataLists implements ListsSearc /** * @notes 设置搜索 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2022/3/30 15:02 */ @@ -43,9 +46,9 @@ class OfficialAccountReplyLists extends BaseAdminDataLists implements ListsSearc /** * @notes 回复列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/3/30 15:02 */ diff --git a/server/app/adminapi/lists/crontab/CrontabLists.php b/server/app/adminapi/lists/crontab/CrontabLists.php index 14cd115ad59adc1095bdf24292d4f5b5f9ea2660..8d3d08158f8a7947ab275b396d49909fea092a12 100644 --- a/server/app/adminapi/lists/crontab/CrontabLists.php +++ b/server/app/adminapi/lists/crontab/CrontabLists.php @@ -16,6 +16,9 @@ namespace app\adminapi\lists\crontab; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\Crontab; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 定时任务列表 @@ -27,9 +30,9 @@ class CrontabLists extends BaseAdminDataLists /** * @notes 定时任务列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/3/29 14:30 */ diff --git a/server/app/adminapi/lists/dept/JobsLists.php b/server/app/adminapi/lists/dept/JobsLists.php index 97d7a1aa5eb84b9a233c27123d90b554864136dd..d15b6d03674fc6e7e19a5611064a4a846847ac92 100644 --- a/server/app/adminapi/lists/dept/JobsLists.php +++ b/server/app/adminapi/lists/dept/JobsLists.php @@ -29,7 +29,7 @@ class JobsLists extends BaseAdminDataLists implements ListsSearchInterface,Lists /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2022/5/26 9:46 */ diff --git a/server/app/adminapi/lists/file/FileCateLists.php b/server/app/adminapi/lists/file/FileCateLists.php index e9393db6f2a88767ff6ab3e58566b067e71ec795..bd4d1a85861c8949593afcadbdfb060173993cfa 100644 --- a/server/app/adminapi/lists/file/FileCateLists.php +++ b/server/app/adminapi/lists/file/FileCateLists.php @@ -7,13 +7,16 @@ namespace app\adminapi\lists\file; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\file\FileCate; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class FileCateLists extends BaseAdminDataLists implements ListsSearchInterface { /** * @notes 文件分类搜素条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2021/12/29 14:24 */ @@ -28,9 +31,9 @@ class FileCateLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 获取文件分类列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 14:24 */ diff --git a/server/app/adminapi/lists/file/FileLists.php b/server/app/adminapi/lists/file/FileLists.php index edae997564d468e06691ee5fd6a6b2fb7b6aab24..bcd382a96d8afbc246b7f10fc364a8ca3365c9e0 100644 --- a/server/app/adminapi/lists/file/FileLists.php +++ b/server/app/adminapi/lists/file/FileLists.php @@ -9,12 +9,15 @@ use app\common\enum\FileEnum; use app\common\lists\ListsSearchInterface; use app\common\model\file\File; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class FileLists extends BaseAdminDataLists implements ListsSearchInterface { /** * @notes 文件搜索条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2021/12/29 14:27 */ @@ -30,9 +33,9 @@ class FileLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 获取文件列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 14:27 */ diff --git a/server/app/adminapi/lists/finance/RefundLogLists.php b/server/app/adminapi/lists/finance/RefundLogLists.php index 4f9b98150633574cfe39010f15493092cfabcee9..52f5d4abd908b04064342e031410db847b6220f7 100644 --- a/server/app/adminapi/lists/finance/RefundLogLists.php +++ b/server/app/adminapi/lists/finance/RefundLogLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\finance; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\refund\RefundLog; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -43,9 +46,9 @@ class RefundLogLists extends BaseAdminDataLists /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/3/1 9:56 */ diff --git a/server/app/adminapi/lists/finance/RefundRecordLists.php b/server/app/adminapi/lists/finance/RefundRecordLists.php index e04a241c17b46f13556911df06b5601ccccb3268..5f20108515e0377a84800c6a9835b7ee97c5d312 100644 --- a/server/app/adminapi/lists/finance/RefundRecordLists.php +++ b/server/app/adminapi/lists/finance/RefundRecordLists.php @@ -33,7 +33,7 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa /** * @notes 查询条件 - * @return \string[][] + * @return string[][] * @author 段誉 * @date 2023/3/1 9:51 */ @@ -124,7 +124,7 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa * @author 段誉 * @date 2023/3/1 9:51 */ - public function extend() + public function extend(): array { $count = (new RefundRecord())->alias('r') ->join('user u', 'u.id = r.user_id') diff --git a/server/app/adminapi/lists/notice/NoticeSettingLists.php b/server/app/adminapi/lists/notice/NoticeSettingLists.php index fca337ef68e34e972409e29063a9d79b2dff5729..bb666573ded58848714fe1a394029d39429b4799 100644 --- a/server/app/adminapi/lists/notice/NoticeSettingLists.php +++ b/server/app/adminapi/lists/notice/NoticeSettingLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\notice; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\notice\NoticeSetting; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 通知设置 @@ -27,7 +30,7 @@ class NoticeSettingLists extends BaseAdminDataLists implements ListsSearchInterf { /** * @notes 搜索条件 - * @return \string[][] + * @return string[][] * @author ljj * @date 2022/2/17 2:21 下午 */ @@ -41,9 +44,9 @@ class NoticeSettingLists extends BaseAdminDataLists implements ListsSearchInterf /** * @notes 通知设置列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author ljj * @date 2022/2/16 3:18 下午 */ diff --git a/server/app/adminapi/lists/recharge/RechargeLists.php b/server/app/adminapi/lists/recharge/RechargeLists.php index 05fdc5ce0c648394919e5f2b798c124524359b62..80f17e2c965cc5734f770a01323cc7380e5f9a07 100644 --- a/server/app/adminapi/lists/recharge/RechargeLists.php +++ b/server/app/adminapi/lists/recharge/RechargeLists.php @@ -61,7 +61,7 @@ class RechargeLists extends BaseAdminDataLists implements ListsSearchInterface, /** * @notes 搜索条件 - * @return \string[][] + * @return string[][] * @author 段誉 * @date 2023/2/24 16:08 */ diff --git a/server/app/adminapi/lists/setting/dict/DictDataLists.php b/server/app/adminapi/lists/setting/dict/DictDataLists.php index 3c07a29700f37f29feb5638e18aab59c96a23a5a..27399edda823a2404febbe49fbe335986990787f 100644 --- a/server/app/adminapi/lists/setting/dict/DictDataLists.php +++ b/server/app/adminapi/lists/setting/dict/DictDataLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\setting\dict; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\dict\DictData; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -29,7 +32,7 @@ class DictDataLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2022/6/20 16:29 */ @@ -45,9 +48,9 @@ class DictDataLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/6/20 16:35 */ diff --git a/server/app/adminapi/lists/setting/dict/DictTypeLists.php b/server/app/adminapi/lists/setting/dict/DictTypeLists.php index a0e41edb78ffec47641946090e3c34a0db99448e..a2bf0f162098a59236604cbd417579dce88683ca 100644 --- a/server/app/adminapi/lists/setting/dict/DictTypeLists.php +++ b/server/app/adminapi/lists/setting/dict/DictTypeLists.php @@ -17,6 +17,9 @@ namespace app\adminapi\lists\setting\dict; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\dict\DictType; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -29,7 +32,7 @@ class DictTypeLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author 乔峰 * @date 2022/6/20 15:53 */ @@ -45,9 +48,9 @@ class DictTypeLists extends BaseAdminDataLists implements ListsSearchInterface /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/6/20 15:54 */ diff --git a/server/app/adminapi/lists/setting/pay/PayConfigLists.php b/server/app/adminapi/lists/setting/pay/PayConfigLists.php index f4c3ca9e37ab95ecd49d477588b8454a254cc3fd..38be1c5d5cc9c41986d7717b47a75e4d186f297a 100644 --- a/server/app/adminapi/lists/setting/pay/PayConfigLists.php +++ b/server/app/adminapi/lists/setting/pay/PayConfigLists.php @@ -16,6 +16,9 @@ namespace app\adminapi\lists\setting\pay; use app\adminapi\lists\BaseAdminDataLists; use app\common\model\pay\PayConfig; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 支付配置列表 @@ -28,9 +31,9 @@ class PayConfigLists extends BaseAdminDataLists /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:15 */ diff --git a/server/app/adminapi/lists/setting/system/LogLists.php b/server/app/adminapi/lists/setting/system/LogLists.php index 4ed6ce252527c4242708b533b520bf7bf57ba24e..54f63418aee0c8a68fd14238748579621e868164 100644 --- a/server/app/adminapi/lists/setting/system/LogLists.php +++ b/server/app/adminapi/lists/setting/system/LogLists.php @@ -19,6 +19,9 @@ use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsExcelInterface; use app\common\lists\ListsSearchInterface; use app\common\model\OperationLog; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 日志列表 @@ -29,7 +32,7 @@ class LogLists extends BaseAdminDataLists implements ListsSearchInterface, Lists { /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author ljj * @date 2021/8/3 4:21 下午 */ @@ -44,9 +47,9 @@ class LogLists extends BaseAdminDataLists implements ListsSearchInterface, Lists /** * @notes 查看系统日志列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author ljj * @date 2021/8/3 4:21 下午 */ diff --git a/server/app/adminapi/lists/tools/DataTableLists.php b/server/app/adminapi/lists/tools/DataTableLists.php index 9fd5fb7d817291e3e86e3dbb1443e211d3cadfe4..67887226507fe1a4481f8aa8897d869a941c105f 100644 --- a/server/app/adminapi/lists/tools/DataTableLists.php +++ b/server/app/adminapi/lists/tools/DataTableLists.php @@ -5,6 +5,7 @@ namespace app\adminapi\lists\tools; use app\adminapi\lists\BaseAdminDataLists; +use think\facade\Db; /** * 数据表列表 @@ -29,7 +30,7 @@ class DataTableLists extends BaseAdminDataLists if (!empty($this->params['comment'])) { $sql .= "AND comment LIKE '%" . $this->params['comment'] . "%'"; } - return \think\facade\Db::query($sql); + return Db::query($sql); } diff --git a/server/app/adminapi/lists/tools/GenerateTableLists.php b/server/app/adminapi/lists/tools/GenerateTableLists.php index 58a3650128667d7fcc1f5b9a33fb5a4d190fd43b..31fbe05db03474e0c88fdfd94b778b824625cce0 100644 --- a/server/app/adminapi/lists/tools/GenerateTableLists.php +++ b/server/app/adminapi/lists/tools/GenerateTableLists.php @@ -6,6 +6,9 @@ namespace app\adminapi\lists\tools; use app\adminapi\lists\BaseAdminDataLists; use app\common\lists\ListsSearchInterface; use app\common\model\tools\GenerateTable; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 代码生成所选数据表列表 @@ -17,7 +20,7 @@ class GenerateTableLists extends BaseAdminDataLists implements ListsSearchInterf /** * @notes 设置搜索条件 - * @return \string[][] + * @return string[][] * @author bingo * @date 2022/6/14 10:55 */ @@ -32,9 +35,9 @@ class GenerateTableLists extends BaseAdminDataLists implements ListsSearchInterf /** * @notes 查询列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author bingo * @date 2022/6/14 10:55 */ diff --git a/server/app/adminapi/lists/user/UserLists.php b/server/app/adminapi/lists/user/UserLists.php index 25c2b1a6660c725cc68eb2b2e1536b455b3f1e5c..2641a27c3448f297533f84767961196ebb5c316a 100644 --- a/server/app/adminapi/lists/user/UserLists.php +++ b/server/app/adminapi/lists/user/UserLists.php @@ -8,6 +8,9 @@ use app\adminapi\lists\BaseAdminDataLists; use app\common\enum\user\UserTerminalEnum; use app\common\lists\ListsExcelInterface; use app\common\model\user\User; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class UserLists extends BaseAdminDataLists implements ListsExcelInterface { @@ -27,9 +30,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface /** * @notes 获取用户列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/22 15:50 */ diff --git a/server/app/adminapi/logic/ConfigLogic.php b/server/app/adminapi/logic/ConfigLogic.php index ee3e402925d2ece466fcfafc65b31721b9a690ff..dfb52a52ba0c8f2dd21f68ba06ea7eed6a33441d 100644 --- a/server/app/adminapi/logic/ConfigLogic.php +++ b/server/app/adminapi/logic/ConfigLogic.php @@ -17,6 +17,9 @@ namespace app\adminapi\logic; use app\common\model\dict\DictData; use app\common\service\{FileService, ConfigService}; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 配置类逻辑层 @@ -57,13 +60,13 @@ class ConfigLogic * @notes 根据类型获取字典类型 * @param $type * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/27 19:09 */ - public static function getDictByType($type) + public static function getDictByType($type): array { if (!is_string($type)) { return []; diff --git a/server/app/adminapi/logic/FileLogic.php b/server/app/adminapi/logic/FileLogic.php index 2017d08a6f5a5a3c7645a6aa95e00bd6f36630c3..4e8cc76be9e2085f6ed1917a4fe5744e5aeabbd5 100644 --- a/server/app/adminapi/logic/FileLogic.php +++ b/server/app/adminapi/logic/FileLogic.php @@ -34,7 +34,7 @@ class FileLogic extends BaseLogic * @author 乔峰 * @date 2021/7/28 15:29 */ - public static function move($params) + public static function move($params): void { (new File())->whereIn('id', $params['ids']) ->update([ diff --git a/server/app/adminapi/logic/LoginLogic.php b/server/app/adminapi/logic/LoginLogic.php index acbfc7a7493577597fea56b02a985f5d72e2424f..866b03d219981d918edaa15dfa3c4869a9fcc576 100644 --- a/server/app/adminapi/logic/LoginLogic.php +++ b/server/app/adminapi/logic/LoginLogic.php @@ -18,6 +18,9 @@ use app\common\logic\BaseLogic; use app\common\model\auth\Admin; use app\adminapi\service\AdminTokenService; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use Webman\Config; /** @@ -31,13 +34,13 @@ class LoginLogic extends BaseLogic * @notes 管理员账号登录 * @param $params * @return false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/6/30 17:00 */ - public function login($params) + public function login($params): mixed { $time = time(); $admin = Admin::where('account', '=', $params['account'])->find(); @@ -66,13 +69,13 @@ class LoginLogic extends BaseLogic * @notes 退出登录 * @param $adminInfo * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/5 14:34 */ - public function logout($adminInfo) + public function logout($adminInfo): bool { //token不存在,不注销 if (!isset($adminInfo['token'])) { diff --git a/server/app/adminapi/logic/WorkbenchLogic.php b/server/app/adminapi/logic/WorkbenchLogic.php index 94ee46fe2337807a3ba0abfebe66db170c8c04a2..e48964ed1b53de3724c7c330a89161dd4f82f11c 100644 --- a/server/app/adminapi/logic/WorkbenchLogic.php +++ b/server/app/adminapi/logic/WorkbenchLogic.php @@ -34,7 +34,7 @@ class WorkbenchLogic extends BaseLogic * @author 乔峰 * @date 2021/12/29 15:58 */ - public static function index() + public static function index(): array { return [ // 版本信息 @@ -179,7 +179,7 @@ class WorkbenchLogic extends BaseLogic * @author 乔峰 * @date 2022/7/18 11:18 */ - public static function support() + public static function support(): array { return [ [ diff --git a/server/app/adminapi/logic/article/ArticleCateLogic.php b/server/app/adminapi/logic/article/ArticleCateLogic.php index 366b8aaac55d586f71023421de82b140cbeb1928..fa1e9ae9d4a24497a029a612e3d7f78545562ec8 100644 --- a/server/app/adminapi/logic/article/ArticleCateLogic.php +++ b/server/app/adminapi/logic/article/ArticleCateLogic.php @@ -17,6 +17,10 @@ namespace app\adminapi\logic\article; use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\model\article\ArticleCate; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 资讯分类管理逻辑 @@ -33,7 +37,7 @@ class ArticleCateLogic extends BaseLogic * @author heshihu * @date 2022/2/18 10:17 */ - public static function add(array $params) + public static function add(array $params): void { ArticleCate::create([ 'name' => $params['name'], @@ -60,7 +64,7 @@ class ArticleCateLogic extends BaseLogic 'sort' => $params['sort'] ?? 0 ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -73,7 +77,7 @@ class ArticleCateLogic extends BaseLogic * @author heshihu * @date 2022/2/21 17:52 */ - public static function delete(array $params) + public static function delete(array $params): void { ArticleCate::destroy($params['id']); } @@ -97,7 +101,7 @@ class ArticleCateLogic extends BaseLogic * @author heshihu * @date 2022/2/21 18:04 */ - public static function updateStatus(array $params) + public static function updateStatus(array $params): bool { ArticleCate::update([ 'id' => $params['id'], @@ -110,13 +114,13 @@ class ArticleCateLogic extends BaseLogic /** * @notes 文章分类数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:53 */ - public static function getAllData() + public static function getAllData(): array { return ArticleCate::where(['is_show' => YesNoEnum::YES]) ->order(['sort' => 'desc', 'id' => 'desc']) diff --git a/server/app/adminapi/logic/article/ArticleLogic.php b/server/app/adminapi/logic/article/ArticleLogic.php index 9664866b78ed5002dddcd00de41c2f6bc52c4f10..59105e59ed373392c9f327f972f360fda1d5b95a 100644 --- a/server/app/adminapi/logic/article/ArticleLogic.php +++ b/server/app/adminapi/logic/article/ArticleLogic.php @@ -17,6 +17,7 @@ namespace app\adminapi\logic\article; use app\common\logic\BaseLogic; use app\common\model\article\Article; use app\common\service\FileService; +use Exception; /** * 资讯管理逻辑 @@ -32,7 +33,7 @@ class ArticleLogic extends BaseLogic * @author heshihu * @date 2022/2/22 9:57 */ - public static function add(array $params) + public static function add(array $params): void { Article::create([ 'title' => $params['title'], @@ -73,7 +74,7 @@ class ArticleLogic extends BaseLogic 'content' => $params['content'] ?? '', ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -86,7 +87,7 @@ class ArticleLogic extends BaseLogic * @author heshihu * @date 2022/2/22 10:17 */ - public static function delete(array $params) + public static function delete(array $params): void { Article::destroy($params['id']); } @@ -110,7 +111,7 @@ class ArticleLogic extends BaseLogic * @author heshihu * @date 2022/2/22 10:18 */ - public static function updateStatus(array $params) + public static function updateStatus(array $params): bool { Article::update([ 'id' => $params['id'], diff --git a/server/app/adminapi/logic/auth/AdminLogic.php b/server/app/adminapi/logic/auth/AdminLogic.php index 90cd8629553826806b357ebdfb1111323ea142ea..cfb3c969c950bfd2fb346a58fae304956e5e4cda 100644 --- a/server/app/adminapi/logic/auth/AdminLogic.php +++ b/server/app/adminapi/logic/auth/AdminLogic.php @@ -24,6 +24,10 @@ use app\common\model\auth\AdminRole; use app\common\model\auth\AdminSession; use app\common\cache\AdminTokenCache; use app\common\service\FileService; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\facade\Db; use Webman\Config; @@ -38,10 +42,11 @@ class AdminLogic extends BaseLogic /** * @notes 添加管理员 * @param array $params + * @return bool * @author 乔峰 * @date 2021/12/29 10:23 */ - public static function add(array $params) + public static function add(array $params): bool { Db::startTrans(); try { @@ -68,7 +73,7 @@ class AdminLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; @@ -134,7 +139,7 @@ class AdminLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; @@ -155,7 +160,7 @@ class AdminLogic extends BaseLogic try { $admin = Admin::findOrEmpty($params['id']); if ($admin->root == YesNoEnum::YES) { - throw new \Exception("超级管理员不允许被删除"); + throw new Exception("超级管理员不允许被删除"); } Admin::destroy($params['id']); @@ -173,7 +178,7 @@ class AdminLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; @@ -185,9 +190,9 @@ class AdminLogic extends BaseLogic * @notes 过期token * @param $token * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 10:46 */ @@ -240,11 +245,11 @@ class AdminLogic extends BaseLogic /** * @notes 编辑超级管理员 * @param $params - * @return Admin + * @return int * @author 乔峰 * @date 2022/4/8 17:54 */ - public static function editSelf($params) + public static function editSelf($params): int { $data = [ 'id' => $params['admin_id'], @@ -264,11 +269,11 @@ class AdminLogic extends BaseLogic * @notes 新增角色 * @param $adminId * @param $roleIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:23 */ - public static function insertRole($adminId, $roleIds) + public static function insertRole($adminId, $roleIds): void { if (!empty($roleIds)) { // 角色 @@ -288,11 +293,11 @@ class AdminLogic extends BaseLogic * @notes 新增部门 * @param $adminId * @param $deptIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:22 */ - public static function insertDept($adminId, $deptIds) + public static function insertDept($adminId, $deptIds): void { // 部门 if (!empty($deptIds)) { @@ -312,11 +317,11 @@ class AdminLogic extends BaseLogic * @notes 新增岗位 * @param $adminId * @param $jobsIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:22 */ - public static function insertJobs($adminId, $jobsIds) + public static function insertJobs($adminId, $jobsIds): void { // 岗位 if (!empty($jobsIds)) { diff --git a/server/app/adminapi/logic/auth/AuthLogic.php b/server/app/adminapi/logic/auth/AuthLogic.php index 7895512365cdef8a2139c66746e01ab54414626b..9f0a3fd57082cc384d38258fa7c7dc6eaded4d79 100644 --- a/server/app/adminapi/logic/auth/AuthLogic.php +++ b/server/app/adminapi/logic/auth/AuthLogic.php @@ -34,7 +34,7 @@ class AuthLogic * @author 乔峰 * @date 2022/7/1 11:55 */ - public static function getAllAuth() + public static function getAllAuth(): mixed { return SystemMenu::distinct(true) ->where([ @@ -52,7 +52,7 @@ class AuthLogic * @author 乔峰 * @date 2022/7/1 16:10 */ - public static function getBtnAuthByRoleId($admin) + public static function getBtnAuthByRoleId($admin): mixed { if ($admin['root']) { return ['*']; diff --git a/server/app/adminapi/logic/auth/MenuLogic.php b/server/app/adminapi/logic/auth/MenuLogic.php index 8678bb6102f60b8b693c77c5b468fc77fbdf08cc..8b9bbb5f8939ef08e272cefe1acbece54246f462 100644 --- a/server/app/adminapi/logic/auth/MenuLogic.php +++ b/server/app/adminapi/logic/auth/MenuLogic.php @@ -20,6 +20,10 @@ use app\common\logic\BaseLogic; use app\common\model\auth\Admin; use app\common\model\auth\SystemMenu; use app\common\model\auth\SystemRoleMenu; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; +use think\Model; /** @@ -35,13 +39,13 @@ class MenuLogic extends BaseLogic * @notes 获取管理员对应的角色菜单 * @param $adminId * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/7/1 10:50 */ - public static function getMenuByAdminId($adminId) + public static function getMenuByAdminId($adminId): array { $admin = Admin::findOrEmpty($adminId); @@ -56,7 +60,7 @@ class MenuLogic extends BaseLogic $menu = SystemMenu::where($where) ->order(['sort' => 'desc', 'id' => 'asc']) - ->select(); + ->select()->toArray(); return linear_to_tree($menu, 'children'); } @@ -65,11 +69,11 @@ class MenuLogic extends BaseLogic /** * @notes 添加菜单 * @param array $params - * @return SystemMenu|\think\Model + * @return SystemMenu|Model * @author 乔峰 * @date 2022/6/30 10:06 */ - public static function add(array $params) + public static function add(array $params): SystemMenu|Model { return SystemMenu::create([ 'pid' => $params['pid'], @@ -96,7 +100,7 @@ class MenuLogic extends BaseLogic * @author 乔峰 * @date 2022/6/30 10:07 */ - public static function edit(array $params) + public static function edit(array $params): SystemMenu { return SystemMenu::update([ 'id' => $params['id'], @@ -124,7 +128,7 @@ class MenuLogic extends BaseLogic * @author 乔峰 * @date 2022/6/30 9:54 */ - public static function detail($params) + public static function detail($params): array { return SystemMenu::findOrEmpty($params['id'])->toArray(); } @@ -136,7 +140,7 @@ class MenuLogic extends BaseLogic * @author 乔峰 * @date 2022/6/30 9:47 */ - public static function delete($params) + public static function delete($params): void { // 删除菜单 SystemMenu::destroy($params['id']); @@ -148,11 +152,11 @@ class MenuLogic extends BaseLogic /** * @notes 更新状态 * @param array $params - * @return SystemMenu + * @return int * @author 乔峰 * @date 2022/7/6 17:02 */ - public static function updateStatus(array $params) + public static function updateStatus(array $params): int { return SystemMenu::update([ 'id' => $params['id'], @@ -164,13 +168,13 @@ class MenuLogic extends BaseLogic /** * @notes 全部数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 11:03 */ - public static function getAllData() + public static function getAllData(): array { $data = SystemMenu::where(['is_disable' => YesNoEnum::NO]) ->field('id,pid,name') diff --git a/server/app/adminapi/logic/auth/RoleLogic.php b/server/app/adminapi/logic/auth/RoleLogic.php index 84f8282a96f601e25589f0622dcdbe23967c4c69..581addacae91745780f4f1da66ddcd45937c2d93 100644 --- a/server/app/adminapi/logic/auth/RoleLogic.php +++ b/server/app/adminapi/logic/auth/RoleLogic.php @@ -20,6 +20,10 @@ use app\common\{ logic\BaseLogic, model\auth\SystemRoleMenu }; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\facade\Db; @@ -64,7 +68,7 @@ class RoleLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -108,7 +112,7 @@ class RoleLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -122,7 +126,7 @@ class RoleLogic extends BaseLogic * @author 乔峰 * @date 2021/12/29 14:16 */ - public static function delete(int $id) + public static function delete(int $id): bool { SystemRole::destroy(['id' => $id]); (new AdminAuthCache())->deleteTag(); @@ -134,9 +138,9 @@ class RoleLogic extends BaseLogic * @notes 角色详情 * @param int $id * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 14:17 */ @@ -153,13 +157,13 @@ class RoleLogic extends BaseLogic /** * @notes 角色数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:39 */ - public static function getAllData() + public static function getAllData(): array { return SystemRole::order(['sort' => 'desc', 'id' => 'desc']) ->select() diff --git a/server/app/adminapi/logic/channel/AppSettingLogic.php b/server/app/adminapi/logic/channel/AppSettingLogic.php index 978cc01ee8da7005062081c0c5767879545b826c..9bc2811c369d68d58d21584aa559086aea03668f 100644 --- a/server/app/adminapi/logic/channel/AppSettingLogic.php +++ b/server/app/adminapi/logic/channel/AppSettingLogic.php @@ -30,7 +30,7 @@ class AppSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 10:25 */ - public static function getConfig() + public static function getConfig(): array { $config = [ 'ios_download_url' => ConfigService::get('app', 'ios_download_url', ''), @@ -47,7 +47,7 @@ class AppSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 10:26 */ - public static function setConfig($params) + public static function setConfig($params): void { ConfigService::set('app', 'ios_download_url', $params['ios_download_url'] ?? ''); ConfigService::set('app', 'android_download_url', $params['android_download_url'] ?? ''); diff --git a/server/app/adminapi/logic/channel/MnpSettingsLogic.php b/server/app/adminapi/logic/channel/MnpSettingsLogic.php index 2e348e975a09c145a8ceb2f1801c3cabb8bfc7e6..6697e7271ed47571ddb095602e20ba0fb9aeeafd 100644 --- a/server/app/adminapi/logic/channel/MnpSettingsLogic.php +++ b/server/app/adminapi/logic/channel/MnpSettingsLogic.php @@ -31,9 +31,9 @@ class MnpSettingsLogic extends BaseLogic * @author ljj * @date 2022/2/16 9:38 上午 */ - public function getConfig() + public function getConfig(): array { - $domainName = $_SERVER['SERVER_NAME']; + $domainName = str_replace(['http://','https://'],'',getAgreementHost()); $qrCode = ConfigService::get('mnp_setting', 'qr_code', ''); $qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode); $config = [ @@ -59,7 +59,7 @@ class MnpSettingsLogic extends BaseLogic * @author ljj * @date 2022/2/16 9:51 上午 */ - public function setConfig($params) + public function setConfig($params): void { $qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : ''; diff --git a/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php b/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php index 15c0d2ff5f45bf4dd9b22cc067f114e6bc9f72c1..de332c175a69618b6841bd5ace0d5b8952f01af7 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php @@ -18,6 +18,8 @@ use app\common\enum\OfficialAccountEnum; use app\common\logic\BaseLogic; use app\common\service\ConfigService; use app\common\service\wechat\WeChatOaService; +use Exception; +use GuzzleHttp\Exception\GuzzleException; /** * 微信公众号菜单逻辑层 @@ -33,13 +35,13 @@ class OfficialAccountMenuLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:43 */ - public static function save($params) + public static function save($params): bool { try { self::checkMenu($params); ConfigService::set('oa_setting', 'menu', $params); return true; - } catch (\Exception $e) { + } catch (Exception $e) { OfficialAccountMenuLogic::setError($e->getMessage()); return false; } @@ -49,41 +51,41 @@ class OfficialAccountMenuLogic extends BaseLogic /** * @notes 一级菜单校验 * @param $menu - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/3/29 10:55 */ - public static function checkMenu($menu) + public static function checkMenu($menu): void { if (empty($menu) || !is_array($menu)) { - throw new \Exception('请设置正确格式菜单'); + throw new Exception('请设置正确格式菜单'); } if (count($menu) > 3) { - throw new \Exception('一级菜单超出限制(最多3个)'); + throw new Exception('一级菜单超出限制(最多3个)'); } foreach ($menu as $item) { if (!is_array($item)) { - throw new \Exception('一级菜单项须为数组格式'); + throw new Exception('一级菜单项须为数组格式'); } if (empty($item['name'])) { - throw new \Exception('请输入一级菜单名称'); + throw new Exception('请输入一级菜单名称'); } if (false == $item['has_menu']) { if (empty($item['type'])) { - throw new \Exception('一级菜单未选择菜单类型'); + throw new Exception('一级菜单未选择菜单类型'); } if (!in_array($item['type'], OfficialAccountEnum::MENU_TYPE)) { - throw new \Exception('一级菜单类型错误'); + throw new Exception('一级菜单类型错误'); } self::checkType($item); } if (true == $item['has_menu'] && empty($item['sub_button'])) { - throw new \Exception('请配置子菜单'); + throw new Exception('请配置子菜单'); } if (!empty($item['sub_button'])) { @@ -96,31 +98,31 @@ class OfficialAccountMenuLogic extends BaseLogic /** * @notes 二级菜单校验 * @param $subButtion - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/3/29 10:55 */ - public static function checkSubButton($subButtion) + public static function checkSubButton($subButtion): void { if (!is_array($subButtion)) { - throw new \Exception('二级菜单须为数组格式'); + throw new Exception('二级菜单须为数组格式'); } if (count($subButtion) > 5) { - throw new \Exception('二级菜单超出限制(最多5个)'); + throw new Exception('二级菜单超出限制(最多5个)'); } foreach ($subButtion as $subItem) { if (!is_array($subItem)) { - throw new \Exception('二级菜单项须为数组'); + throw new Exception('二级菜单项须为数组'); } if (empty($subItem['name'])) { - throw new \Exception('请输入二级菜单名称'); + throw new Exception('请输入二级菜单名称'); } if (empty($subItem['type']) || !in_array($subItem['type'], OfficialAccountEnum::MENU_TYPE)) { - throw new \Exception('二级未选择菜单类型或菜单类型错误'); + throw new Exception('二级未选择菜单类型或菜单类型错误'); } self::checkType($subItem); @@ -131,35 +133,35 @@ class OfficialAccountMenuLogic extends BaseLogic /** * @notes 菜单类型校验 * @param $item - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/3/29 10:55 */ - public static function checkType($item) + public static function checkType($item): void { switch ($item['type']) { // 关键字 case 'click': if (empty($item['key'])) { - throw new \Exception('请输入关键字'); + throw new Exception('请输入关键字'); } break; // 跳转网页链接 case 'view': if (empty($item['url'])) { - throw new \Exception('请输入网页链接'); + throw new Exception('请输入网页链接'); } break; // 小程序 case 'miniprogram': if (empty($item['url'])) { - throw new \Exception('请输入网页链接'); + throw new Exception('请输入网页链接'); } if (empty($item['appid'])) { - throw new \Exception('请输入appid'); + throw new Exception('请输入appid'); } if (empty($item['pagepath'])) { - throw new \Exception('请输入小程序路径'); + throw new Exception('请输入小程序路径'); } break; } @@ -169,11 +171,11 @@ class OfficialAccountMenuLogic extends BaseLogic * @notes 保存发布菜单 * @param $params * @return bool - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/3/29 10:55 */ - public static function saveAndPublish($params) + public static function saveAndPublish($params): bool { try { self::checkMenu($params); @@ -187,7 +189,7 @@ class OfficialAccountMenuLogic extends BaseLogic self::setError('保存发布菜单失败' . json_encode($result)); return false; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -200,7 +202,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:56 */ - public static function detail() + public static function detail(): mixed { $data = ConfigService::get('oa_setting', 'menu', []); diff --git a/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php b/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php index 14d2e50205c3d5df2c13e0353b10461a4a8a9bf5..371040adc2307890d3698c26765a36967d07de34 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php @@ -20,7 +20,14 @@ use app\common\logic\BaseLogic; use app\common\model\channel\OfficialAccountReply; use app\common\service\wechat\WeChatConfigService; use app\common\service\wechat\WeChatOaService; - +use Closure; +use EasyWeChat\Kernel\Exceptions\BadRequestException; +use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; +use EasyWeChat\Kernel\Exceptions\RuntimeException; +use Exception; +use Psr\Http\Message\ResponseInterface; +use ReflectionException; +use Throwable; /** @@ -37,12 +44,12 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:57 */ - public static function add($params) + public static function add($params): bool { try { // 关键字回复排序值须大于0 if ($params['reply_type'] == OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['sort'] <= 0) { - throw new \Exception('排序值须大于0'); + throw new Exception('排序值须大于0'); } if ($params['reply_type'] != OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['status']) { // 非关键词回复只能有一条记录处于启用状态,所以将该回复类型下的已有记录置为禁用状态 @@ -50,7 +57,7 @@ class OfficialAccountReplyLogic extends BaseLogic } OfficialAccountReply::create($params); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -64,7 +71,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:00 */ - public static function detail($params) + public static function detail($params): array { $field = 'id,name,keyword,reply_type,matching_type,content_type,content,status,sort'; $field .= ',reply_type as reply_type_desc, matching_type as matching_type_desc, content_type as content_type_desc, status as status_desc'; @@ -79,12 +86,12 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:01 */ - public static function edit($params) + public static function edit($params): bool { try { // 关键字回复排序值须大于0 if ($params['reply_type'] == OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['sort'] <= 0) { - throw new \Exception('排序值须大于0'); + throw new Exception('排序值须大于0'); } if ($params['reply_type'] != OfficialAccountEnum::REPLY_TYPE_KEYWORD && $params['status']) { // 非关键词回复只能有一条记录处于启用状态,所以将该回复类型下的已有记录置为禁用状态 @@ -92,7 +99,7 @@ class OfficialAccountReplyLogic extends BaseLogic } OfficialAccountReply::update($params); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -105,7 +112,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:01 */ - public static function delete($params) + public static function delete($params): void { OfficialAccountReply::destroy($params['id']); } @@ -117,7 +124,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:01 */ - public static function sort($params) + public static function sort($params): void { $params['sort'] = $params['new_sort']; OfficialAccountReply::update($params); @@ -130,7 +137,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:01 */ - public static function status($params) + public static function status($params): void { $reply = OfficialAccountReply::findOrEmpty($params['id']); $reply->status = !$reply->status; @@ -140,12 +147,12 @@ class OfficialAccountReplyLogic extends BaseLogic /** * @notes 微信公众号回调 - * @return \Psr\Http\Message\ResponseInterface|void - * @throws \EasyWeChat\Kernel\Exceptions\BadRequestException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException - * @throws \ReflectionException - * @throws \Throwable + * @return ResponseInterface|void + * @throws BadRequestException + * @throws InvalidArgumentException + * @throws RuntimeException + * @throws ReflectionException + * @throws Throwable * @author 段誉 * @date 2023/2/27 14:38\ */ @@ -153,7 +160,7 @@ class OfficialAccountReplyLogic extends BaseLogic { $server = (new WeChatOaService())->getServer(); // 事件 - $server->addMessageListener(OfficialAccountEnum::MSG_TYPE_EVENT, function ($message, \Closure $next) { + $server->addMessageListener(OfficialAccountEnum::MSG_TYPE_EVENT, function ($message, Closure $next) { switch ($message['Event']) { case OfficialAccountEnum::EVENT_SUBSCRIBE: // 关注事件 $replyContent = OfficialAccountReply::where([ @@ -175,7 +182,7 @@ class OfficialAccountReplyLogic extends BaseLogic }); // 文本 - $server->addMessageListener(OfficialAccountEnum::MSG_TYPE_TEXT, function ($message, \Closure $next) { + $server->addMessageListener(OfficialAccountEnum::MSG_TYPE_TEXT, function ($message, Closure $next) { $replyList = OfficialAccountReply::where([ 'reply_type' => OfficialAccountEnum::REPLY_TYPE_KEYWORD, 'status' => YesNoEnum::YES @@ -217,7 +224,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2023/2/27 14:36 */ - public static function getDefaultReply() + public static function getDefaultReply(): mixed { return OfficialAccountReply::where([ 'reply_type' => OfficialAccountEnum::REPLY_TYPE_DEFAULT, diff --git a/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php b/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php index 3d0b8f203602fbfd0d05bdb6b77c1b3e678fce9d..fdfdca5adba720772491b1b34996a0128770d799 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php @@ -31,9 +31,9 @@ class OfficialAccountSettingLogic extends BaseLogic * @author ljj * @date 2022/2/16 10:08 上午 */ - public function getConfig() + public function getConfig(): array { - $domainName = $_SERVER['SERVER_NAME']; + $domainName = str_replace(['http://','https://'],'',getAgreementHost()); $qrCode = ConfigService::get('oa_setting', 'qr_code', ''); $qrCode = empty($qrCode) ? $qrCode : FileService::getFileUrl($qrCode); $config = [ @@ -60,7 +60,7 @@ class OfficialAccountSettingLogic extends BaseLogic * @author ljj * @date 2022/2/16 10:08 上午 */ - public function setConfig($params) + public function setConfig($params): void { $qrCode = isset($params['qr_code']) ? FileService::setFileUrl($params['qr_code']) : ''; diff --git a/server/app/adminapi/logic/channel/OpenSettingLogic.php b/server/app/adminapi/logic/channel/OpenSettingLogic.php index 254151947fa6a1c3c2f08ce92cbd93e5ad256cd2..3e6566f2e6b2924ec6e99514d5a4b95689583a8d 100644 --- a/server/app/adminapi/logic/channel/OpenSettingLogic.php +++ b/server/app/adminapi/logic/channel/OpenSettingLogic.php @@ -30,7 +30,7 @@ class OpenSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:03 */ - public static function getConfig() + public static function getConfig(): array { $config = [ 'app_id' => ConfigService::get('open_platform', 'app_id', ''), @@ -47,7 +47,7 @@ class OpenSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:03 */ - public static function setConfig($params) + public static function setConfig($params): void { ConfigService::set('open_platform', 'app_id', $params['app_id'] ?? ''); ConfigService::set('open_platform', 'app_secret', $params['app_secret'] ?? ''); diff --git a/server/app/adminapi/logic/channel/WebPageSettingLogic.php b/server/app/adminapi/logic/channel/WebPageSettingLogic.php index d6242f6a7431fb3b6d422b309d7d3a3bcb5bea25..d91d473374031fdfdf49cdfb55898ef5081ce54b 100644 --- a/server/app/adminapi/logic/channel/WebPageSettingLogic.php +++ b/server/app/adminapi/logic/channel/WebPageSettingLogic.php @@ -29,7 +29,7 @@ class WebPageSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 10:34 */ - public static function getConfig() + public static function getConfig(): array { $config = [ // 渠道状态 0-关闭 1-开启 @@ -38,8 +38,9 @@ class WebPageSettingLogic extends BaseLogic 'page_status' => ConfigService::get('web_page', 'page_status', 0), // 自定义链接 'page_url' => ConfigService::get('web_page', 'page_url', ''), - 'url' => request()->domain() . '/mobile' + 'url' => getAgreementHost() . '/mobile' ]; + return $config; } @@ -50,7 +51,7 @@ class WebPageSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 10:34 */ - public static function setConfig($params) + public static function setConfig($params): void { ConfigService::set('web_page', 'status', $params['status']); ConfigService::set('web_page', 'page_status', $params['page_status']); diff --git a/server/app/adminapi/logic/crontab/CrontabLogic.php b/server/app/adminapi/logic/crontab/CrontabLogic.php index cefd19ff11fbcba3c7e04f9255c5c583d6eae984..1132c7e856d2d5204d8beed93041ec8c8b49a91d 100644 --- a/server/app/adminapi/logic/crontab/CrontabLogic.php +++ b/server/app/adminapi/logic/crontab/CrontabLogic.php @@ -17,6 +17,7 @@ use app\common\enum\CrontabEnum; use app\common\logic\BaseLogic; use app\common\model\Crontab; use Cron\CronExpression; +use Exception; /** * 定时任务逻辑层 @@ -32,7 +33,7 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:41 */ - public static function add($params) + public static function add($params): bool { try { $params['remark'] = $params['remark'] ?? ''; @@ -42,7 +43,7 @@ class CrontabLogic extends BaseLogic Crontab::create($params); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -56,7 +57,7 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:41 */ - public static function detail($params) + public static function detail($params): array { $field = 'id,name,type,type as type_desc,command,params,status,status as status_desc,expression,remark'; $crontab = Crontab::field($field)->findOrEmpty($params['id']); @@ -74,7 +75,7 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:42 */ - public static function edit($params) + public static function edit($params): bool { try { $params['remark'] = $params['remark'] ?? ''; @@ -83,7 +84,7 @@ class CrontabLogic extends BaseLogic Crontab::update($params); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -97,13 +98,13 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:42 */ - public static function delete($params) + public static function delete($params): bool { try { Crontab::destroy($params['id']); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -117,12 +118,12 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:42 */ - public static function operate($params) + public static function operate($params): bool { try { $crontab = Crontab::findOrEmpty($params['id']); if ($crontab->isEmpty()) { - throw new \Exception('定时任务不存在'); + throw new Exception('定时任务不存在'); } switch ($params['operate']) { case 'start'; @@ -135,7 +136,7 @@ class CrontabLogic extends BaseLogic $crontab->save(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -149,7 +150,7 @@ class CrontabLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 14:42 */ - public static function expression($params) + public static function expression($params): array|string { try { $cron = new CronExpression($params['expression']); @@ -162,7 +163,7 @@ class CrontabLogic extends BaseLogic } $lists[] = ['time' => 'x', 'date' => '……']; return $lists; - } catch (\Exception $e) { + } catch (Exception $e) { return $e->getMessage(); } } diff --git a/server/app/adminapi/logic/decorate/DecorateDataLogic.php b/server/app/adminapi/logic/decorate/DecorateDataLogic.php index 7447a0414a9024b36b5fc5ccb20626f06d740fce..c9fc4593ed1ec3f41b73ecc70f1a1a0ca0c37b77 100644 --- a/server/app/adminapi/logic/decorate/DecorateDataLogic.php +++ b/server/app/adminapi/logic/decorate/DecorateDataLogic.php @@ -15,6 +15,9 @@ namespace app\adminapi\logic\decorate; use app\common\logic\BaseLogic; use app\common\model\article\Article; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -29,13 +32,13 @@ class DecorateDataLogic extends BaseLogic * @notes 获取文章列表 * @param $limit * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/22 16:49 */ - public static function getArticleLists($limit) + public static function getArticleLists($limit): array { $field = 'id,title,desc,abstract,image,author,content, click_virtual,click_actual,create_time'; diff --git a/server/app/adminapi/logic/decorate/DecoratePageLogic.php b/server/app/adminapi/logic/decorate/DecoratePageLogic.php index efd632b9685946c658e452d42a304b49843e17fb..7c7276d57f0e52ed81c1e048a6aa03a6398fbbf8 100644 --- a/server/app/adminapi/logic/decorate/DecoratePageLogic.php +++ b/server/app/adminapi/logic/decorate/DecoratePageLogic.php @@ -34,7 +34,7 @@ class DecoratePageLogic extends BaseLogic * @author 乔峰 * @date 2022/9/14 18:41 */ - public static function getDetail($id) + public static function getDetail($id): array { return DecoratePage::findOrEmpty($id)->toArray(); } @@ -47,7 +47,7 @@ class DecoratePageLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 9:37 */ - public static function save($params) + public static function save($params): bool { $pageData = DecoratePage::where(['id' => $params['id']])->findOrEmpty(); if ($pageData->isEmpty()) { diff --git a/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php b/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php index 49e0acb70b2e88b4f285a8d294b49fd00fbfc8e8..efb4c160583312780decdbbd5c152ec90f9feade 100644 --- a/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php +++ b/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php @@ -17,6 +17,10 @@ use app\common\logic\BaseLogic; use app\common\model\decorate\DecorateTabbar; use app\common\service\ConfigService; use app\common\service\FileService; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -30,9 +34,9 @@ class DecorateTabbarLogic extends BaseLogic /** * @notes 获取底部导航详情 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/7 16:58 */ @@ -48,7 +52,7 @@ class DecorateTabbarLogic extends BaseLogic * @notes 底部导航保存 * @param $params * @return bool - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/9/7 17:19 */ diff --git a/server/app/adminapi/logic/dept/DeptLogic.php b/server/app/adminapi/logic/dept/DeptLogic.php index ebe015de13a586757243f17bb477e2f1dc680328..691b1269b1ba1b61458ccef9d310cf585c54fb77 100644 --- a/server/app/adminapi/logic/dept/DeptLogic.php +++ b/server/app/adminapi/logic/dept/DeptLogic.php @@ -17,6 +17,10 @@ namespace app\adminapi\logic\dept; use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\model\dept\Dept; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -31,13 +35,13 @@ class DeptLogic extends BaseLogic * @notes 部门列表 * @param $params * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/5/30 15:44 */ - public static function lists($params) + public static function lists($params): array { $where = []; if (!empty($params['name'])) { @@ -69,7 +73,7 @@ class DeptLogic extends BaseLogic * @author 乔峰 * @date 2022/5/30 15:44 */ - public static function getTree($array, $pid = 0, $level = 0) + public static function getTree($array, $pid = 0, $level = 0): array { $list = []; foreach ($array as $key => $item) { @@ -86,13 +90,13 @@ class DeptLogic extends BaseLogic /** * @notes 上级部门 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/5/26 18:36 */ - public static function leaderDept() + public static function leaderDept(): array { $lists = Dept::field(['id', 'name'])->where(['status' => 1]) ->order(['sort' => 'desc', 'id' => 'desc']) @@ -108,7 +112,7 @@ class DeptLogic extends BaseLogic * @author 乔峰 * @date 2022/5/25 18:20 */ - public static function add(array $params) + public static function add(array $params): void { Dept::create([ 'pid' => $params['pid'], @@ -147,7 +151,7 @@ class DeptLogic extends BaseLogic 'sort' => $params['sort'] ?? 0 ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -160,7 +164,7 @@ class DeptLogic extends BaseLogic * @author 乔峰 * @date 2022/5/25 18:40 */ - public static function delete(array $params) + public static function delete(array $params): void { Dept::destroy($params['id']); } @@ -182,13 +186,13 @@ class DeptLogic extends BaseLogic /** * @notes 部门数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:19 */ - public static function getAllData() + public static function getAllData(): array { $data = Dept::where(['status' => YesNoEnum::YES]) ->order(['sort' => 'desc', 'id' => 'desc']) diff --git a/server/app/adminapi/logic/dept/JobsLogic.php b/server/app/adminapi/logic/dept/JobsLogic.php index debb403dce8e007a8e4db303aeba88da86e576aa..e15a0fa3c7a994b494936b6cea361c435f341ef7 100644 --- a/server/app/adminapi/logic/dept/JobsLogic.php +++ b/server/app/adminapi/logic/dept/JobsLogic.php @@ -17,6 +17,10 @@ namespace app\adminapi\logic\dept; use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\model\dept\Jobs; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -34,7 +38,7 @@ class JobsLogic extends BaseLogic * @author 乔峰 * @date 2022/5/26 9:58 */ - public static function add(array $params) + public static function add(array $params): void { Jobs::create([ 'name' => $params['name'], @@ -65,7 +69,7 @@ class JobsLogic extends BaseLogic 'remark' => $params['remark'] ?? '', ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -78,7 +82,7 @@ class JobsLogic extends BaseLogic * @author 乔峰 * @date 2022/5/26 9:59 */ - public static function delete(array $params) + public static function delete(array $params): void { Jobs::destroy($params['id']); } @@ -100,13 +104,13 @@ class JobsLogic extends BaseLogic /** * @notes 岗位数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:30 */ - public static function getAllData() + public static function getAllData(): array { return Jobs::where(['status' => YesNoEnum::YES]) ->order(['sort' => 'desc', 'id' => 'desc']) diff --git a/server/app/adminapi/logic/finance/RefundLogic.php b/server/app/adminapi/logic/finance/RefundLogic.php index 9a8a144308687bc8c0dd61e051e5e40314e92eea..424eb5fb388e4d77bab1f90ed80f79fb64e8b634 100644 --- a/server/app/adminapi/logic/finance/RefundLogic.php +++ b/server/app/adminapi/logic/finance/RefundLogic.php @@ -19,6 +19,9 @@ use app\common\enum\RefundEnum; use app\common\logic\BaseLogic; use app\common\model\refund\RefundLog; use app\common\model\refund\RefundRecord; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -32,13 +35,13 @@ class RefundLogic extends BaseLogic /** * @notes 退款统计 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/3/3 12:09 */ - public static function stat() + public static function stat(): array { $records = RefundRecord::select()->toArray(); @@ -75,13 +78,13 @@ class RefundLogic extends BaseLogic * @notes 退款日志 * @param $recordId * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/3/3 14:25 */ - public static function refundLog($recordId) + public static function refundLog($recordId): array { return (new RefundLog()) ->order(['id' => 'desc']) diff --git a/server/app/adminapi/logic/notice/NoticeLogic.php b/server/app/adminapi/logic/notice/NoticeLogic.php index cf1936b717b7c79d870682877d3ffd3a65ac7b2e..b9c1a4ad7f167a24768d9143432d25b4a58ba701 100644 --- a/server/app/adminapi/logic/notice/NoticeLogic.php +++ b/server/app/adminapi/logic/notice/NoticeLogic.php @@ -17,6 +17,7 @@ namespace app\adminapi\logic\notice; use app\common\enum\notice\NoticeEnum; use app\common\logic\BaseLogic; use app\common\model\notice\NoticeSetting; +use Exception; /** * 通知逻辑层 @@ -33,7 +34,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:34 */ - public static function detail($params) + public static function detail($params): array { $field = 'id,type,scene_id,scene_name,scene_desc,system_notice,sms_notice,oa_notice,mnp_notice,support'; $noticeSetting = NoticeSetting::field($field)->findOrEmpty($params['id'])->toArray(); @@ -95,7 +96,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:34 */ - public static function set($params) + public static function set($params): bool { try { // 校验参数 @@ -108,7 +109,7 @@ class NoticeLogic extends BaseLogic // 更新通知设置 NoticeSetting::where('id', $params['id'])->update($updateData); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -118,20 +119,20 @@ class NoticeLogic extends BaseLogic /** * @notes 校验参数 * @param $params - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkSet($params) + public static function checkSet($params): void { $noticeSetting = NoticeSetting::findOrEmpty($params['id'] ?? 0); if ($noticeSetting->isEmpty()) { - throw new \Exception('通知配置不存在'); + throw new Exception('通知配置不存在'); } if (!isset($params['template']) || !is_array($params['template']) || count($params['template']) == 0) { - throw new \Exception('模板配置不存在或格式错误'); + throw new Exception('模板配置不存在或格式错误'); } // 通知类型 @@ -139,11 +140,11 @@ class NoticeLogic extends BaseLogic foreach ($params['template'] as $item) { if (!is_array($item)) { - throw new \Exception('模板项格式错误'); + throw new Exception('模板项格式错误'); } if (!isset($item['type']) || !in_array($item['type'], $noticeType)) { - throw new \Exception('模板项缺少模板类型或模板类型有误'); + throw new Exception('模板项缺少模板类型或模板类型有误'); } switch ($item['type']) { @@ -167,14 +168,14 @@ class NoticeLogic extends BaseLogic /** * @notes 校验系统通知参数 * @param $item - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkSystem($item) + public static function checkSystem($item): void { if (!isset($item['title']) || !isset($item['content']) || !isset($item['status'])) { - throw new \Exception('系统通知必填参数:title、content、status'); + throw new Exception('系统通知必填参数:title、content、status'); } } @@ -182,14 +183,14 @@ class NoticeLogic extends BaseLogic /** * @notes 校验短信通知必填参数 * @param $item - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkSms($item) + public static function checkSms($item): void { if (!isset($item['template_id']) || !isset($item['content']) || !isset($item['status'])) { - throw new \Exception('短信通知必填参数:template_id、content、status'); + throw new Exception('短信通知必填参数:template_id、content、status'); } } @@ -197,14 +198,14 @@ class NoticeLogic extends BaseLogic /** * @notes 校验微信模板消息参数 * @param $item - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkOa($item) + public static function checkOa($item): void { if (!isset($item['template_id']) || !isset($item['template_sn']) || !isset($item['name']) || !isset($item['first']) || !isset($item['remark']) || !isset($item['tpl']) || !isset($item['status'])) { - throw new \Exception('微信模板消息必填参数:template_id、template_sn、name、first、remark、tpl、status'); + throw new Exception('微信模板消息必填参数:template_id、template_sn、name、first、remark、tpl、status'); } } @@ -212,14 +213,14 @@ class NoticeLogic extends BaseLogic /** * @notes 校验微信小程序提醒必填参数 * @param $item - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkMnp($item) + public static function checkMnp($item): void { if (!isset($item['template_id']) || !isset($item['template_sn']) || !isset($item['name']) || !isset($item['tpl']) || !isset($item['status'])) { - throw new \Exception('微信模板消息必填参数:template_id、template_sn、name、tpl、status'); + throw new Exception('微信模板消息必填参数:template_id、template_sn、name、tpl、status'); } } } \ No newline at end of file diff --git a/server/app/adminapi/logic/notice/SmsConfigLogic.php b/server/app/adminapi/logic/notice/SmsConfigLogic.php index e0a62e62b7132093c76cc6d09a9004ca5d1355ad..0a478067534c388a3ab78514d11d355581bd159c 100644 --- a/server/app/adminapi/logic/notice/SmsConfigLogic.php +++ b/server/app/adminapi/logic/notice/SmsConfigLogic.php @@ -31,7 +31,7 @@ class SmsConfigLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:37 */ - public static function getConfig() + public static function getConfig(): array { $config = [ ConfigService::get('sms', 'ali', ['type' => 'ali', 'name' => '阿里云短信', 'status' => 1]), @@ -44,11 +44,11 @@ class SmsConfigLogic extends BaseLogic /** * @notes 短信配置 * @param $params - * @return bool|void + * @return bool * @author 乔峰 * @date 2022/3/29 11:37 */ - public static function setConfig($params) + public static function setConfig($params): bool { $type = $params['type']; $params['name'] = self::getNameDesc(strtoupper($type)); @@ -69,6 +69,7 @@ class SmsConfigLogic extends BaseLogic ConfigService::set('sms', 'engine', strtoupper($type)); return true; } + return true; } @@ -79,7 +80,7 @@ class SmsConfigLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:37 */ - public static function detail($params) + public static function detail($params): mixed { $default = []; switch ($params['type']) { @@ -116,7 +117,7 @@ class SmsConfigLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:37 */ - public static function getNameDesc($value) + public static function getNameDesc($value): string { $desc = [ 'ALI' => '阿里云短信', diff --git a/server/app/adminapi/logic/recharge/RechargeLogic.php b/server/app/adminapi/logic/recharge/RechargeLogic.php index af0feac9ee4b8443190f2549f82f908314776d4c..214563ad002fd5c1346e8de570f87fd24a79ec26 100644 --- a/server/app/adminapi/logic/recharge/RechargeLogic.php +++ b/server/app/adminapi/logic/recharge/RechargeLogic.php @@ -26,6 +26,7 @@ use app\common\model\recharge\RechargeOrder; use app\common\model\refund\RefundRecord; use app\common\model\user\User; use app\common\service\ConfigService; +use Exception; use think\facade\Db; @@ -43,7 +44,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/2/22 16:54 */ - public static function getConfig() + public static function getConfig(): array { $config = [ 'status' => ConfigService::get('recharge', 'status', 0), @@ -61,7 +62,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/2/22 16:54 */ - public static function setConfig($params) + public static function setConfig($params): bool { try { if (isset($params['status'])) { @@ -71,7 +72,7 @@ class RechargeLogic extends BaseLogic ConfigService::set('recharge', 'min_amount', $params['min_amount']); } return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -86,7 +87,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/3/3 11:42 */ - public static function refund($params, $adminId) + public static function refund($params, $adminId): false|array { Db::startTrans(); try { @@ -141,7 +142,7 @@ class RechargeLogic extends BaseLogic Db::commit(); return [$flag, $resultMsg]; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return [false, $e->getMessage()]; @@ -157,7 +158,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/3/3 11:44 */ - public static function refundAgain($params, $adminId) + public static function refundAgain($params, $adminId): array { Db::startTrans(); try { @@ -176,7 +177,7 @@ class RechargeLogic extends BaseLogic Db::commit(); return [$flag, $resultMsg]; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return [false, $e->getMessage()]; diff --git a/server/app/adminapi/logic/setting/CustomerServiceLogic.php b/server/app/adminapi/logic/setting/CustomerServiceLogic.php index ba890df032c8fbf985ca0b638d7e6cfa5a6c60d5..98077f98e4a74950f6647e36ca3e6d3e399fbad0 100644 --- a/server/app/adminapi/logic/setting/CustomerServiceLogic.php +++ b/server/app/adminapi/logic/setting/CustomerServiceLogic.php @@ -31,7 +31,7 @@ class CustomerServiceLogic extends BaseLogic * @author ljj * @date 2022/2/15 12:05 下午 */ - public static function getConfig() + public static function getConfig(): array { $qrCode = ConfigService::get('customer_service', 'qr_code'); $qrCode = empty($qrCode) ? '' : FileService::getFileUrl($qrCode); @@ -50,7 +50,7 @@ class CustomerServiceLogic extends BaseLogic * @author ljj * @date 2022/2/15 12:11 下午 */ - public static function setConfig($params) + public static function setConfig($params): void { $allowField = ['qr_code','wechat','phone','service_time']; foreach($params as $key => $value) { diff --git a/server/app/adminapi/logic/setting/HotSearchLogic.php b/server/app/adminapi/logic/setting/HotSearchLogic.php index 192301aee565116343ced87e451e8f4b77e51164..63c5e631a3a1b5e6f1161a4feefef73acbdaefc1 100644 --- a/server/app/adminapi/logic/setting/HotSearchLogic.php +++ b/server/app/adminapi/logic/setting/HotSearchLogic.php @@ -18,6 +18,7 @@ use app\common\logic\BaseLogic; use app\common\model\HotSearch; use app\common\service\ConfigService; use app\common\service\FileService; +use Exception; /** @@ -34,7 +35,7 @@ class HotSearchLogic extends BaseLogic * @author 乔峰 * @date 2022/9/5 18:48 */ - public static function getConfig() + public static function getConfig(): array { return [ // 功能状态 0-关闭 1-开启 @@ -52,7 +53,7 @@ class HotSearchLogic extends BaseLogic * @author 乔峰 * @date 2022/9/5 18:58 */ - public static function setConfig($params) + public static function setConfig($params): bool { try { if (!empty($params['data'])) { @@ -65,7 +66,7 @@ class HotSearchLogic extends BaseLogic ConfigService::set('hot_search', 'status', $status); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } diff --git a/server/app/adminapi/logic/setting/StorageLogic.php b/server/app/adminapi/logic/setting/StorageLogic.php index b79345fb2ea952227b00106cfd56575d886d16b8..5f4f6f7d69269d4fdc31a227e8508dc910a3dfb5 100644 --- a/server/app/adminapi/logic/setting/StorageLogic.php +++ b/server/app/adminapi/logic/setting/StorageLogic.php @@ -34,7 +34,7 @@ class StorageLogic extends BaseLogic * @author 乔峰 * @date 2022/4/20 16:14 */ - public static function lists() + public static function lists(): array { $default = ConfigService::get('storage', 'default', 'local'); @@ -76,7 +76,7 @@ class StorageLogic extends BaseLogic * @author 乔峰 * @date 2022/4/20 16:15 */ - public static function detail($param) + public static function detail($param): mixed { $default = ConfigService::get('storage', 'default', ''); @@ -134,7 +134,7 @@ class StorageLogic extends BaseLogic * @author 乔峰 * @date 2022/4/20 16:16 */ - public static function setup($params) + public static function setup($params): bool|string { if ($params['status'] == 1) { //状态为开启 ConfigService::set('storage', 'default', $params['engine']); @@ -189,7 +189,7 @@ class StorageLogic extends BaseLogic * @author 乔峰 * @date 2022/4/20 16:17 */ - public static function change($params) + public static function change($params): void { $default = ConfigService::get('storage', 'default', ''); if ($default == $params['engine']) { diff --git a/server/app/adminapi/logic/setting/TransactionSettingsLogic.php b/server/app/adminapi/logic/setting/TransactionSettingsLogic.php index 36480228f983f3f39536426edb59b7946ca96619..b0508c977d54f77153a5be7dfd1ad0dda42c8803 100644 --- a/server/app/adminapi/logic/setting/TransactionSettingsLogic.php +++ b/server/app/adminapi/logic/setting/TransactionSettingsLogic.php @@ -30,7 +30,7 @@ class TransactionSettingsLogic extends BaseLogic * @author ljj * @date 2022/2/15 11:40 上午 */ - public static function getConfig() + public static function getConfig(): array { $config = [ 'cancel_unpaid_orders' => ConfigService::get('transaction', 'cancel_unpaid_orders', 1), @@ -48,7 +48,7 @@ class TransactionSettingsLogic extends BaseLogic * @author ljj * @date 2022/2/15 11:49 上午 */ - public static function setConfig($params) + public static function setConfig($params): void { ConfigService::set('transaction', 'cancel_unpaid_orders', $params['cancel_unpaid_orders']); ConfigService::set('transaction', 'verification_orders', $params['verification_orders']); diff --git a/server/app/adminapi/logic/setting/dict/DictDataLogic.php b/server/app/adminapi/logic/setting/dict/DictDataLogic.php index b2429412394c6435fe7b9b891deeae182b6418be..ff584895b9f7c0c328d87540187dcbeac45227c8 100644 --- a/server/app/adminapi/logic/setting/dict/DictDataLogic.php +++ b/server/app/adminapi/logic/setting/dict/DictDataLogic.php @@ -17,6 +17,7 @@ namespace app\adminapi\logic\setting\dict; use app\common\logic\BaseLogic; use app\common\model\dict\DictData; use app\common\model\dict\DictType; +use think\Model; /** @@ -30,11 +31,11 @@ class DictDataLogic extends BaseLogic /** * @notes 添加编辑 * @param array $params - * @return DictData|\think\Model + * @return DictData|Model * @author 乔峰 * @date 2022/6/20 17:13 */ - public static function save(array $params) + public static function save(array $params): DictData|Model { $data = [ 'name' => $params['name'], @@ -62,7 +63,7 @@ class DictDataLogic extends BaseLogic * @author 乔峰 * @date 2022/6/20 17:01 */ - public static function delete(array $params) + public static function delete(array $params): bool { return DictData::destroy($params['id']); } diff --git a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php index 8567f0701078af442d1a649bed2c55a3ddf3adf7..ca0af672515b799cb1f76698806eeb2304af4974 100644 --- a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php +++ b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php @@ -18,6 +18,10 @@ use app\common\enum\YesNoEnum; use app\common\logic\BaseLogic; use app\common\model\dict\DictData; use app\common\model\dict\DictType; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; +use think\Model; /** @@ -31,11 +35,11 @@ class DictTypeLogic extends BaseLogic /** * @notes 添加字典类型 * @param array $params - * @return DictType|\think\Model + * @return DictType|Model * @author 乔峰 * @date 2022/6/20 16:08 */ - public static function add(array $params) + public static function add(array $params): DictType|Model { return DictType::create([ 'name' => $params['name'], @@ -52,7 +56,7 @@ class DictTypeLogic extends BaseLogic * @author 乔峰 * @date 2022/6/20 16:10 */ - public static function edit(array $params) + public static function edit(array $params): void { DictType::update([ 'id' => $params['id'], @@ -73,7 +77,7 @@ class DictTypeLogic extends BaseLogic * @author 乔峰 * @date 2022/6/20 16:23 */ - public static function delete(array $params) + public static function delete(array $params): void { DictType::destroy($params['id']); } @@ -95,13 +99,13 @@ class DictTypeLogic extends BaseLogic /** * @notes 角色数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/10/13 10:44 */ - public static function getAllData() + public static function getAllData(): array { return DictType::where(['status' => YesNoEnum::YES]) ->order(['id' => 'desc']) diff --git a/server/app/adminapi/logic/setting/pay/PayConfigLogic.php b/server/app/adminapi/logic/setting/pay/PayConfigLogic.php index 4c41f5b38852508a5360c6b563a430d290a7dfae..90f6dac2ac880ad2adc4bd2faa3544f8f8b08d49 100644 --- a/server/app/adminapi/logic/setting/pay/PayConfigLogic.php +++ b/server/app/adminapi/logic/setting/pay/PayConfigLogic.php @@ -18,6 +18,9 @@ namespace app\adminapi\logic\setting\pay; use app\common\enum\PayEnum; use app\common\logic\BaseLogic; use app\common\model\pay\PayConfig; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 支付配置 @@ -31,13 +34,13 @@ class PayConfigLogic extends BaseLogic * @notes 设置配置 * @param $params * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:16 */ - public static function setConfig($params) + public static function setConfig($params): bool { $payConfig = PayConfig::find($params['id']); @@ -75,13 +78,13 @@ class PayConfigLogic extends BaseLogic * @notes 获取配置 * @param $params * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:16 */ - public static function getConfig($params) + public static function getConfig($params): array { $payConfig = PayConfig::find($params['id'])->toArray(); $payConfig['domain'] = request()->domain(); diff --git a/server/app/adminapi/logic/setting/pay/PayWayLogic.php b/server/app/adminapi/logic/setting/pay/PayWayLogic.php index bc5d5103569127ce45046773a471f0819d686cfa..d0e85f6ae2873ce777a807dc0d1773984ec6d754 100644 --- a/server/app/adminapi/logic/setting/pay/PayWayLogic.php +++ b/server/app/adminapi/logic/setting/pay/PayWayLogic.php @@ -21,6 +21,10 @@ use app\common\logic\BaseLogic; use app\common\model\pay\PayConfig; use app\common\model\pay\PayWay; use app\common\service\FileService; +use Exception; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 支付方式 @@ -33,13 +37,13 @@ class PayWayLogic extends BaseLogic /** * @notes 获取支付方式 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:25 */ - public static function getPayWay() + public static function getPayWay(): array { $payWay = PayWay::select()->append(['pay_way_name']) ->toArray(); @@ -66,11 +70,11 @@ class PayWayLogic extends BaseLogic * @notes 设置支付方式 * @param $params * @return bool|string - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2023/2/23 16:26 */ - public static function setPayWay($params) + public static function setPayWay($params): bool|string { $payWay = new PayWay; $data = []; diff --git a/server/app/adminapi/logic/setting/system/CacheLogic.php b/server/app/adminapi/logic/setting/system/CacheLogic.php index f9b0f54ba84b2a55b58abea55fef61156fca8034..059b49dbe6082c7f648780916a09f93f8c2e62e9 100644 --- a/server/app/adminapi/logic/setting/system/CacheLogic.php +++ b/server/app/adminapi/logic/setting/system/CacheLogic.php @@ -29,7 +29,7 @@ class CacheLogic extends BaseLogic * @author 乔峰 * @date 2022/4/8 16:29 */ - public static function clear() + public static function clear(): void { Cache::clear(); del_target_dir(root_path().'runtime/file',true); diff --git a/server/app/adminapi/logic/setting/web/WebSettingLogic.php b/server/app/adminapi/logic/setting/web/WebSettingLogic.php index de836cf5ba35d9a0e0c7d33dd62a8af67d2694ab..ecf6149718364539f475caadefcf3614cfa18610 100644 --- a/server/app/adminapi/logic/setting/web/WebSettingLogic.php +++ b/server/app/adminapi/logic/setting/web/WebSettingLogic.php @@ -18,6 +18,7 @@ namespace app\adminapi\logic\setting\web; use app\common\logic\BaseLogic; use app\common\service\ConfigService; use app\common\service\FileService; +use Exception; /** @@ -59,7 +60,7 @@ class WebSettingLogic extends BaseLogic * @author 乔峰 * @date 2021/12/28 15:43 */ - public static function setWebsiteInfo(array $params) + public static function setWebsiteInfo(array $params): void { $favicon = FileService::setFileUrl($params['web_favicon']); $logo = FileService::setFileUrl($params['web_logo']); @@ -102,15 +103,15 @@ class WebSettingLogic extends BaseLogic * @author 乔峰 * @date 2022/8/8 16:33 */ - public static function setCopyright(array $params) + public static function setCopyright(array $params): bool { try { if (!is_array($params['config'])) { - throw new \Exception('参数异常'); + throw new Exception('参数异常'); } ConfigService::set('copyright', 'config', $params['config'] ?? []); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -123,7 +124,7 @@ class WebSettingLogic extends BaseLogic * @author ljj * @date 2022/2/15 10:59 上午 */ - public static function setAgreement(array $params) + public static function setAgreement(array $params): void { $serviceContent = clear_file_domain($params['service_content'] ?? ''); $privacyContent = clear_file_domain($params['privacy_content'] ?? ''); @@ -143,10 +144,10 @@ class WebSettingLogic extends BaseLogic public static function getAgreement() : array { $config = [ - 'service_title' => ConfigService::get('agreement', 'service_title'), - 'service_content' => ConfigService::get('agreement', 'service_content'), - 'privacy_title' => ConfigService::get('agreement', 'privacy_title'), - 'privacy_content' => ConfigService::get('agreement', 'privacy_content'), + 'service_title' => ConfigService::get('agreement', 'service_title',''), + 'service_content' => ConfigService::get('agreement', 'service_content',''), + 'privacy_title' => ConfigService::get('agreement', 'privacy_title',''), + 'privacy_content' => ConfigService::get('agreement', 'privacy_content',''), ]; $config['service_content'] = get_file_domain($config['service_content']); diff --git a/server/app/adminapi/logic/tools/GeneratorLogic.php b/server/app/adminapi/logic/tools/GeneratorLogic.php index c8b78e840756eeb7c98dd09bfc0573092778fa5e..3fb65aa869cef084a9699f099bbadbea10f193e8 100644 --- a/server/app/adminapi/logic/tools/GeneratorLogic.php +++ b/server/app/adminapi/logic/tools/GeneratorLogic.php @@ -19,7 +19,9 @@ use app\common\logic\BaseLogic; use app\common\model\tools\GenerateColumn; use app\common\model\tools\GenerateTable; use app\common\service\generator\GenerateService; +use Exception; use think\facade\Db; +use think\Model; /** @@ -60,7 +62,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/20 10:44 */ - public static function selectTable($params, $adminId) + public static function selectTable($params, $adminId): bool { Db::startTrans(); try { @@ -74,7 +76,7 @@ class GeneratorLogic extends BaseLogic } Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -89,7 +91,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/20 10:44 */ - public static function editTable($params) + public static function editTable($params): bool { Db::startTrans(); try { @@ -130,7 +132,7 @@ class GeneratorLogic extends BaseLogic } Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -145,7 +147,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/16 9:30 */ - public static function deleteTable($params) + public static function deleteTable($params): bool { Db::startTrans(); try { @@ -153,7 +155,7 @@ class GeneratorLogic extends BaseLogic GenerateColumn::whereIn('table_id', $params['id'])->delete(); Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -168,7 +170,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/23 16:28 */ - public static function syncColumn($params) + public static function syncColumn($params): bool { Db::startTrans(); try { @@ -183,7 +185,7 @@ class GeneratorLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -198,7 +200,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/24 9:43 */ - public static function generate($params) + public static function generate($params): array|false { try { // 获取数据表信息 @@ -227,7 +229,7 @@ class GeneratorLogic extends BaseLogic return ['file' => $zipFile]; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -241,7 +243,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/23 16:27 */ - public static function preview($params) + public static function preview($params): false { try { // 获取数据表信息 @@ -251,7 +253,7 @@ class GeneratorLogic extends BaseLogic return make(GenerateService::class)->preview($table); - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -276,11 +278,11 @@ class GeneratorLogic extends BaseLogic * @notes 初始化代码生成数据表信息 * @param $tableData * @param $adminId - * @return GenerateTable|\think\Model + * @return GenerateTable|Model * @author 乔峰 * @date 2022/6/23 16:28 */ - public static function initTable($tableData, $adminId) + public static function initTable($tableData, $adminId): GenerateTable|Model { return GenerateTable::create([ 'table_name' => $tableData['name'], @@ -312,11 +314,11 @@ class GeneratorLogic extends BaseLogic * @notes 初始化代码生成字段信息 * @param $column * @param $tableId - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/6/23 16:28 */ - public static function initTableColumn($column, $tableId) + public static function initTableColumn($column, $tableId): void { $defaultColumn = ['id', 'create_time', 'update_time', 'delete_time']; @@ -356,7 +358,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/6/24 9:51 */ - public static function download(string $fileName) + public static function download(string $fileName): false|string { $cacheFileName = cache('curd_file_name' . $fileName); if (empty($cacheFileName)) { @@ -413,7 +415,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/12/13 18:23 */ - public static function formatConfigByTableData($options) + public static function formatConfigByTableData($options): array { // 菜单配置 $menuConfig = $options['menu'] ?? []; @@ -462,7 +464,7 @@ class GeneratorLogic extends BaseLogic * @author 乔峰 * @date 2022/12/14 11:04 */ - public static function getAllModels($module = 'common') + public static function getAllModels($module = 'common'): array { if(empty($module)) { return []; diff --git a/server/app/adminapi/logic/user/UserLogic.php b/server/app/adminapi/logic/user/UserLogic.php index ec6e319a37bca01f576af1566bbb75a39ccaaa59..277e78fbc7e1170e86531f2327683bc41cc8ceb4 100644 --- a/server/app/adminapi/logic/user/UserLogic.php +++ b/server/app/adminapi/logic/user/UserLogic.php @@ -18,6 +18,7 @@ use app\common\enum\user\UserTerminalEnum; use app\common\logic\AccountLogLogic; use app\common\logic\BaseLogic; use app\common\model\user\User; +use Exception; use think\facade\Db; /** @@ -59,7 +60,7 @@ class UserLogic extends BaseLogic * @author 乔峰 * @date 2022/9/22 16:38 */ - public static function setUserInfo(array $params) + public static function setUserInfo(array $params): User { return User::update([ 'id' => $params['id'], @@ -75,7 +76,7 @@ class UserLogic extends BaseLogic * @author bingo * @date 2023/2/23 14:25 */ - public static function adjustUserMoney(array $params) + public static function adjustUserMoney(array $params): bool|string { Db::startTrans(); try { @@ -110,7 +111,7 @@ class UserLogic extends BaseLogic Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); return $e->getMessage(); } diff --git a/server/app/adminapi/middleware/LoginMiddleware.php b/server/app/adminapi/middleware/LoginMiddleware.php index 0005cce17e493f1239f352e7a4fa132a1393f06d..4b906da862f1c6dbbd1bfb502d73837a7a0d2dcc 100644 --- a/server/app/adminapi/middleware/LoginMiddleware.php +++ b/server/app/adminapi/middleware/LoginMiddleware.php @@ -7,6 +7,7 @@ namespace app\adminapi\middleware; use app\adminapi\service\AdminTokenService; use app\common\cache\AdminTokenCache; use app\common\service\JsonService; +use Closure; use Webman\Config; use Webman\Http\Request; use Webman\Http\Response; @@ -18,7 +19,7 @@ class LoginMiddleware implements MiddlewareInterface /** * @notes 登录验证 * @param $request - * @param \Closure $next + * @param Closure $next * @author 乔峰 * @date 2021/7/1 17:33 */ @@ -57,6 +58,9 @@ class LoginMiddleware implements MiddlewareInterface //给request赋值,用于控制器 $adminId = $adminInfo['admin_id'] ?? 0; + if (!$adminInfo){ + $adminInfo = []; + } $controllerObject->setAdmin($adminId,$adminInfo); return $handler($request); } diff --git a/server/app/adminapi/service/AdminTokenService.php b/server/app/adminapi/service/AdminTokenService.php index f26fcbec2f1f45fe9570d42c3eb03d7bdb1fa3fe..e75973e536a0878b599da280b89bda8a23426139 100644 --- a/server/app/adminapi/service/AdminTokenService.php +++ b/server/app/adminapi/service/AdminTokenService.php @@ -6,23 +6,26 @@ namespace app\adminapi\service; use app\common\cache\AdminTokenCache; use app\common\model\auth\AdminSession; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use Webman\Config; class AdminTokenService { /** * @notes 设置或更新管理员token - * @param $adminId //管理员id - * @param $terminal //多终端名称 - * @param $multipointLogin //是否支持多处登录 + * @param int $adminId //管理员id + * @param int $terminal //多终端名称 + * @param int $multipointLogin //是否支持多处登录 * @return false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/2 20:25 */ - public static function setToken($adminId, $terminal, $multipointLogin = 1) + public static function setToken(int $adminId,int $terminal, int $multipointLogin = 1): mixed { $time = time(); $adminSession = AdminSession::where([['admin_id', '=', $adminId], ['terminal', '=', $terminal]])->find(); @@ -59,15 +62,15 @@ class AdminTokenService /** * @notes 延长token过期时间 - * @param $token + * @param string $token * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/5 14:25 */ - public static function overtimeToken($token) + public static function overtimeToken(string $token): mixed { $time = time(); $adminSession = AdminSession::where('token', '=', $token)->findOrEmpty(); @@ -83,15 +86,15 @@ class AdminTokenService /** * @notes 设置token为过期 - * @param $token + * @param string $token * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/5 14:31 */ - public static function expireToken($token) + public static function expireToken(string $token): bool { $adminSession = AdminSession::where('token', '=', $token) ->with('admin') diff --git a/server/app/adminapi/validate/FileValidate.php b/server/app/adminapi/validate/FileValidate.php index 1b2e1f27ff24202d8dfe9f4399a5a99699792dc1..09cd48f9caba43e3755ff7281dc0562d221da1a6 100644 --- a/server/app/adminapi/validate/FileValidate.php +++ b/server/app/adminapi/validate/FileValidate.php @@ -30,11 +30,11 @@ class FileValidate extends BaseValidate /** * @notes id验证场景 - * @return \app\adminapi\validate\FileValidate + * @return FileValidate * @author 乔峰 * @date 2021/12/29 14:32 */ - public function sceneId() + public function sceneId(): FileValidate { return $this->only(['id']); } @@ -46,7 +46,7 @@ class FileValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 14:32 */ - public function sceneRename() + public function sceneRename(): FileValidate { return $this->only(['id', 'name']); } @@ -58,7 +58,7 @@ class FileValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 14:33 */ - public function sceneAddCate() + public function sceneAddCate(): FileValidate { return $this->only(['type', 'pid', 'name']); } @@ -70,7 +70,7 @@ class FileValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 14:33 */ - public function sceneEditCate() + public function sceneEditCate(): FileValidate { return $this->only(['id', 'name']); } @@ -82,7 +82,7 @@ class FileValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 14:33 */ - public function sceneMove() + public function sceneMove(): FileValidate { return $this->only(['ids', 'cid']); } @@ -94,7 +94,7 @@ class FileValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 14:35 */ - public function sceneDelete() + public function sceneDelete(): FileValidate { return $this->only(['ids']); } diff --git a/server/app/adminapi/validate/LoginValidate.php b/server/app/adminapi/validate/LoginValidate.php index db9279277b8a93c5c933e3523f3c1418ceae5902..96be64cb46dd0f9fc5799856114a504bedd0d384 100644 --- a/server/app/adminapi/validate/LoginValidate.php +++ b/server/app/adminapi/validate/LoginValidate.php @@ -9,6 +9,9 @@ use app\common\enum\AdminTerminalEnum; use app\common\model\auth\Admin; use app\common\service\ConfigService; use app\common\validate\BaseValidate; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use Webman\Config; class LoginValidate extends BaseValidate @@ -30,13 +33,13 @@ class LoginValidate extends BaseValidate * @param $other * @param $data * @return bool|string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/7/2 14:00 */ - public function password($password, $other, $data) + public function password($password, $other, $data): bool|string { // 登录限制 $config = [ diff --git a/server/app/adminapi/validate/article/ArticleCateValidate.php b/server/app/adminapi/validate/article/ArticleCateValidate.php index 5f3c6af73d3b432f4e83c4eb1ce73da498269f74..c051346b1d8b5e0ffef29f2a0d0747760e326c53 100644 --- a/server/app/adminapi/validate/article/ArticleCateValidate.php +++ b/server/app/adminapi/validate/article/ArticleCateValidate.php @@ -45,7 +45,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/10 15:11 */ - public function sceneAdd() + public function sceneAdd(): ArticleCateValidate { return $this->remove(['id']) ->remove('id', 'require|checkArticleCate'); @@ -57,7 +57,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/21 17:55 */ - public function sceneDetail() + public function sceneDetail(): ArticleCateValidate { return $this->only(['id']); } @@ -68,7 +68,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/21 18:02 */ - public function sceneStatus() + public function sceneStatus(): ArticleCateValidate { return $this->only(['id', 'is_show']); } @@ -83,7 +83,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/15 10:05 */ - public function sceneSelect() + public function sceneSelect(): ArticleCateValidate { return $this->only(['type']); } @@ -95,7 +95,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/21 17:52 */ - public function sceneDelete() + public function sceneDelete(): ArticleCateValidate { return $this->only(['id']) ->append('id', 'checkDeleteArticleCate'); @@ -108,7 +108,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/10 15:10 */ - public function checkArticleCate($value) + public function checkArticleCate($value): bool|string { $article_category = ArticleCate::findOrEmpty($value); if ($article_category->isEmpty()) { @@ -124,7 +124,7 @@ class ArticleCateValidate extends BaseValidate * @author heshihu * @date 2022/2/22 14:45 */ - public function checkDeleteArticleCate($value) + public function checkDeleteArticleCate($value): bool|string { $article = Article::where('cid', $value)->findOrEmpty(); if (!$article->isEmpty()) { diff --git a/server/app/adminapi/validate/article/ArticleValidate.php b/server/app/adminapi/validate/article/ArticleValidate.php index 13898d9260fe04aafcc6dae3506fd75e3d18fb02..ad117e56086cf9ef84bae64bc6f4a67d8711ec0a 100644 --- a/server/app/adminapi/validate/article/ArticleValidate.php +++ b/server/app/adminapi/validate/article/ArticleValidate.php @@ -46,7 +46,7 @@ class ArticleValidate extends BaseValidate * @author heshihu * @date 2022/2/22 9:57 */ - public function sceneAdd() + public function sceneAdd(): ArticleValidate { return $this->remove(['id']) ->remove('id','require|checkArticle'); @@ -58,7 +58,7 @@ class ArticleValidate extends BaseValidate * @author heshihu * @date 2022/2/22 10:15 */ - public function sceneDetail() + public function sceneDetail(): ArticleValidate { return $this->only(['id']); } @@ -69,7 +69,7 @@ class ArticleValidate extends BaseValidate * @author heshihu * @date 2022/2/22 10:18 */ - public function sceneStatus() + public function sceneStatus(): ArticleValidate { return $this->only(['id', 'is_show']); } @@ -84,7 +84,7 @@ class ArticleValidate extends BaseValidate * @author heshihu * @date 2022/2/22 10:17 */ - public function sceneDelete() + public function sceneDelete(): ArticleValidate { return $this->only(['id']); } @@ -96,7 +96,7 @@ class ArticleValidate extends BaseValidate * @author heshihu * @date 2022/2/22 10:11 */ - public function checkArticle($value) + public function checkArticle($value): bool|string { $article = Article::findOrEmpty($value); if ($article->isEmpty()) { diff --git a/server/app/adminapi/validate/auth/AdminValidate.php b/server/app/adminapi/validate/auth/AdminValidate.php index 2e12c376b0934c93eaa10f378804ef5dfc259456..c8db5e4e14a4b5598872b8cb6362925e84b209a1 100644 --- a/server/app/adminapi/validate/auth/AdminValidate.php +++ b/server/app/adminapi/validate/auth/AdminValidate.php @@ -60,7 +60,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:46 */ - public function sceneAdd() + public function sceneAdd(): AdminValidate { return $this->remove(['password', 'edit']) ->remove('id', 'require|checkAdmin') @@ -73,7 +73,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:46 */ - public function sceneDetail() + public function sceneDetail(): AdminValidate { return $this->only(['id']); } @@ -84,7 +84,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:47 */ - public function sceneEdit() + public function sceneEdit(): AdminValidate { return $this->remove('password', 'require|length') ->append('id', 'require|checkAdmin'); @@ -97,7 +97,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:47 */ - public function sceneDelete() + public function sceneDelete(): AdminValidate { return $this->only(['id']); } @@ -113,7 +113,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 10:19 */ - public function edit($value, $rule, $data) + public function edit($value, $rule, $data): bool|string { if (empty($data['password']) && empty($data['password_confirm'])) { return true; @@ -133,7 +133,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 10:19 */ - public function checkAdmin($value) + public function checkAdmin($value): bool|string { $admin = Admin::findOrEmpty($value); if ($admin->isEmpty()) { @@ -152,7 +152,7 @@ class AdminValidate extends BaseValidate * @author 乔峰 * @date 2022/8/11 9:59 */ - public function checkAbleDisable($value, $rule, $data) + public function checkAbleDisable($value, $rule, $data): bool|string { $admin = Admin::findOrEmpty($data['id']); if ($admin->isEmpty()) { diff --git a/server/app/adminapi/validate/auth/MenuValidate.php b/server/app/adminapi/validate/auth/MenuValidate.php index 3a52b2a3c793ed1f8a6cb19e5649627ed466ba0b..bbb1b2390c80b2cfc8a053716936cd2b90d2214b 100644 --- a/server/app/adminapi/validate/auth/MenuValidate.php +++ b/server/app/adminapi/validate/auth/MenuValidate.php @@ -75,7 +75,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/29 18:26 */ - public function sceneAdd() + public function sceneAdd(): MenuValidate { return $this->remove('id', true); } @@ -87,7 +87,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/29 18:27 */ - public function sceneDetail() + public function sceneDetail(): MenuValidate { return $this->only(['id']); } @@ -99,7 +99,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/29 18:27 */ - public function sceneDelete() + public function sceneDelete(): MenuValidate { return $this->only(['id']) ->append('id', 'checkAbleDelete'); @@ -112,7 +112,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/7/6 17:04 */ - public function sceneStatus() + public function sceneStatus(): MenuValidate { return $this->only(['id', 'is_disable']); } @@ -127,7 +127,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/29 18:24 */ - protected function checkUniqueName($value, $rule, $data) + protected function checkUniqueName($value, $rule, $data): bool|string { if ($data['type'] != 'M') { return true; @@ -158,7 +158,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/30 9:40 */ - protected function checkAbleDelete($value, $rule, $data) + protected function checkAbleDelete($value, $rule, $data): bool|string { $hasChild = SystemMenu::where(['pid' => $value])->findOrEmpty(); if (!$hasChild->isEmpty()) { @@ -184,7 +184,7 @@ class MenuValidate extends BaseValidate * @author 乔峰 * @date 2022/6/30 9:51 */ - protected function checkPid($value, $rule, $data) + protected function checkPid($value, $rule, $data): bool|string { if (!empty($data['id']) && $data['id'] == $value) { return '上级菜单不能选择自己'; diff --git a/server/app/adminapi/validate/auth/RoleValidate.php b/server/app/adminapi/validate/auth/RoleValidate.php index 5680ce6ce708ae651587ce02ff4698e97486eba6..157fbfa42ba67101f600bbd1dbb785f3b8856f4b 100644 --- a/server/app/adminapi/validate/auth/RoleValidate.php +++ b/server/app/adminapi/validate/auth/RoleValidate.php @@ -17,6 +17,9 @@ namespace app\adminapi\validate\auth; use app\common\validate\BaseValidate; use app\common\model\auth\{AdminRole, SystemRole, Admin}; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 角色验证器 @@ -45,7 +48,7 @@ class RoleValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:47 */ - public function sceneAdd() + public function sceneAdd(): RoleValidate { return $this->only(['name', 'menu_id']); } @@ -56,7 +59,7 @@ class RoleValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:47 */ - public function sceneDetail() + public function sceneDetail(): RoleValidate { return $this->only(['id']); } @@ -67,7 +70,7 @@ class RoleValidate extends BaseValidate * @author 乔峰 * @date 2021/12/29 15:48 */ - public function sceneDel() + public function sceneDel(): RoleValidate { return $this->only(['id']) ->append('id', 'checkAdmin'); @@ -80,13 +83,13 @@ class RoleValidate extends BaseValidate * @param $rule * @param $data * @return bool|string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 15:48 */ - public function checkRole($value, $rule, $data) + public function checkRole($value, $rule, $data): bool|string { if (!SystemRole::find($value)) { return '角色不存在'; @@ -102,13 +105,13 @@ class RoleValidate extends BaseValidate * @param $rule * @param $data * @return bool|string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2021/12/29 15:49 */ - public function checkAdmin($value, $rule, $data) + public function checkAdmin($value, $rule, $data): bool|string { if (AdminRole::where('role_id',$value)->find()){ return '有管理员在使用该角色,不允许删除'; diff --git a/server/app/adminapi/validate/auth/editSelfValidate.php b/server/app/adminapi/validate/auth/editSelfValidate.php index 34c7251c694c7c1fa4d36f1af90f7c96556d9985..a3d73e01a605fec0fcae7a8c46de8bd3ab6caa75 100644 --- a/server/app/adminapi/validate/auth/editSelfValidate.php +++ b/server/app/adminapi/validate/auth/editSelfValidate.php @@ -54,7 +54,7 @@ class editSelfValidate extends BaseValidate * @author 乔峰 * @date 2022/4/8 17:40 */ - public function checkPassword($value, $rule, $data) + public function checkPassword($value, $rule, $data): bool|string { if (empty($data['password_old'])) { return '请填写当前密码'; diff --git a/server/app/adminapi/validate/crontab/CrontabValidate.php b/server/app/adminapi/validate/crontab/CrontabValidate.php index d21e157ec8a5960e1fd4098751be7a596d985aa8..34b054604810622df7a69f8e97b00e1995633f5a 100644 --- a/server/app/adminapi/validate/crontab/CrontabValidate.php +++ b/server/app/adminapi/validate/crontab/CrontabValidate.php @@ -53,7 +53,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:39 */ - public function sceneAdd() + public function sceneAdd(): CrontabValidate { return $this->remove('id', 'require')->remove('operate', 'require'); } @@ -65,7 +65,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:39 */ - public function sceneDetail() + public function sceneDetail(): CrontabValidate { return $this->only(['id']); } @@ -77,7 +77,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:39 */ - public function sceneEdit() + public function sceneEdit(): CrontabValidate { return $this->remove('operate', 'require'); } @@ -89,7 +89,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:40 */ - public function sceneDelete() + public function sceneDelete(): CrontabValidate { return $this->only(['id']); } @@ -101,7 +101,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:40 */ - public function sceneOperate() + public function sceneOperate(): CrontabValidate { return $this->only(['id', 'operate']); } @@ -113,7 +113,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:40 */ - public function sceneExpression() + public function sceneExpression(): CrontabValidate { return $this->only(['expression']); } @@ -128,7 +128,7 @@ class CrontabValidate extends BaseValidate * @author 乔峰 * @date 2022/3/29 14:40 */ - public function checkExpression($value, $rule, $data) + public function checkExpression($value, $rule, $data): bool|string { if (CronExpression::isValidExpression($value) === false) { return '定时任务运行规则错误'; diff --git a/server/app/adminapi/validate/dept/DeptValidate.php b/server/app/adminapi/validate/dept/DeptValidate.php index dfede9d95133b1d425368d084750911412710414..bed327b73ef4fffe7f611ba510bfef10e07b95e0 100644 --- a/server/app/adminapi/validate/dept/DeptValidate.php +++ b/server/app/adminapi/validate/dept/DeptValidate.php @@ -54,7 +54,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/25 18:16 */ - public function sceneAdd() + public function sceneAdd(): DeptValidate { return $this->remove('id', true)->append('pid', 'checkDept'); } @@ -66,7 +66,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/25 18:16 */ - public function sceneDetail() + public function sceneDetail(): DeptValidate { return $this->only(['id']); } @@ -78,7 +78,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 18:42 */ - public function sceneEdit() + public function sceneEdit(): DeptValidate { return $this->append('pid', 'checkPid'); } @@ -90,7 +90,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/25 18:16 */ - public function sceneDelete() + public function sceneDelete(): DeptValidate { return $this->only(['id'])->append('id', 'checkAbleDetele'); } @@ -103,7 +103,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/25 18:17 */ - public function checkDept($value) + public function checkDept($value): bool|string { $dept = Dept::findOrEmpty($value); if ($dept->isEmpty()) { @@ -120,7 +120,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 14:22 */ - public function checkAbleDetele($value) + public function checkAbleDetele($value): bool|string { $hasLower = Dept::where(['pid' => $value])->findOrEmpty(); if (!$hasLower->isEmpty()) { @@ -149,7 +149,7 @@ class DeptValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 18:41 */ - public function checkPid($value, $rule, $data = []) + public function checkPid($value, $rule, $data = []): bool|string { // 当前编辑的部门id信息是否存在 $dept = Dept::findOrEmpty($data['id']); diff --git a/server/app/adminapi/validate/dept/JobsValidate.php b/server/app/adminapi/validate/dept/JobsValidate.php index 12082015980200eebab158c9f9ce15bd465b62ba..ae4407e42a8a1c63011c2ecafcd891130e45d401 100644 --- a/server/app/adminapi/validate/dept/JobsValidate.php +++ b/server/app/adminapi/validate/dept/JobsValidate.php @@ -56,7 +56,7 @@ class JobsValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 9:53 */ - public function sceneAdd() + public function sceneAdd(): JobsValidate { return $this->remove('id', true); } @@ -68,7 +68,7 @@ class JobsValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 9:53 */ - public function sceneDetail() + public function sceneDetail(): JobsValidate { return $this->only(['id']); } @@ -85,7 +85,7 @@ class JobsValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 9:54 */ - public function sceneDelete() + public function sceneDelete(): JobsValidate { return $this->only(['id'])->append('id', 'checkAbleDetele'); } @@ -98,7 +98,7 @@ class JobsValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 9:55 */ - public function checkJobs($value) + public function checkJobs($value): bool|string { $jobs = Jobs::findOrEmpty($value); if ($jobs->isEmpty()) { @@ -115,7 +115,7 @@ class JobsValidate extends BaseValidate * @author 乔峰 * @date 2022/5/26 14:22 */ - public function checkAbleDetele($value) + public function checkAbleDetele($value): bool|string { $check = AdminJobs::where(['jobs_id' => $value])->findOrEmpty(); if (!$check->isEmpty()) { diff --git a/server/app/adminapi/validate/dict/DictDataValidate.php b/server/app/adminapi/validate/dict/DictDataValidate.php index 9b5f08b7fe4bd7faf2dd070e1729a9c7cb07b9fa..c1673c1fcd50c05cb953604e1038e049de1af37e 100644 --- a/server/app/adminapi/validate/dict/DictDataValidate.php +++ b/server/app/adminapi/validate/dict/DictDataValidate.php @@ -53,7 +53,7 @@ class DictDataValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:54 */ - public function sceneAdd() + public function sceneAdd(): DictDataValidate { return $this->remove('id', true); } @@ -65,7 +65,7 @@ class DictDataValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:54 */ - public function sceneId() + public function sceneId(): DictDataValidate { return $this->only(['id']); } @@ -77,7 +77,7 @@ class DictDataValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 18:36 */ - public function sceneEdit() + public function sceneEdit(): DictDataValidate { return $this->remove('type_id', true); } @@ -90,7 +90,7 @@ class DictDataValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:55 */ - protected function checkDictData($value) + protected function checkDictData($value): bool|string { $article = DictData::findOrEmpty($value); if ($article->isEmpty()) { @@ -107,7 +107,7 @@ class DictDataValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 17:03 */ - protected function checkDictType($value) + protected function checkDictType($value): bool|string { $type = DictType::findOrEmpty($value); if ($type->isEmpty()) { diff --git a/server/app/adminapi/validate/dict/DictTypeValidate.php b/server/app/adminapi/validate/dict/DictTypeValidate.php index 381f19804121b806623970832be40e3cb0eff426..62a1986f3682c4a24888c6cb86e322dfdfe19ccc 100644 --- a/server/app/adminapi/validate/dict/DictTypeValidate.php +++ b/server/app/adminapi/validate/dict/DictTypeValidate.php @@ -53,7 +53,7 @@ class DictTypeValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:00 */ - public function sceneAdd() + public function sceneAdd(): DictTypeValidate { return $this->remove('id', true); } @@ -65,7 +65,7 @@ class DictTypeValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:00 */ - public function sceneDetail() + public function sceneDetail(): DictTypeValidate { return $this->only(['id']); } @@ -82,7 +82,7 @@ class DictTypeValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:03 */ - public function sceneDelete() + public function sceneDelete(): DictTypeValidate { return $this->only(['id']) ->append('id', 'checkAbleDelete'); @@ -97,7 +97,7 @@ class DictTypeValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:04 */ - protected function checkDictType($value) + protected function checkDictType($value): bool|string { $dictType = DictType::findOrEmpty($value); if ($dictType->isEmpty()) { @@ -115,7 +115,7 @@ class DictTypeValidate extends BaseValidate * @author 乔峰 * @date 2022/6/20 16:04 */ - protected function checkAbleDelete($value) + protected function checkAbleDelete($value): bool|string { $dictData = DictData::whereIn('type_id', $value)->select(); diff --git a/server/app/adminapi/validate/notice/NoticeValidate.php b/server/app/adminapi/validate/notice/NoticeValidate.php index fd944823ce410aae32f78bd68abc8098f44d5e31..b3583d9dba1cf2b781d6fe111b42d7ff3256094f 100644 --- a/server/app/adminapi/validate/notice/NoticeValidate.php +++ b/server/app/adminapi/validate/notice/NoticeValidate.php @@ -31,7 +31,7 @@ class NoticeValidate extends BaseValidate 'id.require' => '参数缺失', ]; - protected function sceneDetail() + protected function sceneDetail(): NoticeValidate { return $this->only(['id']); } diff --git a/server/app/adminapi/validate/notice/SmsConfigValidate.php b/server/app/adminapi/validate/notice/SmsConfigValidate.php index 700a0bc8e438cae6f8255c1fabf880d18772a8d4..10a2ed064eb4f357eed5e1d0e782ebdde569cef8 100644 --- a/server/app/adminapi/validate/notice/SmsConfigValidate.php +++ b/server/app/adminapi/validate/notice/SmsConfigValidate.php @@ -44,7 +44,7 @@ class SmsConfigValidate extends BaseValidate ]; - protected function sceneDetail() + protected function sceneDetail(): SmsConfigValidate { return $this->only(['type']); } diff --git a/server/app/adminapi/validate/recharge/RechargeRefundValidate.php b/server/app/adminapi/validate/recharge/RechargeRefundValidate.php index cba99e068f14aa5763514265b3d5d2005a541728..b01d31ec6178dfd62b83f40ea9efbee1b6bf34e2 100644 --- a/server/app/adminapi/validate/recharge/RechargeRefundValidate.php +++ b/server/app/adminapi/validate/recharge/RechargeRefundValidate.php @@ -41,13 +41,13 @@ class RechargeRefundValidate extends BaseValidate ]; - public function sceneRefund() + public function sceneRefund(): RechargeRefundValidate { return $this->only(['recharge_id']); } - public function sceneAgain() + public function sceneAgain(): RechargeRefundValidate { return $this->only(['record_id']); } @@ -62,7 +62,7 @@ class RechargeRefundValidate extends BaseValidate * @author 段誉 * @date 2023/2/28 17:00 */ - protected function checkRecharge($rechargeId, $rule, $data) + protected function checkRecharge($rechargeId, $rule, $data): bool|string { $order = RechargeOrder::findOrEmpty($rechargeId); @@ -98,7 +98,7 @@ class RechargeRefundValidate extends BaseValidate * @author 段誉 * @date 2023/3/1 9:40 */ - protected function checkRecord($recordId, $rule, $data) + protected function checkRecord($recordId, $rule, $data): bool|string { $record = RefundRecord::findOrEmpty($recordId); if ($record->isEmpty()) { diff --git a/server/app/adminapi/validate/setting/PayConfigValidate.php b/server/app/adminapi/validate/setting/PayConfigValidate.php index 132780d4275feee6078eb75851d50d8a842f0105..421a38324e8142bf4a2952ee027c66058f35122f 100644 --- a/server/app/adminapi/validate/setting/PayConfigValidate.php +++ b/server/app/adminapi/validate/setting/PayConfigValidate.php @@ -18,6 +18,9 @@ namespace app\adminapi\validate\setting; use app\common\enum\PayEnum; use app\common\model\pay\PayConfig; use app\common\validate\BaseValidate; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class PayConfigValidate extends BaseValidate @@ -40,7 +43,7 @@ class PayConfigValidate extends BaseValidate 'config.require' => '支付参数缺失', ]; - public function sceneGet() + public function sceneGet(): PayConfigValidate { return $this->only(['id']); } @@ -52,13 +55,13 @@ class PayConfigValidate extends BaseValidate * @param $rule * @param $data * @return bool|string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 16:19 */ - public function checkConfig($config, $rule, $data) + public function checkConfig($config, $rule, $data): bool|string { $result = PayConfig::where('id', $data['id'])->find(); if (empty($result)) { @@ -115,7 +118,7 @@ class PayConfigValidate extends BaseValidate * @author 段誉 * @date 2023/2/23 16:19 */ - public function checkName($value, $rule, $data) + public function checkName($value, $rule, $data): bool|string { $result = PayConfig::where('name', $value) ->where('id', '<>', $data['id']) diff --git a/server/app/adminapi/validate/setting/StorageValidate.php b/server/app/adminapi/validate/setting/StorageValidate.php index 15aafd7374553b4d98a9094d406bf6fbfdc164df..231b6e07d6649c5261563673fe1d1060bb7c406c 100644 --- a/server/app/adminapi/validate/setting/StorageValidate.php +++ b/server/app/adminapi/validate/setting/StorageValidate.php @@ -17,11 +17,11 @@ class StorageValidate extends BaseValidate /** * @notes 设置存储引擎参数场景 - * @return \app\adminapi\validate\setting\StorageValidate + * @return StorageValidate * @author 乔峰 * @date 2022/4/20 16:18 */ - public function sceneSetup() + public function sceneSetup(): StorageValidate { return $this->only(['engine', 'status']); } @@ -33,7 +33,7 @@ class StorageValidate extends BaseValidate * @author 乔峰 * @date 2022/4/20 16:18 */ - public function sceneDetail() + public function sceneDetail(): StorageValidate { return $this->only(['engine']); } @@ -45,7 +45,7 @@ class StorageValidate extends BaseValidate * @author 乔峰 * @date 2022/4/20 16:18 */ - public function sceneChange() + public function sceneChange(): StorageValidate { return $this->only(['engine']); } diff --git a/server/app/adminapi/validate/setting/TransactionSettingsValidate.php b/server/app/adminapi/validate/setting/TransactionSettingsValidate.php index 8c0e6e781df8135c93477f5ae312ea495c29d7b2..1f1ed2059e866f6c7038a971d6187a0101189ebb 100644 --- a/server/app/adminapi/validate/setting/TransactionSettingsValidate.php +++ b/server/app/adminapi/validate/setting/TransactionSettingsValidate.php @@ -44,7 +44,7 @@ class TransactionSettingsValidate extends BaseValidate 'verification_orders_times.gt' => '系统自动核销订单时间须大于0', ]; - public function sceneSetConfig() + public function sceneSetConfig(): TransactionSettingsValidate { return $this->only(['cancel_unpaid_orders','cancel_unpaid_orders_times','verification_orders','verification_orders_times']); } diff --git a/server/app/adminapi/validate/setting/UserConfigValidate.php b/server/app/adminapi/validate/setting/UserConfigValidate.php index 3f890cfd28e14853c919a53d65b1be32fe7913cc..764d14cc4713e38680e6ae2c6045edbd3bbfe936 100644 --- a/server/app/adminapi/validate/setting/UserConfigValidate.php +++ b/server/app/adminapi/validate/setting/UserConfigValidate.php @@ -45,13 +45,13 @@ class UserConfigValidate extends BaseValidate ]; //用户设置验证 - public function sceneUser() + public function sceneUser(): UserConfigValidate { return $this->only(['default_avatar']); } //注册验证 - public function sceneRegister() + public function sceneRegister(): UserConfigValidate { return $this->only(['login_way', 'coerce_mobile', 'login_agreement', 'third_auth', 'wechat_auth']); } diff --git a/server/app/adminapi/validate/tools/EditTableValidate.php b/server/app/adminapi/validate/tools/EditTableValidate.php index 8cba12dfce781571c2feb4018c0b366b26edcf91..9f7456cb6cd6ca61d30b86750b02cfee31b8f87d 100644 --- a/server/app/adminapi/validate/tools/EditTableValidate.php +++ b/server/app/adminapi/validate/tools/EditTableValidate.php @@ -49,7 +49,7 @@ class EditTableValidate extends BaseValidate * @author bingo * @date 2022/6/15 18:58 */ - protected function checkTableData($value, $rule, $data) + protected function checkTableData($value, $rule, $data): bool|string { $table = GenerateTable::findOrEmpty($value); if ($table->isEmpty()) { @@ -68,7 +68,7 @@ class EditTableValidate extends BaseValidate * @author bingo * @date 2022/6/20 10:42 */ - protected function checkColumn($value, $rule, $data) + protected function checkColumn($value, $rule, $data): bool|string { foreach ($value as $item) { if (!isset($item['id'])) { diff --git a/server/app/adminapi/validate/tools/GenerateTableValidate.php b/server/app/adminapi/validate/tools/GenerateTableValidate.php index 5703dc80d87250d2eb8020091ef5402cd52f0b70..7804fd3501216cfc2ca9b2a6b04592ce5a35fa4e 100644 --- a/server/app/adminapi/validate/tools/GenerateTableValidate.php +++ b/server/app/adminapi/validate/tools/GenerateTableValidate.php @@ -37,7 +37,7 @@ class GenerateTableValidate extends BaseValidate * @author bingo * @date 2022/6/15 18:58 */ - public function sceneSelect() + public function sceneSelect(): GenerateTableValidate { return $this->only(['table']); } @@ -49,7 +49,7 @@ class GenerateTableValidate extends BaseValidate * @author bingo * @date 2022/6/15 18:58 */ - public function sceneId() + public function sceneId(): GenerateTableValidate { return $this->only(['id']); } @@ -61,7 +61,7 @@ class GenerateTableValidate extends BaseValidate * @author bingo * @date 2022/6/24 10:02 */ - public function sceneDownload() + public function sceneDownload(): GenerateTableValidate { return $this->only(['file']); } @@ -76,13 +76,13 @@ class GenerateTableValidate extends BaseValidate * @author bingo * @date 2022/6/15 18:58 */ - protected function checkTable($value, $rule, $data) + protected function checkTable($value, $rule, $data): bool|string { foreach ($value as $item) { if (!isset($item['name']) || !isset($item['comment'])) { return '参数缺失'; } - $exist = \think\facade\Db::query("SHOW TABLES LIKE'" . $item['name'] . "'"); + $exist = Db::query("SHOW TABLES LIKE'" . $item['name'] . "'"); if (empty($exist)) { return '当前数据库不存在' . $item['name'] . '表'; } @@ -100,7 +100,7 @@ class GenerateTableValidate extends BaseValidate * @author bingo * @date 2022/6/15 18:58 */ - protected function checkTableData($value, $rule, $data) + protected function checkTableData($value, $rule, $data): bool|string { if (!is_array($value)) { $value = [$value]; diff --git a/server/app/adminapi/validate/user/AdjustUserMoney.php b/server/app/adminapi/validate/user/AdjustUserMoney.php index 69a58d4c0865b5503d615780bbb4ac430778aabf..009560a9186c6349b4e8a82fb693ffeac1edd535 100644 --- a/server/app/adminapi/validate/user/AdjustUserMoney.php +++ b/server/app/adminapi/validate/user/AdjustUserMoney.php @@ -32,7 +32,7 @@ class AdjustUserMoney extends BaseValidate ]; - protected function checkMoney($vaule, $rule, $data) + protected function checkMoney($vaule, $rule, $data): true|string { $user = User::find($data['user_id']); if (empty($user)) { diff --git a/server/app/adminapi/validate/user/UserValidate.php b/server/app/adminapi/validate/user/UserValidate.php index e74f20e91e8e3b0419c0e3bcc984b3e700479d27..3f96ee2c0e5b32fbc9205e745cdef84934a92d95 100644 --- a/server/app/adminapi/validate/user/UserValidate.php +++ b/server/app/adminapi/validate/user/UserValidate.php @@ -6,6 +6,9 @@ namespace app\adminapi\validate\user; use app\common\model\user\User; use app\common\validate\BaseValidate; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class UserValidate extends BaseValidate { @@ -24,11 +27,11 @@ class UserValidate extends BaseValidate /** * @notes 详情场景 - * @return \app\adminapi\validate\user\UserValidate + * @return UserValidate * @author 乔峰 * @date 2022/9/22 16:35 */ - public function sceneDetail() + public function sceneDetail(): UserValidate { return $this->only(['id']); } @@ -40,13 +43,13 @@ class UserValidate extends BaseValidate * @param $rule * @param $data * @return bool|string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/22 17:03 */ - public function checkUser($value, $rule, $data) + public function checkUser($value, $rule, $data): bool|string { $userIds = is_array($value) ? $value : [$value]; @@ -68,7 +71,7 @@ class UserValidate extends BaseValidate * @author 乔峰 * @date 2022/9/22 16:37 */ - public function checkField($value, $rule, $data) + public function checkField($value, $rule, $data): bool|string { $allowField = ['account', 'sex', 'mobile', 'real_name']; diff --git a/server/app/api/controller/AccountLogController.php b/server/app/api/controller/AccountLogController.php index 1d720de19a8d670c539e24e900c0aaec311d8d68..e1933423df217bef513e372dc11e9000637b86b6 100644 --- a/server/app/api/controller/AccountLogController.php +++ b/server/app/api/controller/AccountLogController.php @@ -15,6 +15,7 @@ namespace app\api\controller; use app\api\lists\AccountLogLists; +use support\Response; /** * 账户流水 @@ -25,11 +26,11 @@ class AccountLogController extends BaseApiController { /** * @notes 账户流水 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 14:34 */ - public function lists() + public function lists(): Response { return $this->dataLists(new AccountLogLists()); } diff --git a/server/app/api/controller/ArticleController.php b/server/app/api/controller/ArticleController.php index 3882d2c882917fc5f3b2c43b69ebbf811f176455..bf26937d9c2fc485c6b874fa7a097d664909afb3 100644 --- a/server/app/api/controller/ArticleController.php +++ b/server/app/api/controller/ArticleController.php @@ -18,6 +18,7 @@ namespace app\api\controller; use app\api\lists\article\ArticleCollectLists; use app\api\lists\article\ArticleLists; use app\api\logic\ArticleLogic; +use support\Response; /** * 文章管理 @@ -32,11 +33,11 @@ class ArticleController extends BaseApiController /** * @notes 文章列表 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 15:30 */ - public function lists() + public function lists(): Response { return $this->dataLists(new ArticleLists()); } @@ -44,11 +45,11 @@ class ArticleController extends BaseApiController /** * @notes 文章分类列表 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 15:30 */ - public function cate() + public function cate(): Response { return $this->data(ArticleLogic::cate()); } @@ -56,11 +57,11 @@ class ArticleController extends BaseApiController /** * @notes 收藏列表 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 16:31 */ - public function collect() + public function collect(): Response { return $this->dataLists(new ArticleCollectLists()); } @@ -68,11 +69,11 @@ class ArticleController extends BaseApiController /** * @notes 文章详情 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 17:09 */ - public function detail() + public function detail(): Response { $id = $this->request->get('id'); $result = ArticleLogic::detail($id, $this->userId); @@ -82,11 +83,11 @@ class ArticleController extends BaseApiController /** * @notes 加入收藏 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 17:01 */ - public function addCollect() + public function addCollect(): Response { $articleId = $this->request->post('id'); ArticleLogic::addCollect($articleId, $this->userId); @@ -96,11 +97,11 @@ class ArticleController extends BaseApiController /** * @notes 取消收藏 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 17:01 */ - public function cancelCollect() + public function cancelCollect(): Response { $articleId = $this->request->post('id'); ArticleLogic::cancelCollect($articleId, $this->userId); diff --git a/server/app/api/controller/BaseApiController.php b/server/app/api/controller/BaseApiController.php index b2e5cfb817f8f34ae9412996d48f12a0f43fde21..cb12863f748d3fb091b018d4154f525a401a2cfe 100644 --- a/server/app/api/controller/BaseApiController.php +++ b/server/app/api/controller/BaseApiController.php @@ -21,11 +21,7 @@ class BaseApiController extends BaseLikeAdminController protected int $userId = 0; protected array $userInfo = []; - public function initialize() - { - parent::initialize(); - } - public function setUser($userId,$userInfo): void + public function setUser(int $userId,array $userInfo): void { $this->userId = $userId; $this->userInfo = $userInfo; diff --git a/server/app/api/controller/IndexController.php b/server/app/api/controller/IndexController.php index d99f682e0c6445b93136e6bc563ee22d6246afb8..296bd962cd94ee1813b689bb1929a059b5e14fb1 100644 --- a/server/app/api/controller/IndexController.php +++ b/server/app/api/controller/IndexController.php @@ -16,6 +16,10 @@ namespace app\api\controller; use app\api\logic\IndexLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -32,14 +36,14 @@ class IndexController extends BaseApiController /** * @notes 首页数据 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:15 */ - public function index(): \support\Response + public function index(): Response { $result = IndexLogic::getIndexData(); return $this->data($result); @@ -48,14 +52,14 @@ class IndexController extends BaseApiController /** * @notes 全局配置 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:41 */ - public function config(): \support\Response + public function config(): Response { $result = IndexLogic::getConfigData(); return $this->data($result); @@ -64,11 +68,11 @@ class IndexController extends BaseApiController /** * @notes 政策协议 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 20:00 */ - public function policy(): \support\Response + public function policy(): Response { $type = $this->request->get('type', ''); $result = IndexLogic::getPolicyByType($type); @@ -78,11 +82,11 @@ class IndexController extends BaseApiController /** * @notes 装修信息 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/21 18:37 */ - public function decorate(): \support\Response + public function decorate(): Response { $id = $this->request->get('id'); $result = IndexLogic::getDecorate($id); diff --git a/server/app/api/controller/LoginController.php b/server/app/api/controller/LoginController.php index 6ca39d9dac379ca53bf2680723ff3617d63d81ff..f58d86960d7e3a4e7cb92782ee31883d54d9411e 100644 --- a/server/app/api/controller/LoginController.php +++ b/server/app/api/controller/LoginController.php @@ -14,8 +14,13 @@ namespace app\api\controller; +use GuzzleHttp\Exception\GuzzleException; use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate}; use app\api\logic\LoginLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 登录注册 @@ -30,11 +35,11 @@ class LoginController extends BaseApiController /** * @notes 注册账号 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/7 15:38 */ - public function register() + public function register(): Response { $params = (new RegisterValidate())->post()->goCheck('register'); $result = LoginLogic::register($params); @@ -47,11 +52,11 @@ class LoginController extends BaseApiController /** * @notes 账号密码/手机号密码/手机号验证码登录 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/16 10:42 */ - public function account() + public function account(): Response { $params = (new LoginAccountValidate())->post()->goCheck(); $result = LoginLogic::login($params); @@ -64,14 +69,14 @@ class LoginController extends BaseApiController /** * @notes 退出登录 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:42 */ - public function logout() + public function logout(): Response { LoginLogic::logout($this->userInfo); return $this->success(); @@ -80,11 +85,11 @@ class LoginController extends BaseApiController /** * @notes 获取微信请求code的链接 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/15 18:27 */ - public function codeUrl() + public function codeUrl(): Response { $url = $this->request->get('url'); $result = ['url' => LoginLogic::codeUrl($url)]; @@ -94,12 +99,12 @@ class LoginController extends BaseApiController /** * @notes 公众号登录 - * @return \support\Response - * @throws \GuzzleHttp\Exception\GuzzleException + * @return Response + * @throws GuzzleException * @author 段誉 * @date 2022/9/20 19:48 */ - public function oaLogin() + public function oaLogin(): Response { $params = (new WechatLoginValidate())->post()->goCheck('oa'); $res = LoginLogic::oaLogin($params); @@ -112,11 +117,11 @@ class LoginController extends BaseApiController /** * @notes 小程序-登录接口 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 19:48 */ - public function mnpLogin() + public function mnpLogin(): Response { $params = (new WechatLoginValidate())->post()->goCheck('mnpLogin'); $res = LoginLogic::mnpLogin($params); @@ -129,11 +134,11 @@ class LoginController extends BaseApiController /** * @notes 小程序绑定微信 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 19:48 */ - public function mnpAuthBind() + public function mnpAuthBind(): Response { $params = (new WechatLoginValidate())->post()->goCheck("wechatAuth"); $params['user_id'] = $this->userId; @@ -148,12 +153,12 @@ class LoginController extends BaseApiController /** * @notes 公众号绑定微信 - * @return \support\Response - * @throws \GuzzleHttp\Exception\GuzzleException + * @return Response + * @throws GuzzleException * @author 段誉 * @date 2022/9/20 19:48 */ - public function oaAuthBind() + public function oaAuthBind(): Response { $params = (new WechatLoginValidate())->post()->goCheck("wechatAuth"); $params['user_id'] = $this->userId; @@ -167,11 +172,11 @@ class LoginController extends BaseApiController /** * @notes 获取扫码地址 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/10/20 18:25 */ - public function getScanCode() + public function getScanCode(): Response { $redirectUri = $this->request->get('url'); $result = LoginLogic::getScanCode($redirectUri); @@ -184,11 +189,11 @@ class LoginController extends BaseApiController /** * @notes 网站扫码登录 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/10/21 10:28 */ - public function scanLogin() + public function scanLogin(): Response { $params = (new WebScanLoginValidate())->post()->goCheck(); $result = LoginLogic::scanLogin($params); @@ -201,11 +206,11 @@ class LoginController extends BaseApiController /** * @notes 更新用户头像昵称 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/22 11:15 */ - public function updateUser() + public function updateUser(): Response { $params = (new WechatLoginValidate())->post()->goCheck("updateUser"); LoginLogic::updateUser($params, $this->userId); diff --git a/server/app/api/controller/PayController.php b/server/app/api/controller/PayController.php index 3a1fa8d7c03546d75a0d7dec8267f0334988bfda..0f75fabc9847429336db64eaeaf3c82f46c6c8a3 100644 --- a/server/app/api/controller/PayController.php +++ b/server/app/api/controller/PayController.php @@ -19,6 +19,12 @@ use app\api\validate\PayValidate; use app\common\enum\user\UserTerminalEnum; use app\common\logic\PaymentLogic; use app\common\service\pay\WeChatPayService; +use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; +use EasyWeChat\Kernel\Exceptions\RuntimeException; +use Psr\Http\Message\ResponseInterface; +use ReflectionException; +use support\Response; +use Throwable; /** * 支付 @@ -32,11 +38,11 @@ class PayController extends BaseApiController /** * @notes 支付方式 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 17:54 */ - public function payWay() + public function payWay(): Response { $params = (new PayValidate())->goCheck('payway'); $result = PaymentLogic::getPayWay($this->userId, $this->userInfo['terminal'], $params); @@ -49,11 +55,11 @@ class PayController extends BaseApiController /** * @notes 预支付 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/28 14:21 */ - public function prepay() + public function prepay(): Response { $params = (new PayValidate())->post()->goCheck(); //订单信息 @@ -73,11 +79,11 @@ class PayController extends BaseApiController /** * @notes 获取支付状态 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/3/1 16:23 */ - public function payStatus() + public function payStatus(): Response { $params = (new PayValidate())->goCheck('status', ['user_id' => $this->userId]); $result = PaymentLogic::getPayStatus($params); @@ -90,15 +96,15 @@ class PayController extends BaseApiController /** * @notes 小程序支付回调 - * @return \Psr\Http\Message\ResponseInterface - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException - * @throws \ReflectionException - * @throws \Throwable + * @return ResponseInterface + * @throws InvalidArgumentException + * @throws RuntimeException + * @throws ReflectionException + * @throws Throwable * @author 段誉 * @date 2023/2/28 14:21 */ - public function notifyMnp() + public function notifyMnp(): ResponseInterface { return (new WeChatPayService(UserTerminalEnum::WECHAT_MMP))->notify(); } @@ -106,15 +112,15 @@ class PayController extends BaseApiController /** * @notes 公众号支付回调 - * @return \Psr\Http\Message\ResponseInterface - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException - * @throws \ReflectionException - * @throws \Throwable + * @return ResponseInterface + * @throws InvalidArgumentException + * @throws RuntimeException + * @throws ReflectionException + * @throws Throwable * @author 段誉 * @date 2023/2/28 14:21 */ - public function notifyOa() + public function notifyOa(): ResponseInterface { return (new WeChatPayService(UserTerminalEnum::WECHAT_OA))->notify(); } diff --git a/server/app/api/controller/PcController.php b/server/app/api/controller/PcController.php index e7c6fde17f7f3c44432ba9113a31832f28046664..e1f0bdbaabef0de515dd05727bd576e41e88f54a 100644 --- a/server/app/api/controller/PcController.php +++ b/server/app/api/controller/PcController.php @@ -16,6 +16,10 @@ namespace app\api\controller; use app\api\logic\PcLogic; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\response\Json; @@ -32,14 +36,14 @@ class PcController extends BaseApiController /** * @notes 首页数据 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:15 */ - public function index() + public function index(): Response { $result = PcLogic::getIndexData(); return $this->data($result); @@ -48,14 +52,14 @@ class PcController extends BaseApiController /** * @notes 全局配置 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:41 */ - public function config() + public function config(): Response { $result = PcLogic::getConfigData(); return $this->data($result); @@ -64,14 +68,14 @@ class PcController extends BaseApiController /** * @notes 资讯中心 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/10/19 16:55 */ - public function infoCenter() + public function infoCenter(): Response { $result = PcLogic::getInfoCenter(); return $this->data($result); @@ -80,11 +84,11 @@ class PcController extends BaseApiController /** * @notes 获取文章详情 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/10/20 15:18 */ - public function articleDetail() + public function articleDetail(): Response { $id = $this->request->get('id', 0); $source = $this->request->get('source', 'default'); diff --git a/server/app/api/controller/RechargeController.php b/server/app/api/controller/RechargeController.php index b6e853402d7cc60cd3d6519952acb9b123a6fd7b..53b594782fecf8e4ef7e905d5b1c010eb1ad6aa3 100644 --- a/server/app/api/controller/RechargeController.php +++ b/server/app/api/controller/RechargeController.php @@ -16,6 +16,7 @@ namespace app\api\controller; use app\api\lists\recharge\RechargeLists; use app\api\logic\RechargeLogic; use app\api\validate\RechargeValidate; +use support\Response; /** @@ -28,11 +29,11 @@ class RechargeController extends BaseApiController /** * @notes 获取充值列表 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/23 18:55 */ - public function lists() + public function lists(): Response { return $this->dataLists(new RechargeLists()); } @@ -40,11 +41,11 @@ class RechargeController extends BaseApiController /** * @notes 充值 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/23 18:56 */ - public function recharge() + public function recharge(): Response { $params = (new RechargeValidate())->post()->goCheck('recharge', [ 'user_id' => $this->userId, @@ -60,11 +61,11 @@ class RechargeController extends BaseApiController /** * @notes 充值配置 - * @return \support\Response + * @return Response * @author 段誉 * @date 2023/2/24 16:56 */ - public function config() + public function config(): Response { return $this->data(RechargeLogic::config($this->userId)); } diff --git a/server/app/api/controller/SearchController.php b/server/app/api/controller/SearchController.php index a43593d106fe7e4a008cbf19877134e518926062..4f51020bb7c02c68f5cc988c77af152cac28d343 100644 --- a/server/app/api/controller/SearchController.php +++ b/server/app/api/controller/SearchController.php @@ -16,6 +16,7 @@ namespace app\api\controller; use app\api\logic\SearchLogic; +use support\Response; /** * 搜索 @@ -29,11 +30,11 @@ class SearchController extends BaseApiController /** * @notes 热门搜素 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/22 10:14 */ - public function hotLists() + public function hotLists(): Response { return $this->data(SearchLogic::hotLists()); } diff --git a/server/app/api/controller/SmsController.php b/server/app/api/controller/SmsController.php index 7325f75420748005f2a31fdfcfd41aeec365913f..1c2587ab01c770f99c4e8f532aa4d6f2bbb218d4 100644 --- a/server/app/api/controller/SmsController.php +++ b/server/app/api/controller/SmsController.php @@ -17,6 +17,7 @@ namespace app\api\controller; use app\api\logic\SmsLogic; use app\api\validate\SendSmsValidate; +use support\Response; /** @@ -32,11 +33,11 @@ class SmsController extends BaseApiController /** * @notes 发送短信验证码 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/15 16:17 */ - public function sendCode() + public function sendCode(): Response { $params = (new SendSmsValidate())->post()->goCheck(); $result = SmsLogic::sendCode($params); diff --git a/server/app/api/controller/UploadController.php b/server/app/api/controller/UploadController.php index 32a33227531b72634d9137e6ad1fdbe74bdfe49a..f67ba0074b10f2336f5389b387791f1093b934aa 100644 --- a/server/app/api/controller/UploadController.php +++ b/server/app/api/controller/UploadController.php @@ -17,6 +17,7 @@ namespace app\api\controller; use app\common\enum\FileEnum; use app\common\service\UploadService; use Exception; +use support\Response; use think\response\Json; @@ -31,9 +32,9 @@ class UploadController extends BaseApiController * @notes 上传图片 * @author 段誉 * @date 2022/9/20 18:11 - * @return \support\Response + * @return Response */ - public function image(): \support\Response + public function image(): Response { $uploadObj = (new UploadService()); $result = $uploadObj->image(0,$this->userId,FileEnum::SOURCE_USER); @@ -45,9 +46,9 @@ class UploadController extends BaseApiController /** * 获取上传凭证 - * @return \support\Response + * @return Response */ - public function getUploadToken(): \support\Response + public function getUploadToken(): Response { $name = $this->request->post('name', ''); diff --git a/server/app/api/controller/UserController.php b/server/app/api/controller/UserController.php index 62d40dc755a4439c6c147d9db37ea6cfcfbf74b5..022c3ce33301a76252e8fc526945db78d0725099 100644 --- a/server/app/api/controller/UserController.php +++ b/server/app/api/controller/UserController.php @@ -18,6 +18,10 @@ use app\api\logic\UserLogic; use app\api\validate\PasswordValidate; use app\api\validate\SetUserInfoValidate; use app\api\validate\UserValidate; +use support\Response; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 用户控制器 @@ -31,14 +35,14 @@ class UserController extends BaseApiController /** * @notes 获取个人中心 - * @return \support\Response - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @return Response + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 18:19 */ - public function center() + public function center(): Response { $data = UserLogic::center($this->userInfo); return $this->success('', $data); @@ -47,11 +51,11 @@ class UserController extends BaseApiController /** * @notes 获取个人信息 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 19:46 */ - public function info() + public function info(): Response { $result = UserLogic::info($this->userId); return $this->data($result); @@ -60,11 +64,11 @@ class UserController extends BaseApiController /** * @notes 重置密码 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/16 18:06 */ - public function resetPassword() + public function resetPassword(): Response { $params = (new PasswordValidate())->post()->goCheck('resetPassword'); $result = UserLogic::resetPassword($params); @@ -77,11 +81,11 @@ class UserController extends BaseApiController /** * @notes 修改密码 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/20 19:16 */ - public function changePassword() + public function changePassword(): Response { $params = (new PasswordValidate())->post()->goCheck('changePassword'); $result = UserLogic::changePassword($params, $this->userId); @@ -94,11 +98,11 @@ class UserController extends BaseApiController /** * @notes 获取小程序手机号 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/21 16:46 */ - public function getMobileByMnp() + public function getMobileByMnp(): Response { $params = (new UserValidate())->post()->goCheck('getMobileByMnp'); $params['user_id'] = $this->userId; @@ -112,11 +116,11 @@ class UserController extends BaseApiController /** * @notes 编辑用户信息 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/21 17:01 */ - public function setInfo() + public function setInfo(): Response { $params = (new SetUserInfoValidate())->post()->goCheck(null, ['id' => $this->userId]); $result = UserLogic::setInfo($this->userId, $params); @@ -129,11 +133,11 @@ class UserController extends BaseApiController /** * @notes 绑定/变更 手机号 - * @return \support\Response + * @return Response * @author 段誉 * @date 2022/9/21 17:29 */ - public function bindMobile() + public function bindMobile(): Response { $params = (new UserValidate())->post()->goCheck('bindMobile'); $params['user_id'] = $this->userId; diff --git a/server/app/api/controller/WechatController.php b/server/app/api/controller/WechatController.php index f7c1d9a7908c6520aa31b990883bd11614385be9..63519c082f83c7b6a574a566d09ec43b5c3cd62a 100644 --- a/server/app/api/controller/WechatController.php +++ b/server/app/api/controller/WechatController.php @@ -16,6 +16,7 @@ namespace app\api\controller; use app\api\logic\WechatLogic; use app\api\validate\WechatValidate; +use support\Response; /** @@ -34,7 +35,7 @@ class WechatController extends BaseApiController * @author 段誉 * @date 2023/3/1 11:39 */ - public function jsConfig() + public function jsConfig(): Response { $params = (new WechatValidate())->goCheck('jsConfig'); $result = WechatLogic::jsConfig($params); diff --git a/server/app/api/lists/AccountLogLists.php b/server/app/api/lists/AccountLogLists.php index 699e03386bb06114963764c77f4a0ccb99df8820..b169b9e72cf15637960195a9c9e0117348a09f62 100644 --- a/server/app/api/lists/AccountLogLists.php +++ b/server/app/api/lists/AccountLogLists.php @@ -16,6 +16,9 @@ namespace app\api\lists; use app\common\enum\user\AccountLogEnum; use app\common\model\user\UserAccountLog; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -32,7 +35,7 @@ class AccountLogLists extends BaseApiDataLists * @author 段誉 * @date 2023/2/24 14:43 */ - public function queryWhere() + public function queryWhere(): array { // 指定用户 $where[] = ['user_id', '=', $this->userId]; @@ -54,9 +57,9 @@ class AccountLogLists extends BaseApiDataLists /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/24 14:43 */ diff --git a/server/app/api/lists/BaseApiDataLists.php b/server/app/api/lists/BaseApiDataLists.php index c1c3f2a74e1bc065ac22251a3b03a030fa526e41..ee4a6b36400ad3d22445bf4ad8a95fd37b44f478 100644 --- a/server/app/api/lists/BaseApiDataLists.php +++ b/server/app/api/lists/BaseApiDataLists.php @@ -21,7 +21,7 @@ abstract class BaseApiDataLists extends BaseDataLists protected array $userInfo = []; protected int $userId = 0; - public $export; + public int $export; public function __construct() { diff --git a/server/app/api/lists/article/ArticleLists.php b/server/app/api/lists/article/ArticleLists.php index f1485853774b541f8dfd9097dcf9ece9a6379df8..8c07cc60a7355b6e4fe65387c51a303237107c01 100644 --- a/server/app/api/lists/article/ArticleLists.php +++ b/server/app/api/lists/article/ArticleLists.php @@ -19,6 +19,9 @@ use app\common\enum\YesNoEnum; use app\common\lists\ListsSearchInterface; use app\common\model\article\Article; use app\common\model\article\ArticleCollect; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -31,7 +34,7 @@ class ArticleLists extends BaseApiDataLists implements ListsSearchInterface /** * @notes 搜索条件 - * @return \string[][] + * @return string[][] * @author 段誉 * @date 2022/9/16 18:54 */ @@ -49,7 +52,7 @@ class ArticleLists extends BaseApiDataLists implements ListsSearchInterface * @author 段誉 * @date 2022/10/25 16:53 */ - public function queryWhere() + public function queryWhere(): array { $where[] = ['is_show', '=', 1]; if (!empty($this->params['keyword'])) { @@ -62,9 +65,9 @@ class ArticleLists extends BaseApiDataLists implements ListsSearchInterface /** * @notes 获取文章列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 18:55 */ diff --git a/server/app/api/lists/recharge/RechargeLists.php b/server/app/api/lists/recharge/RechargeLists.php index bdafa39c1b5794d4ca53d54647330e6ff6cbaaaf..0c84f58fdb2244ce9b4eef91b0fe68b00897bf96 100644 --- a/server/app/api/lists/recharge/RechargeLists.php +++ b/server/app/api/lists/recharge/RechargeLists.php @@ -17,6 +17,9 @@ namespace app\api\lists\recharge; use app\api\lists\BaseApiDataLists; use app\common\enum\PayEnum; use app\common\model\recharge\RechargeOrder; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -29,9 +32,9 @@ class RechargeLists extends BaseApiDataLists /** * @notes 获取列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2023/2/23 18:43 */ diff --git a/server/app/api/logic/ArticleLogic.php b/server/app/api/logic/ArticleLogic.php index f3e9b8f72bbd43af59bda220552b54ddc2e2789d..165ee1a86ea95e7c4349fff9c7084dffed93eb74 100644 --- a/server/app/api/logic/ArticleLogic.php +++ b/server/app/api/logic/ArticleLogic.php @@ -19,6 +19,9 @@ use app\common\logic\BaseLogic; use app\common\model\article\Article; use app\common\model\article\ArticleCate; use app\common\model\article\ArticleCollect; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -37,7 +40,7 @@ class ArticleLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 17:09 */ - public static function detail($articleId, $userId) + public static function detail($articleId, $userId): array { // 文章详情 $article = Article::getArticleDetailArr($articleId); @@ -55,7 +58,7 @@ class ArticleLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 16:52 */ - public static function addCollect($articleId, $userId) + public static function addCollect($articleId, $userId): void { $where = ['user_id' => $userId, 'article_id' => $articleId]; $collect = ArticleCollect::where($where)->findOrEmpty(); @@ -81,7 +84,7 @@ class ArticleLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 16:59 */ - public static function cancelCollect($articleId, $userId) + public static function cancelCollect($articleId, $userId): void { ArticleCollect::update(['status' => YesNoEnum::NO], [ 'user_id' => $userId, @@ -94,13 +97,13 @@ class ArticleLogic extends BaseLogic /** * @notes 文章分类 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/23 14:11 */ - public static function cate() + public static function cate(): array { return ArticleCate::field('id,name') ->where('is_show', '=', 1) diff --git a/server/app/api/logic/IndexLogic.php b/server/app/api/logic/IndexLogic.php index fe1e73991811cfc5480bd01a9448f96c2e81dc46..eb93c02bd755e7000233935d458148cca76adc37 100644 --- a/server/app/api/logic/IndexLogic.php +++ b/server/app/api/logic/IndexLogic.php @@ -21,6 +21,9 @@ use app\common\model\decorate\DecoratePage; use app\common\model\decorate\DecorateTabbar; use app\common\service\ConfigService; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -34,9 +37,9 @@ class IndexLogic extends BaseLogic /** * @notes 首页数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:15 */ @@ -98,9 +101,9 @@ class IndexLogic extends BaseLogic /** * @notes 获取配置 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:38 */ diff --git a/server/app/api/logic/LoginLogic.php b/server/app/api/logic/LoginLogic.php index fccfd8f54e37aa172c0e95c730c1d32aa2029708..0758e0717af3ebc76c5effe5c56ff80d586bd05f 100644 --- a/server/app/api/logic/LoginLogic.php +++ b/server/app/api/logic/LoginLogic.php @@ -16,6 +16,11 @@ namespace app\api\logic; use app\common\cache\WebScanLoginCache; use app\common\logic\BaseLogic; +use Exception; +use GuzzleHttp\Exception\GuzzleException; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\facade\Db; use app\api\service\{UserTokenService, WechatUserService}; use app\common\enum\{LoginEnum, user\UserTerminalEnum, YesNoEnum}; @@ -45,7 +50,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/7 15:37 */ - public static function register(array $params) + public static function register(array $params): bool { try { $userSn = User::createUserSn(); @@ -63,7 +68,7 @@ class LoginLogic extends BaseLogic ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -77,7 +82,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/6 19:26 */ - public static function login($params) + public static function login($params): false|array { try { // 账号/手机号 密码登录 @@ -89,7 +94,7 @@ class LoginLogic extends BaseLogic $user = User::where($where)->findOrEmpty(); if ($user->isEmpty()) { - throw new \Exception('用户不存在'); + throw new Exception('用户不存在'); } //更新登录信息 @@ -111,7 +116,7 @@ class LoginLogic extends BaseLogic 'avatar' => $avatar, 'token' => $userInfo['token'], ]; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -122,13 +127,13 @@ class LoginLogic extends BaseLogic * @notes 退出登录 * @param $userInfo * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 17:56 */ - public static function logout($userInfo) + public static function logout($userInfo): bool { //token不存在,不注销 if (!isset($userInfo['token'])) { @@ -147,7 +152,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:47 */ - public static function codeUrl(string $url) + public static function codeUrl(string $url): string { return (new WeChatOaService())->getCodeUrl($url); } @@ -157,11 +162,11 @@ class LoginLogic extends BaseLogic * @notes 公众号登录 * @param array $params * @return array|false - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/9/20 19:47 */ - public static function oaLogin(array $params) + public static function oaLogin(array $params): false|array { Db::startTrans(); try { @@ -176,7 +181,7 @@ class LoginLogic extends BaseLogic Db::commit(); return $userInfo; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -191,7 +196,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:47 */ - public static function silentLogin(array $params) + public static function silentLogin(array $params): false|array { try { //通过code获取微信 openid @@ -205,7 +210,7 @@ class LoginLogic extends BaseLogic } return $userInfo; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -219,7 +224,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:47 */ - public static function mnpLogin(array $params) + public static function mnpLogin(array $params): false|array { Db::startTrans(); try { @@ -233,7 +238,7 @@ class LoginLogic extends BaseLogic Db::commit(); return $userInfo; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -244,15 +249,15 @@ class LoginLogic extends BaseLogic /** * @notes 更新登录信息 * @param $userId - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/20 19:46 */ - public static function updateLoginInfo($userId) + public static function updateLoginInfo($userId): void { $user = User::findOrEmpty($userId); if ($user->isEmpty()) { - throw new \Exception('用户不存在'); + throw new Exception('用户不存在'); } $time = time(); @@ -270,7 +275,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:46 */ - public static function mnpAuthLogin(array $params) + public static function mnpAuthLogin(array $params): bool { try { //通过code获取微信openid @@ -280,7 +285,7 @@ class LoginLogic extends BaseLogic return self::createAuth($response); - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -291,11 +296,11 @@ class LoginLogic extends BaseLogic * @notes 公众号端绑定微信 * @param array $params * @return bool - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/9/16 10:43 */ - public static function oaAuthLogin(array $params) + public static function oaAuthLogin(array $params): bool { try { //通过code获取微信openid @@ -305,7 +310,7 @@ class LoginLogic extends BaseLogic return self::createAuth($response); - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -316,16 +321,16 @@ class LoginLogic extends BaseLogic * @notes 生成授权记录 * @param $response * @return bool - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/16 10:43 */ - public static function createAuth($response) + public static function createAuth($response): bool { //先检查openid是否有记录 $isAuth = UserAuth::where('openid', '=', $response['openid'])->findOrEmpty(); if (!$isAuth->isEmpty()) { - throw new \Exception('该微信已被绑定'); + throw new Exception('该微信已被绑定'); } if (isset($response['unionid']) && !empty($response['unionid'])) { @@ -333,7 +338,7 @@ class LoginLogic extends BaseLogic $userAuth = UserAuth::where(['unionid' => $response['unionid']]) ->findOrEmpty(); if (!$userAuth->isEmpty() && $userAuth->user_id != $response['user_id']) { - throw new \Exception('该微信已被绑定'); + throw new Exception('该微信已被绑定'); } } @@ -354,7 +359,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/10/20 18:23 */ - public static function getScanCode($redirectUri) + public static function getScanCode($redirectUri): false|array { try { $config = WeChatConfigService::getOpConfig(); @@ -369,7 +374,7 @@ class LoginLogic extends BaseLogic $url = WeChatRequestService::getScanCodeUrl($appId, $redirectUri, $state); return ['url' => $url]; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -383,7 +388,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/10/21 10:28 */ - public static function scanLogin($params) + public static function scanLogin($params): false|array { Db::startTrans(); try { @@ -391,7 +396,7 @@ class LoginLogic extends BaseLogic $userAuth = WeChatRequestService::getUserAuthByCode($params['code']); if (empty($userAuth['openid']) || empty($userAuth['access_token'])) { - throw new \Exception('获取用户授权信息失败'); + throw new Exception('获取用户授权信息失败'); } // 获取微信用户信息 @@ -407,7 +412,7 @@ class LoginLogic extends BaseLogic Db::commit(); return $userInfo; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); self::$error = $e->getMessage(); return false; @@ -423,7 +428,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2023/2/22 11:19 */ - public static function updateUser($params, $userId) + public static function updateUser($params, $userId): User { return User::where(['id' => $userId])->update([ 'nickname' => $params['nickname'], diff --git a/server/app/api/logic/PcLogic.php b/server/app/api/logic/PcLogic.php index 8c0ba69bd278cc727fbbf5710ac6cb97784f8f13..9ca463cae4904c1e1e5b17518a24b81e6d9bdeab 100644 --- a/server/app/api/logic/PcLogic.php +++ b/server/app/api/logic/PcLogic.php @@ -23,6 +23,9 @@ use app\common\model\article\ArticleCollect; use app\common\model\decorate\DecoratePage; use app\common\service\ConfigService; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** @@ -36,13 +39,13 @@ class PcLogic extends BaseLogic /** * @notes 首页数据 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:15 */ - public static function getIndexData() + public static function getIndexData(): array { // 装修配置 $decoratePage = DecoratePage::findOrEmpty(4); @@ -113,9 +116,9 @@ class PcLogic extends BaseLogic /** * @notes 获取配置 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/21 19:38 */ @@ -176,9 +179,9 @@ class PcLogic extends BaseLogic /** * @notes 资讯中心 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/10/19 16:55 */ diff --git a/server/app/api/logic/RechargeLogic.php b/server/app/api/logic/RechargeLogic.php index fd60ac4bb8cb22bbd0d75a6d8e70c0d53744b59f..7c70412dea46935fb0c6b7ff8a415af3bb0a9e05 100644 --- a/server/app/api/logic/RechargeLogic.php +++ b/server/app/api/logic/RechargeLogic.php @@ -19,6 +19,7 @@ use app\common\logic\BaseLogic; use app\common\model\recharge\RechargeOrder; use app\common\model\user\User; use app\common\service\ConfigService; +use Exception; /** @@ -36,7 +37,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/2/24 10:43 */ - public static function recharge(array $params) + public static function recharge(array $params): false|array { try { $data = [ @@ -52,7 +53,7 @@ class RechargeLogic extends BaseLogic 'order_id' => (int)$order['id'], 'from' => 'recharge' ]; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -66,7 +67,7 @@ class RechargeLogic extends BaseLogic * @author 段誉 * @date 2023/2/24 16:56 */ - public static function config($userId) + public static function config($userId): array { $userMoney = User::where(['id' => $userId])->value('user_money'); $minAmount = ConfigService::get('recharge', 'min_amount', 0); diff --git a/server/app/api/logic/SearchLogic.php b/server/app/api/logic/SearchLogic.php index c461517273617314f47f1cc50866de25a7e8e742..9a5d8e49255614f05a063bb639b39ca827ce916b 100644 --- a/server/app/api/logic/SearchLogic.php +++ b/server/app/api/logic/SearchLogic.php @@ -18,6 +18,9 @@ namespace app\api\logic; use app\common\logic\BaseLogic; use app\common\model\HotSearch; use app\common\service\ConfigService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 搜索逻辑 @@ -30,13 +33,13 @@ class SearchLogic extends BaseLogic /** * @notes 热搜列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/23 14:34 */ - public static function hotLists() + public static function hotLists(): array { $data = HotSearch::field(['name', 'sort']) ->order(['sort' => 'desc', 'id' => 'desc']) diff --git a/server/app/api/logic/SmsLogic.php b/server/app/api/logic/SmsLogic.php index d1b5a4938a7175b2faeccf57e25d1c7126543855..4bc5639438722a293a2c7c62b78d08f5eed80df7 100644 --- a/server/app/api/logic/SmsLogic.php +++ b/server/app/api/logic/SmsLogic.php @@ -17,6 +17,7 @@ namespace app\api\logic; use app\common\enum\notice\NoticeEnum; use app\common\logic\BaseLogic; use app\common\service\NoticeService; +use Exception; /** @@ -34,12 +35,12 @@ class SmsLogic extends BaseLogic * @author 段誉 * @date 2022/9/15 16:17 */ - public static function sendCode($params) + public static function sendCode($params): mixed { try { $scene = NoticeEnum::getSceneByTag($params['scene']); if (empty($scene)) { - throw new \Exception('场景值异常'); + throw new Exception('场景值异常'); } $result = (new NoticeService())->handle([ 'scene_id' => $scene, @@ -50,7 +51,7 @@ class SmsLogic extends BaseLogic ]); return $result[0]; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } diff --git a/server/app/api/logic/UserLogic.php b/server/app/api/logic/UserLogic.php index a8330e34167edd202fb2971af309008b675b70b5..c7f7a09450142263de2f7335357d23b3db4ba659 100644 --- a/server/app/api/logic/UserLogic.php +++ b/server/app/api/logic/UserLogic.php @@ -23,6 +23,11 @@ use app\common\{enum\notice\NoticeEnum, model\user\UserAuth, service\sms\SmsDriver, service\wechat\WeChatMnpService}; +use Exception; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use Webman\Config; /** @@ -37,9 +42,9 @@ class UserLogic extends BaseLogic * @notes 个人中心 * @param array $userInfo * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 18:04 */ @@ -67,7 +72,7 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:45 */ - public static function info(int $userId) + public static function info(int $userId): array { $user = User::where(['id' => $userId]) ->field('id,sn,sex,account,password,nickname,real_name,avatar,mobile,create_time,user_money') @@ -88,14 +93,14 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/21 16:53 */ - public static function setInfo(int $userId, array $params) + public static function setInfo(int $userId, array $params): User|false { try { return User::update([ 'id' => $userId, $params['field'] => $params['value']] ); - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -109,7 +114,7 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:36 */ - public static function hasWechatAuth(int $userId) + public static function hasWechatAuth(int $userId): bool { //是否有微信授权登录 $terminal = [UserTerminalEnum::WECHAT_MMP, UserTerminalEnum::WECHAT_OA,UserTerminalEnum::PC]; @@ -127,13 +132,13 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/16 18:06 */ - public static function resetPassword(array $params) + public static function resetPassword(array $params): bool { try { // 校验验证码 $smsDriver = new SmsDriver(); if (!$smsDriver->verify($params['mobile'], $params['code'], NoticeEnum::FIND_LOGIN_PASSWORD_CAPTCHA)) { - throw new \Exception('验证码错误'); + throw new Exception('验证码错误'); } // 重置密码 @@ -146,7 +151,7 @@ class UserLogic extends BaseLogic ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -161,12 +166,12 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:13 */ - public static function changePassword(array $params, int $userId) + public static function changePassword(array $params, int $userId): bool { try { $user = User::findOrEmpty($userId); if ($user->isEmpty()) { - throw new \Exception('用户不存在'); + throw new Exception('用户不存在'); } // 密码盐 @@ -174,11 +179,11 @@ class UserLogic extends BaseLogic if (!empty($user['password'])) { if (empty($params['old_password'])) { - throw new \Exception('请填写旧密码'); + throw new Exception('请填写旧密码'); } $oldPassword = create_password($params['old_password'], $passwordSalt); if ($oldPassword != $user['password']) { - throw new \Exception('原密码不正确'); + throw new Exception('原密码不正确'); } } @@ -188,7 +193,7 @@ class UserLogic extends BaseLogic $user->save(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -199,17 +204,17 @@ class UserLogic extends BaseLogic * @notes 获取小程序手机号 * @param array $params * @return bool - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws TransportExceptionInterface * @author 段誉 * @date 2023/2/27 11:49 */ - public static function getMobileByMnp(array $params) + public static function getMobileByMnp(array $params): bool { try { $response = (new WeChatMnpService())->getUserPhoneNumber($params['code']); $phoneNumber = $response['phone_info']['purePhoneNumber'] ?? ''; if (empty($phoneNumber)) { - throw new \Exception('获取手机号码失败'); + throw new Exception('获取手机号码失败'); } $user = User::where([ @@ -218,7 +223,7 @@ class UserLogic extends BaseLogic ])->findOrEmpty(); if (!$user->isEmpty()) { - throw new \Exception('手机号已被其他账号绑定'); + throw new Exception('手机号已被其他账号绑定'); } // 绑定手机号 @@ -228,7 +233,7 @@ class UserLogic extends BaseLogic ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -242,7 +247,7 @@ class UserLogic extends BaseLogic * @author 段誉 * @date 2022/9/21 17:28 */ - public static function bindMobile(array $params) + public static function bindMobile(array $params): bool { try { // 变更手机号场景 @@ -263,12 +268,12 @@ class UserLogic extends BaseLogic // 校验短信 $checkSmsCode = (new SmsDriver())->verify($params['mobile'], $params['code'], $sceneId); if (!$checkSmsCode) { - throw new \Exception('验证码错误'); + throw new Exception('验证码错误'); } $user = User::where($where)->findOrEmpty(); if (!$user->isEmpty()) { - throw new \Exception('该手机号已被使用'); + throw new Exception('该手机号已被使用'); } User::update([ @@ -277,7 +282,7 @@ class UserLogic extends BaseLogic ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } diff --git a/server/app/api/logic/WechatLogic.php b/server/app/api/logic/WechatLogic.php index 691399ebf42a3ef477968faf916e82230fbc8f55..a610b78c50a5b920cc66948954a9aca3da6f75c3 100644 --- a/server/app/api/logic/WechatLogic.php +++ b/server/app/api/logic/WechatLogic.php @@ -17,6 +17,7 @@ namespace app\api\logic; use app\common\logic\BaseLogic; use app\common\service\wechat\WeChatOaService; use EasyWeChat\Kernel\Exceptions\Exception; +use Psr\SimpleCache\InvalidArgumentException; /** * 微信 @@ -30,11 +31,11 @@ class WechatLogic extends BaseLogic * @notes 微信JSSDK授权接口 * @param $params * @return false|mixed[] - * @throws \Psr\SimpleCache\InvalidArgumentException + * @throws InvalidArgumentException * @author 段誉 * @date 2023/3/1 11:49 */ - public static function jsConfig($params) + public static function jsConfig($params): array|false { try { $url = urldecode($params['url']); diff --git a/server/app/api/middleware/LoginMiddleware.php b/server/app/api/middleware/LoginMiddleware.php index e06c7a5a93d7a636a5c4e45ec66248a492cda5cb..c33e3495e7589de8a1fba05bd85a14013f5f6883 100644 --- a/server/app/api/middleware/LoginMiddleware.php +++ b/server/app/api/middleware/LoginMiddleware.php @@ -63,6 +63,9 @@ class LoginMiddleware implements MiddlewareInterface //给request赋值,用于控制器 $userId = $userInfo['user_id'] ?? 0; + if (!$userInfo){ + $userInfo = []; + } $controllerObject->setUser($userId,$userInfo); return $handler($request); diff --git a/server/app/api/service/UserTokenService.php b/server/app/api/service/UserTokenService.php index 5c90dafd7036df10e1bc698cb192f704784ba077..249abd7cb000d33a02839523654e6ee9f9acc719 100644 --- a/server/app/api/service/UserTokenService.php +++ b/server/app/api/service/UserTokenService.php @@ -17,6 +17,9 @@ namespace app\api\service; use app\common\cache\UserTokenCache; use app\common\model\user\UserSession; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use Webman\Config; class UserTokenService @@ -24,16 +27,16 @@ class UserTokenService /** * @notes 设置或更新用户token - * @param $userId - * @param $terminal + * @param int $userId + * @param int $terminal * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:10 */ - public static function setToken($userId, $terminal) + public static function setToken(int $userId,int $terminal): mixed { $time = time(); $userSession = UserSession::where([['user_id', '=', $userId], ['terminal', '=', $terminal]])->find(); @@ -67,15 +70,15 @@ class UserTokenService /** * @notes 延长token过期时间 - * @param $token + * @param string $token * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:10 */ - public static function overtimeToken($token) + public static function overtimeToken(string $token): mixed { $time = time(); $adminSession = UserSession::where('token', '=', $token)->find(); @@ -90,15 +93,15 @@ class UserTokenService /** * @notes 设置token为过期 - * @param $token + * @param string $token * @return bool - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:10 */ - public static function expireToken($token) + public static function expireToken(string $token): bool { $userSession = UserSession::where('token', '=', $token) ->find(); diff --git a/server/app/api/service/WechatUserService.php b/server/app/api/service/WechatUserService.php index 6f1e8bc6a7bec2a45cccb230b77f43bc839395c4..f35552f0fe30fab97a5857502defcfb4d72c5fb8 100644 --- a/server/app/api/service/WechatUserService.php +++ b/server/app/api/service/WechatUserService.php @@ -16,6 +16,9 @@ namespace app\api\service; use app\common\enum\YesNoEnum; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use app\common\model\user\{User, UserAuth}; use app\common\enum\user\UserTerminalEnum; use app\common\service\{ConfigService, storage\Driver as StorageDriver}; @@ -32,11 +35,11 @@ class WechatUserService protected int $terminal = UserTerminalEnum::WECHAT_MMP; protected array $response = []; - protected ?string $code = null; - protected ?string $openid = null; - protected ?string $unionid = null; - protected ?string $nickname = null; - protected ?string $headimgurl = null; + protected string|null $code = null; + protected string|null $openid = null; + protected string|null $unionid = null; + protected string|null $nickname = null; + protected string|null $headimgurl = null; protected User $user; @@ -98,7 +101,7 @@ class WechatUserService * @author cjhao * @date 2021/8/3 11:42 */ - public function getUserInfo($isCheck = true): array + public function getUserInfo(bool $isCheck = true): array { if (!$this->user->isEmpty() && $isCheck) { $this->checkAccount(); @@ -116,7 +119,7 @@ class WechatUserService * @author 段誉 * @date 2022/9/16 10:14 */ - private function checkAccount() + private function checkAccount(): void { if ($this->user->is_disable) { throw new Exception('您的账号异常,请联系客服。'); @@ -197,9 +200,9 @@ class WechatUserService /** * @notes 获取token - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author cjhao * @date 2021/8/2 16:45 */ diff --git a/server/app/api/validate/LoginAccountValidate.php b/server/app/api/validate/LoginAccountValidate.php index 3885775fee9b04d5a545519c7a5f018b340ad1c7..00a2a3dd961264e3c0507002809bedefe0f83c64 100644 --- a/server/app/api/validate/LoginAccountValidate.php +++ b/server/app/api/validate/LoginAccountValidate.php @@ -61,7 +61,7 @@ class LoginAccountValidate extends BaseValidate * @author 段誉 * @date 2022/9/15 14:37 */ - public function checkConfig($scene, $rule, $data) + public function checkConfig($scene, $rule, $data): bool|string { $config = ConfigService::get('login', 'login_way'); if (!in_array($scene, $config)) { @@ -97,7 +97,7 @@ class LoginAccountValidate extends BaseValidate * @author 段誉 * @date 2022/9/15 14:39 */ - public function checkPassword($password, $other, $data) + public function checkPassword($password, $other, $data): bool|string { //账号安全机制,连续输错后锁定,防止账号密码暴力破解 $userAccountSafeCache = new UserAccountSafeCache(); @@ -150,7 +150,7 @@ class LoginAccountValidate extends BaseValidate * @author Tab * @date 2021/8/25 15:43 */ - public function checkCode($code, $rule, $data) + public function checkCode($code, $rule, $data): bool|string { $smsDriver = new SmsDriver(); $result = $smsDriver->verify($data['account'], $code, NoticeEnum::LOGIN_CAPTCHA); diff --git a/server/app/api/validate/PasswordValidate.php b/server/app/api/validate/PasswordValidate.php index a2277304b232b431ee394cf355413df9a2e2048a..da86c46f6fded79f86cfbc4bbba2df8ef7079fb2 100644 --- a/server/app/api/validate/PasswordValidate.php +++ b/server/app/api/validate/PasswordValidate.php @@ -49,7 +49,7 @@ class PasswordValidate extends BaseValidate * @author 段誉 * @date 2022/9/16 18:11 */ - public function sceneResetPassword() + public function sceneResetPassword(): PasswordValidate { return $this->only(['mobile', 'code', 'password', 'password_confirm']); } @@ -61,7 +61,7 @@ class PasswordValidate extends BaseValidate * @author 段誉 * @date 2022/9/20 19:14 */ - public function sceneChangePassword() + public function sceneChangePassword(): PasswordValidate { return $this->only(['password', 'password_confirm']); } diff --git a/server/app/api/validate/PayValidate.php b/server/app/api/validate/PayValidate.php index 65b736baa63f4bbfae6eb15a5cc1335ca7af3d63..ea5822b2ba7460221c17df25fde4247eec757194 100644 --- a/server/app/api/validate/PayValidate.php +++ b/server/app/api/validate/PayValidate.php @@ -46,7 +46,7 @@ class PayValidate extends BaseValidate * @author 段誉 * @date 2023/2/24 17:43 */ - public function scenePayway() + public function scenePayway(): PayValidate { return $this->only(['from', 'order_id']); } @@ -58,7 +58,7 @@ class PayValidate extends BaseValidate * @author 段誉 * @date 2023/3/1 16:17 */ - public function sceneStatus() + public function sceneStatus(): PayValidate { return $this->only(['from', 'order_id']); } diff --git a/server/app/api/validate/RechargeValidate.php b/server/app/api/validate/RechargeValidate.php index 31fb9fded13e36d962732295a5727844e7096f6f..798d48803583c877136b329de8ea7a99165856b6 100644 --- a/server/app/api/validate/RechargeValidate.php +++ b/server/app/api/validate/RechargeValidate.php @@ -37,7 +37,7 @@ class RechargeValidate extends BaseValidate ]; - public function sceneRecharge() + public function sceneRecharge(): RechargeValidate { return $this->only(['money']); } @@ -53,7 +53,7 @@ class RechargeValidate extends BaseValidate * @author 段誉 * @date 2023/2/24 10:42 */ - protected function checkMoney($money, $rule, $data) + protected function checkMoney($money, $rule, $data): bool|string { $status = ConfigService::get('recharge', 'status', 0); if (!$status) { diff --git a/server/app/api/validate/SetUserInfoValidate.php b/server/app/api/validate/SetUserInfoValidate.php index 7020c96c23c683d4d0b5c1fe0c0acf3778a104fe..72a2559a1bb75aa7dfaaa911cb2a7ed9318a210b 100644 --- a/server/app/api/validate/SetUserInfoValidate.php +++ b/server/app/api/validate/SetUserInfoValidate.php @@ -46,7 +46,7 @@ class SetUserInfoValidate extends BaseValidate * @author 段誉 * @date 2022/9/21 17:01 */ - protected function checkField($value, $rule, $data) + protected function checkField($value, $rule, $data): bool|string { $allowField = [ 'nickname', 'account', 'sex', 'avatar', 'real_name', diff --git a/server/app/api/validate/UserValidate.php b/server/app/api/validate/UserValidate.php index c214a27620a46c1bf13ab0d9b5098ee4d0ab4ddd..162fca454de577d3b65138fd791936d433cd406b 100644 --- a/server/app/api/validate/UserValidate.php +++ b/server/app/api/validate/UserValidate.php @@ -40,7 +40,7 @@ class UserValidate extends BaseValidate * @author 段誉 * @date 2022/9/21 16:44 */ - public function sceneGetMobileByMnp() + public function sceneGetMobileByMnp(): UserValidate { return $this->only(['code']); } @@ -52,7 +52,7 @@ class UserValidate extends BaseValidate * @author 段誉 * @date 2022/9/21 17:37 */ - public function sceneBindMobile() + public function sceneBindMobile(): UserValidate { return $this->only(['mobile', 'code']); } diff --git a/server/app/api/validate/WebScanLoginValidate.php b/server/app/api/validate/WebScanLoginValidate.php index 2cbdb4886f6e83fd05c2fa7979032b227374c9e8..10e605dab3eee88415d819ba286b8e5c8d1697bf 100644 --- a/server/app/api/validate/WebScanLoginValidate.php +++ b/server/app/api/validate/WebScanLoginValidate.php @@ -45,7 +45,7 @@ class WebScanLoginValidate extends BaseValidate * @author 段誉 * @date 2022/10/21 9:47 */ - protected function checkState($value, $rule, $data) + protected function checkState($value, $rule, $data): bool|string { $check = (new WebScanLoginCache())->getScanLoginState($value); diff --git a/server/app/api/validate/WechatLoginValidate.php b/server/app/api/validate/WechatLoginValidate.php index 323a5ed97d7e13fd5e2ccef6e3d107ff41322068..61b762471abd512390fa51af23f80b6ad378ba14 100644 --- a/server/app/api/validate/WechatLoginValidate.php +++ b/server/app/api/validate/WechatLoginValidate.php @@ -51,7 +51,7 @@ class WechatLoginValidate extends BaseValidate * @author 段誉 * @date 2022/9/16 10:57 */ - public function sceneOa() + public function sceneOa(): WechatLoginValidate { return $this->only(['code']); } @@ -63,7 +63,7 @@ class WechatLoginValidate extends BaseValidate * @author 段誉 * @date 2022/9/16 11:15 */ - public function sceneMnpLogin() + public function sceneMnpLogin(): WechatLoginValidate { return $this->only(['code']); } @@ -75,7 +75,7 @@ class WechatLoginValidate extends BaseValidate * @author 段誉 * @date 2022/9/16 11:15 */ - public function sceneWechatAuth() + public function sceneWechatAuth(): WechatLoginValidate { return $this->only(['code']); } @@ -87,7 +87,7 @@ class WechatLoginValidate extends BaseValidate * @author 段誉 * @date 2023/2/22 11:14 */ - public function sceneUpdateUser() + public function sceneUpdateUser(): WechatLoginValidate { return $this->only(['nickname', 'avatar']); } diff --git a/server/app/api/validate/WechatValidate.php b/server/app/api/validate/WechatValidate.php index 9cfa30bf6ffc10a22e5ec2984fe499945cf71987..86f313fc2d6180e6e7b57e31fc6a1dfe3687ba32 100644 --- a/server/app/api/validate/WechatValidate.php +++ b/server/app/api/validate/WechatValidate.php @@ -31,7 +31,7 @@ class WechatValidate extends BaseValidate 'url.require' => '请提供url' ]; - public function sceneJsConfig() + public function sceneJsConfig(): WechatValidate { return $this->only(['url']); } diff --git a/server/app/common/cache/AdminAccountSafeCache.php b/server/app/common/cache/AdminAccountSafeCache.php index b03be56a1c2d5d021c6f14efcf98607ed694ed93..8809d94630ddfe6e5ba7080bd13a7227994fc50d 100644 --- a/server/app/common/cache/AdminAccountSafeCache.php +++ b/server/app/common/cache/AdminAccountSafeCache.php @@ -8,9 +8,9 @@ use think\facade\Cache; class AdminAccountSafeCache extends BaseCache { - private $key;//缓存次数名称 - public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟 - public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定 + private string $key;//缓存次数名称 + public int $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟 + public int $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定 public function __construct() { @@ -24,7 +24,7 @@ class AdminAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:51 */ - public function record() + public function record(): void { if (Cache::get($this->key)) { //缓存存在,记录错误次数 @@ -41,7 +41,7 @@ class AdminAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:53 */ - public function isSafe() + public function isSafe(): bool { $count = Cache::get($this->key); if ($count >= $this->count) { @@ -55,7 +55,7 @@ class AdminAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:55 */ - public function relieve() + public function relieve(): void { Cache::delete($this->key); } diff --git a/server/app/common/cache/AdminAuthCache.php b/server/app/common/cache/AdminAuthCache.php index 8eba8104a43f641949bc8b6d283dcfde9b4e3441..580935dea5a23dc9d78a4afd75e60cf1690d66a3 100644 --- a/server/app/common/cache/AdminAuthCache.php +++ b/server/app/common/cache/AdminAuthCache.php @@ -9,16 +9,16 @@ use think\facade\Cache; class AdminAuthCache extends BaseCache { - private $prefix = 'admin_auth_'; - private $authConfigList = []; - private $cacheMd5Key = ''; //权限文件MD5的key - private $cacheAllKey = ''; //全部权限的key - private $cacheUrlKey = ''; //管理员的url缓存key - private $authMd5 = ''; //权限文件MD5的值 - private $adminId = ''; + private string $prefix = 'admin_auth_'; + private mixed $authConfigList = []; + private string $cacheMd5Key = ''; //权限文件MD5的key + private string $cacheAllKey = ''; //全部权限的key + private string $cacheUrlKey = ''; //管理员的url缓存key + private string $authMd5 = ''; //权限文件MD5的值 + private mixed $adminId = 0; - public function __construct($adminId = '') + public function __construct($adminId = 0) { parent::__construct(); @@ -48,7 +48,7 @@ class AdminAuthCache extends BaseCache * @author 令狐冲 * @date 2021/8/19 15:27 */ - public function getAdminUri() + public function getAdminUri(): mixed { //从缓存获取,直接返回 $urisAuth = Cache::get($this->cacheUrlKey); @@ -75,7 +75,7 @@ class AdminAuthCache extends BaseCache * @author cjhao * @date 2021/9/13 11:41 */ - public function getAllUri() + public function getAllUri(): mixed { $cacheAuth = Cache::get($this->cacheAllKey); if ($cacheAuth) { @@ -96,7 +96,7 @@ class AdminAuthCache extends BaseCache * @author cjhao * @date 2021/10/13 18:47 */ - public function clearAuthCache() + public function clearAuthCache(): bool { Cache::clear($this->cacheUrlKey); return true; diff --git a/server/app/common/cache/AdminTokenCache.php b/server/app/common/cache/AdminTokenCache.php index 639eb9177324369c187aff4d8948f221319e4fa7..44defc9369c962f382e43cb8384facd4f2eca5a0 100644 --- a/server/app/common/cache/AdminTokenCache.php +++ b/server/app/common/cache/AdminTokenCache.php @@ -8,20 +8,24 @@ use app\common\model\auth\Admin; use app\common\model\auth\AdminSession; use app\common\model\auth\SystemRole; use app\common\model\BaseModel; +use DateTime; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\facade\Cache; class AdminTokenCache extends BaseCache { - private $prefix = 'token_admin_'; + private string $prefix = 'token_admin_'; /** * @notes 通过token获取缓存管理员信息 - * @param $token + * @param string $token * @return false|mixed * @author 令狐冲 * @date 2021/6/30 16:57 */ - public function getAdminInfo($token) + public function getAdminInfo(string $token): mixed { //直接从缓存获取 $adminInfo = Cache::get($this->prefix . $token); @@ -40,15 +44,15 @@ class AdminTokenCache extends BaseCache /** * @notes 通过有效token设置管理信息缓存 - * @param $token + * @param string $token * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 令狐冲 * @date 2021/7/5 12:12 */ - public function setAdminInfo($token) + public function setAdminInfo(string $token): mixed { $adminSession = AdminSession::where([['token', '=', $token], ['expire_time', '>', time()]]) ->find(); @@ -82,18 +86,18 @@ class AdminTokenCache extends BaseCache 'terminal' => $adminSession->terminal, 'expire_time' => $adminSession->expire_time, ]; - Cache::set($this->prefix . $token, $adminInfo, new \DateTime(Date('Y-m-d H:i:s', $adminSession->expire_time))); + Cache::set($this->prefix . $token, $adminInfo, new DateTime(Date('Y-m-d H:i:s', $adminSession->expire_time))); return $this->getAdminInfo($token); } /** * @notes 删除缓存 - * @param $token + * @param string $token * @return bool * @author 令狐冲 * @date 2021/7/3 16:57 */ - public function deleteAdminInfo($token) + public function deleteAdminInfo(string $token): bool { return Cache::delete($this->prefix . $token); } diff --git a/server/app/common/cache/BaseCache.php b/server/app/common/cache/BaseCache.php index d4a09c6eb429c175c4d1b66cd4f07a7bfee5cf35..b9b1625697286bc0cd4cb880b653113003fdef6d 100644 --- a/server/app/common/cache/BaseCache.php +++ b/server/app/common/cache/BaseCache.php @@ -12,8 +12,8 @@ class BaseCache extends Cache * 缓存标签 * @var string */ - protected $tagName; - protected $cache; + protected string $tagName; + protected mixed $cache; public function __construct(){ $this->tagName = get_class($this); diff --git a/server/app/common/cache/ExportCache.php b/server/app/common/cache/ExportCache.php index 9bb4d4414baeea1afad60c65f9f234619c085175..ce15990df636a5e66a63b3b75679749ab95486b6 100644 --- a/server/app/common/cache/ExportCache.php +++ b/server/app/common/cache/ExportCache.php @@ -21,7 +21,7 @@ use think\facade\Cache; class ExportCache extends BaseCache { - protected $uniqid = ''; + protected string $uniqid = ''; public function __construct() { @@ -36,7 +36,7 @@ class ExportCache extends BaseCache * @author 令狐冲 * @date 2021/7/28 17:36 */ - public function getSrc() + public function getSrc(): string { return public_path() . '/export/'.date('Y-m').'/'.$this->uniqid.'/'; } @@ -49,7 +49,7 @@ class ExportCache extends BaseCache * @author 令狐冲 * @date 2021/7/28 17:36 */ - public function setFile($fileName) + public function setFile($fileName): string { $src = $this->getSrc(); $key = md5($src . $fileName) . time(); @@ -64,7 +64,7 @@ class ExportCache extends BaseCache * @author 令狐冲 * @date 2021/7/26 18:36 */ - public function getFile($key) + public function getFile($key): mixed { return Cache::get($key); } diff --git a/server/app/common/cache/UserAccountSafeCache.php b/server/app/common/cache/UserAccountSafeCache.php index 4412f62ddd7641d028326f6251e67b265e99763f..4a4cd809a840a888c629eb565a9e6a53f0fbf321 100644 --- a/server/app/common/cache/UserAccountSafeCache.php +++ b/server/app/common/cache/UserAccountSafeCache.php @@ -24,9 +24,9 @@ namespace app\common\cache; class UserAccountSafeCache extends BaseCache { - private $key;//缓存次数名称 - public $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟 - public $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定 + private string $key;//缓存次数名称 + public int $minute = 15;//缓存设置为15分钟,即密码错误次数达到,锁定15分钟 + public int $count = 15; //设置连续输错次数,即15分钟内连续输错误15次后,锁定 public function __construct() { @@ -40,7 +40,7 @@ class UserAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:51 */ - public function record() + public function record(): void { if ($this->get($this->key)) { //缓存存在,记录错误次数 @@ -57,7 +57,7 @@ class UserAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:53 */ - public function isSafe() + public function isSafe(): bool { $count = $this->get($this->key); if ($count >= $this->count) { @@ -71,7 +71,7 @@ class UserAccountSafeCache extends BaseCache * @author 令狐冲 * @date 2021/6/30 01:55 */ - public function relieve() + public function relieve(): void { $this->delete($this->key); } diff --git a/server/app/common/cache/UserTokenCache.php b/server/app/common/cache/UserTokenCache.php index 37a8b7d1036a23a1269ee144db460488634512ef..c4e8eb453b3c377c97e092b81ad435f1ee8a16c1 100644 --- a/server/app/common/cache/UserTokenCache.php +++ b/server/app/common/cache/UserTokenCache.php @@ -17,24 +17,28 @@ namespace app\common\cache; use app\common\model\user\User; use app\common\model\user\UserSession; +use DateTime; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; class UserTokenCache extends BaseCache { - private $prefix = 'token_user_'; + private string $prefix = 'token_user_'; /** * @notes 通过token获取缓存用户信息 * @param $token * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:11 */ - public function getUserInfo($token) + public function getUserInfo($token): mixed { //直接从缓存获取 $userInfo = $this->get($this->prefix . $token); @@ -56,13 +60,13 @@ class UserTokenCache extends BaseCache * @notes 通过有效token设置用户信息缓存 * @param $token * @return array|false|mixed - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/16 10:11 */ - public function setUserInfo($token) + public function setUserInfo($token): mixed { $userSession = UserSession::where([['token', '=', $token], ['expire_time', '>', time()]])->find(); if (empty($userSession)) { @@ -83,7 +87,7 @@ class UserTokenCache extends BaseCache 'expire_time' => $userSession->expire_time, ]; - $ttl = new \DateTime(Date('Y-m-d H:i:s', $userSession->expire_time)); + $ttl = new DateTime(Date('Y-m-d H:i:s', $userSession->expire_time)); $this->set($this->prefix . $token, $userInfo, $ttl); return $this->getUserInfo($token); } @@ -96,7 +100,7 @@ class UserTokenCache extends BaseCache * @author 段誉 * @date 2022/9/16 10:13 */ - public function deleteUserInfo($token) + public function deleteUserInfo($token): bool { return $this->delete($this->prefix . $token); } diff --git a/server/app/common/cache/WebScanLoginCache.php b/server/app/common/cache/WebScanLoginCache.php index 1e16cc32389ad02fa257ec5f5fe936b09b842349..b32e18a65fc9127dda62b5034bb07fdf4153f087 100644 --- a/server/app/common/cache/WebScanLoginCache.php +++ b/server/app/common/cache/WebScanLoginCache.php @@ -19,7 +19,7 @@ namespace app\common\cache; class WebScanLoginCache extends BaseCache { - private $prefix = 'web_scan_'; + private string $prefix = 'web_scan_'; /** @@ -29,7 +29,7 @@ class WebScanLoginCache extends BaseCache * @author 段誉 * @date 2022/10/20 18:39 */ - public function getScanLoginState($state) + public function getScanLoginState($state): mixed { return $this->get($this->prefix . $state); } @@ -42,7 +42,7 @@ class WebScanLoginCache extends BaseCache * @author 段誉 * @date 2022/10/20 18:31 */ - public function setScanLoginState($state) + public function setScanLoginState($state): mixed { $this->set($this->prefix . $state, $state, 600); return $this->getScanLoginState($state); @@ -56,7 +56,7 @@ class WebScanLoginCache extends BaseCache * @author 段誉 * @date 2022/9/16 10:13 */ - public function deleteLoginState($state) + public function deleteLoginState($state): bool { return $this->delete($this->prefix . $state); } diff --git a/server/app/common/controller/BaseLikeAdminController.php b/server/app/common/controller/BaseLikeAdminController.php index f5e446a0e213fdaebf57d46a4a3dfb8933490b1e..e839029106cb91fc195ad0788adfcb017b26790a 100644 --- a/server/app/common/controller/BaseLikeAdminController.php +++ b/server/app/common/controller/BaseLikeAdminController.php @@ -7,6 +7,7 @@ namespace app\common\controller; use app\BaseController; use app\common\lists\BaseDataLists; use app\common\service\JsonService; +use support\Response; class BaseLikeAdminController extends BaseController { @@ -18,10 +19,11 @@ class BaseLikeAdminController extends BaseController * @param array $data * @param int $code * @param int $show + * @return Response * @author 乔峰 * @date 2021/12/27 14:21 */ - protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0) + protected function success(string $msg = 'success', array $data = [], int $code = 1, int $show = 0): Response { return JsonService::success($msg, $data, $code, $show); } @@ -30,10 +32,11 @@ class BaseLikeAdminController extends BaseController /** * @notes 数据返回 * @param $data + * @return Response * @author 乔峰 * @date 2021/12/27 14:21\ */ - protected function data($data) + protected function data($data): Response { return JsonService::data($data); } @@ -41,11 +44,11 @@ class BaseLikeAdminController extends BaseController /** * @notes 列表数据返回 - * @param \app\common\lists\BaseDataLists|null $lists + * @param BaseDataLists|null $lists * @author 令狐冲 * @date 2021/7/8 00:40 */ - protected function dataLists(BaseDataLists $lists = null) + protected function dataLists(BaseDataLists $lists = null): Response { //列表类和控制器一一对应,"app/应用/controller/控制器的方法" =》"app\应用\lists\"目录下 //(例如:"app/adminapi/controller/auth/AdminController.php的lists()方法" =》 "app/adminapi/lists/auth/AminLists.php") @@ -67,7 +70,7 @@ class BaseLikeAdminController extends BaseController * @author 乔峰 * @date 2021/12/27 14:21 */ - protected function fail(string $msg = 'fail', array $data = [], int $code = 0, int $show = 1) + protected function fail(string $msg = 'fail', array $data = [], int $code = 0, int $show = 1): Response { return JsonService::fail($msg, $data, $code, $show); } diff --git a/server/app/common/enum/DefaultEnum.php b/server/app/common/enum/DefaultEnum.php index 322148df509b2fe8eaa96e5dafee46f683aa7735..cfdf558a6aa4c7c2215d8dcfc16db6dda5729de2 100644 --- a/server/app/common/enum/DefaultEnum.php +++ b/server/app/common/enum/DefaultEnum.php @@ -36,12 +36,12 @@ class DefaultEnum /** * @notes 获取显示状态 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/8 3:56 下午 */ - public static function getShowDesc($value = true) + public static function getShowDesc(bool|int $value = true): array|string { $data = [ self::HIDE => '隐藏', @@ -55,12 +55,12 @@ class DefaultEnum /** * @notes 启用状态 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/14 4:02 下午 */ - public static function getEnableDesc($value = true) + public static function getEnableDesc(bool|int $value = true): array|string { $data = [ self::HIDE => '停用', @@ -74,12 +74,12 @@ class DefaultEnum /** * @notes 性别 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/10 11:40 上午 */ - public static function getSexDesc($value = true) + public static function getSexDesc(bool|int $value = true): array|string { $data = [ self::UNKNOWN => '未知', @@ -95,12 +95,12 @@ class DefaultEnum /** * @notes 属性 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/14 4:41 下午 */ - public static function getAttrDesc($value = true) + public static function getAttrDesc(bool|int $value = true): array|string { $data = [ self::SYSTEM => '系统默认', @@ -115,12 +115,12 @@ class DefaultEnum /** * @notes 是否推荐 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/23 3:30 下午 */ - public static function getRecommendDesc($value = true) + public static function getRecommendDesc(bool|int $value = true): array|string { $data = [ self::HIDE => '不推荐', diff --git a/server/app/common/enum/GeneratorEnum.php b/server/app/common/enum/GeneratorEnum.php index 56a6030412b6ad8a410c5140884dc7a9cf26f938..a46e0cf0cfa89289245d592d08b253cbdbcc207e 100644 --- a/server/app/common/enum/GeneratorEnum.php +++ b/server/app/common/enum/GeneratorEnum.php @@ -44,12 +44,12 @@ class GeneratorEnum /** * @notes 获取模板类型描述 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2022/6/14 11:24 */ - public static function getTemplateTypeDesc($value = true) + public static function getTemplateTypeDesc(bool|int $value = true): array|string { $data = [ self::TEMPLATE_TYPE_SINGLE => '单表(增删改查)', diff --git a/server/app/common/enum/MenuEnum.php b/server/app/common/enum/MenuEnum.php index 8889c4e9df73ded93cad1b97efe58188b1daa663..696456bb8f84afc53bc393e367ecff7732430867 100644 --- a/server/app/common/enum/MenuEnum.php +++ b/server/app/common/enum/MenuEnum.php @@ -40,12 +40,12 @@ class MenuEnum /** * @notes 链接类型 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/14 12:14 下午 */ - public static function getLinkDesc($value = true) + public static function getLinkDesc(bool|int $value = true): array|string { $data = [ self::LINK_SHOP => '商城页面', diff --git a/server/app/common/enum/OfficialAccountEnum.php b/server/app/common/enum/OfficialAccountEnum.php index 9478f94dec94fa0e3b08a12d4b609572ed52666c..0b042033fc4cfd7b514211ca609417d92c9c86ea 100644 --- a/server/app/common/enum/OfficialAccountEnum.php +++ b/server/app/common/enum/OfficialAccountEnum.php @@ -82,12 +82,12 @@ class OfficialAccountEnum /** * @notes 获取类型英文名称 - * @param $type + * @param int $type * @return string * @author Tab * @date 2021/7/29 16:32 */ - public static function getReplyType($type) + public static function getReplyType(int $type): string { return self::REPLY_TYPE[$type] ?? ''; } diff --git a/server/app/common/enum/PayEnum.php b/server/app/common/enum/PayEnum.php index 915fe27447ce0943fd71f032af828564e0b874a1..dc0c7051aeed0f122299086609d72355098bbf89 100644 --- a/server/app/common/enum/PayEnum.php +++ b/server/app/common/enum/PayEnum.php @@ -46,12 +46,12 @@ class PayEnum /** * @notes 获取支付类型 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2023/2/23 15:36 */ - public static function getPayDesc($value = true) + public static function getPayDesc(bool|int $value = true): array|string { $data = [ self::BALANCE_PAY => '余额支付', @@ -68,12 +68,12 @@ class PayEnum /** * @notes 支付状态 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2023/2/23 15:36 */ - public static function getPayStatusDesc($value = true) + public static function getPayStatusDesc(bool|int $value = true): array|string { $data = [ self::UNPAID => '未支付', diff --git a/server/app/common/enum/RefundEnum.php b/server/app/common/enum/RefundEnum.php index 0722d30bb29e7e1816051a63640ba36b25d5ea00..d2f30ec8db145bf8822029dfc8b917a1ed349956 100644 --- a/server/app/common/enum/RefundEnum.php +++ b/server/app/common/enum/RefundEnum.php @@ -39,12 +39,12 @@ class RefundEnum /** * @notes 退款类型描述 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2022/12/1 10:40 */ - public static function getTypeDesc($value = true) + public static function getTypeDesc(bool|int $value = true): array|string { $data = [ self::TYPE_ADMIN => '后台退款', @@ -58,12 +58,12 @@ class RefundEnum /** * @notes 退款状态 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2022/12/1 10:43 */ - public static function getStatusDesc($value = true) + public static function getStatusDesc(bool|int $value = true): array|string { $data = [ self::REFUND_ING => '退款中', @@ -80,12 +80,12 @@ class RefundEnum /** * @notes 退款方式 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 段誉 * @date 2022/12/1 10:43 */ - public static function getWayDesc($value = true) + public static function getWayDesc(bool|int $value = true) { $data = [ self::REFUND_ONLINE => '线上退款', diff --git a/server/app/common/enum/YesNoEnum.php b/server/app/common/enum/YesNoEnum.php index dcea136aaac9ef3082dffa665fb7622024836316..9c377cb2a70879029cebb532899446120902c33f 100644 --- a/server/app/common/enum/YesNoEnum.php +++ b/server/app/common/enum/YesNoEnum.php @@ -27,12 +27,12 @@ class YesNoEnum /** * @notes 获取禁用状态 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author 令狐冲 * @date 2021/7/8 19:02 */ - public static function getDisableDesc($value = true) + public static function getDisableDesc(bool|int $value = true): array|string { $data = [ self::YES => '禁用', diff --git a/server/app/common/enum/notice/NoticeEnum.php b/server/app/common/enum/notice/NoticeEnum.php index 172f8895d93af031061c5f8b50530bf37c9026b2..7d432338aa63a5f705fb286fb4b8c2e8ff9139ba 100644 --- a/server/app/common/enum/notice/NoticeEnum.php +++ b/server/app/common/enum/notice/NoticeEnum.php @@ -56,12 +56,12 @@ class NoticeEnum /** * @notes 通知类型 - * @param bool $value + * @param bool|int $value * @return string|string[] * @author ljj * @date 2022/2/17 2:49 下午 */ - public static function getTypeDesc($value = true) + public static function getTypeDesc(bool|int $value = true): array|string { $data = [ self::BUSINESS_NOTIFICATION => '业务通知', @@ -76,13 +76,13 @@ class NoticeEnum /** * @notes 获取场景描述 - * @param $sceneId - * @param false $flag + * @param int $sceneId + * @param bool $flag * @return string|string[] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getSceneDesc($sceneId, $flag = false) + public static function getSceneDesc(int $sceneId, bool $flag = false): array|string { $desc = [ self::LOGIN_CAPTCHA => '登录验证码', @@ -106,7 +106,7 @@ class NoticeEnum * @author 段誉 * @date 2022/9/15 15:08 */ - public static function getSceneByTag($tag) + public static function getSceneByTag($tag): int|string { $scene = [ // 手机验证码登录 @@ -124,13 +124,13 @@ class NoticeEnum /** * @notes 获取场景变量 - * @param $sceneId - * @param false $flag + * @param int $sceneId + * @param bool $flag * @return array|string[] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getVars($sceneId, $flag = false) + public static function getVars(int $sceneId, bool $flag = false): array { $desc = [ self::LOGIN_CAPTCHA => '验证码:code', @@ -149,13 +149,13 @@ class NoticeEnum /** * @notes 获取系统通知示例 - * @param $sceneId - * @param false $flag + * @param int $sceneId + * @param bool $flag * @return array|string[] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getSystemExample($sceneId, $flag = false) + public static function getSystemExample(int $sceneId, bool $flag = false): array { $desc = []; @@ -169,13 +169,13 @@ class NoticeEnum /** * @notes 获取短信通知示例 - * @param $sceneId - * @param false $flag + * @param int $sceneId + * @param bool $flag * @return array|string[] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getSmsExample($sceneId, $flag = false) + public static function getSmsExample(int $sceneId, bool $flag = false): array { $desc = [ self::LOGIN_CAPTCHA => '您正在登录,验证码${code},切勿将验证码泄露于他人,本条验证码有效期5分钟。', @@ -194,13 +194,13 @@ class NoticeEnum /** * @notes 获取公众号模板消息示例 - * @param $sceneId - * @param false $flag - * @return array|string[]|\string[][] + * @param int $sceneId + * @param bool $flag + * @return array|string[]|string[][] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getOaExample($sceneId, $flag = false) + public static function getOaExample(int $sceneId, bool $flag = false): array { $desc = []; @@ -214,13 +214,13 @@ class NoticeEnum /** * @notes 获取小程序订阅消息示例 - * @param $sceneId - * @param false $flag + * @param int $sceneId + * @param bool $flag * @return array|mixed * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getMnpExample($sceneId, $flag = false) + public static function getMnpExample(int $sceneId,bool $flag = false): mixed { $desc = []; @@ -235,12 +235,12 @@ class NoticeEnum /** * @notes 提示 * @param $type - * @param $sceneId - * @return array|string|string[]|\string[][] + * @param int $sceneId + * @return array|string|string[]|string[][] * @author 段誉 * @date 2022/3/29 11:33 */ - public static function getOperationTips($type, $sceneId) + public static function getOperationTips($type, int $sceneId): array|string { // 场景变量 $vars = self::getVars($sceneId); diff --git a/server/app/common/enum/notice/SmsEnum.php b/server/app/common/enum/notice/SmsEnum.php index d1bc220462d4fbf2ebc8f981dae7477c38ec140f..f290acec458bf5b0d230b9a454bd61ef8678b381 100644 --- a/server/app/common/enum/notice/SmsEnum.php +++ b/server/app/common/enum/notice/SmsEnum.php @@ -36,12 +36,12 @@ class SmsEnum /** * @notes 获取短信平台名称 - * @param $value + * @param string $value * @return string * @author 段誉 * @date 2022/8/5 11:10 */ - public static function getNameDesc($value) + public static function getNameDesc(string $value): string { $desc = [ 'ALI' => '阿里云短信', diff --git a/server/app/common/enum/user/AccountLogEnum.php b/server/app/common/enum/user/AccountLogEnum.php index ed8335e3e6417292a007d7ff938c338e1bdb980d..b337f50199ada3b7afab8bb00531817292bfff17 100644 --- a/server/app/common/enum/user/AccountLogEnum.php +++ b/server/app/common/enum/user/AccountLogEnum.php @@ -75,13 +75,13 @@ class AccountLogEnum /** * @notes 动作描述 - * @param $action - * @param false $flag + * @param string $action + * @param bool $flag * @return string|string[] * @author 段誉 * @date 2023/2/23 10:07 */ - public static function getActionDesc($action, $flag = false) + public static function getActionDesc(string $action, bool $flag = false): array|string { $desc = [ self::DEC => '减少', @@ -96,13 +96,13 @@ class AccountLogEnum /** * @notes 变动类型描述 - * @param $changeType - * @param false $flag + * @param int $changeType + * @param bool $flag * @return string|string[] * @author 段誉 * @date 2023/2/23 10:07 */ - public static function getChangeTypeDesc($changeType, $flag = false) + public static function getChangeTypeDesc(int $changeType, bool $flag = false): array|string { $desc = [ self::UM_DEC_ADMIN => '平台减少余额', @@ -123,10 +123,10 @@ class AccountLogEnum * @author 段誉 * @date 2023/2/23 10:08 */ - public static function getUserMoneyChangeTypeDesc() + public static function getUserMoneyChangeTypeDesc(): array|string { $UMChangeType = self::getUserMoneyChangeType(); - $changeTypeDesc = self::getChangeTypeDesc('', true); + $changeTypeDesc = self::getChangeTypeDesc(0, true); return array_filter($changeTypeDesc, function ($key) use ($UMChangeType) { return in_array($key, $UMChangeType); }, ARRAY_FILTER_USE_KEY); @@ -148,11 +148,11 @@ class AccountLogEnum /** * @notes 获取变动对象 * @param $changeType - * @return false + * @return false|int * @author 段誉 * @date 2023/2/23 10:10 */ - public static function getChangeObject($changeType) + public static function getChangeObject($changeType): false|int { // 用户余额 $um = self::getUserMoneyChangeType(); diff --git a/server/app/common/enum/user/UserEnum.php b/server/app/common/enum/user/UserEnum.php index 9b85d5b5eb3d33d2fb165d3f4c4a745f2bbdcfd3..1cf549d94601f4fd55493b24a7f366b845c4ffd5 100644 --- a/server/app/common/enum/user/UserEnum.php +++ b/server/app/common/enum/user/UserEnum.php @@ -35,12 +35,12 @@ class UserEnum /** * @notes 性别描述 - * @param bool $from + * @param bool|int $from * @return string|string[] * @author 段誉 * @date 2022/9/7 15:05 */ - public static function getSexDesc($from = true) + public static function getSexDesc(bool|int $from = true): array|string { $desc = [ self::SEX_OTHER => '未知', diff --git a/server/app/common/enum/user/UserTerminalEnum.php b/server/app/common/enum/user/UserTerminalEnum.php index 87fdf881b928dbbeb8b4f5a295ac923bdee44c07..592108862ad931d894907bdc86cdbf79b660fdfa 100644 --- a/server/app/common/enum/user/UserTerminalEnum.php +++ b/server/app/common/enum/user/UserTerminalEnum.php @@ -41,12 +41,12 @@ class UserTerminalEnum /** * @notes 获取终端 - * @param bool $from + * @param bool|int $from * @return array|mixed|string * @author cjhao * @date 2021/7/30 18:09 */ - public static function getTermInalDesc($from = true) + public static function getTermInalDesc(bool|int $from = true): mixed { $desc = [ self::WECHAT_MMP => '微信小程序', diff --git a/server/app/common/exception/ControllerExtendException.php b/server/app/common/exception/ControllerExtendException.php index 93c05b0c4a53a41dfec45e402aa44111daf109dd..31072b9c51fee59280ee49e8250c3830e22d9dd8 100644 --- a/server/app/common/exception/ControllerExtendException.php +++ b/server/app/common/exception/ControllerExtendException.php @@ -4,7 +4,9 @@ namespace app\common\exception; -class ControllerExtendException extends \Exception +use Exception; + +class ControllerExtendException extends Exception { public function __construct(string $message, string $model = '', array $config = []) { diff --git a/server/app/common/exception/Handler.php b/server/app/common/exception/Handler.php index 598a15daf3dfb7eb9c27f4cb1f5432886932337c..f792daa4649dff08afa6bc3efdbe780018a6035e 100644 --- a/server/app/common/exception/Handler.php +++ b/server/app/common/exception/Handler.php @@ -18,7 +18,7 @@ class Handler extends ExceptionHandler HttpException::class ]; - public function report(Throwable $exception) + public function report(Throwable $exception): void { parent::report($exception); } diff --git a/server/app/common/exception/HttpException.php b/server/app/common/exception/HttpException.php index 703b3ae8044c319bbb17407b8880ea3b7b2ee702..ba3e7261f7d6e67ebb9525745fc9e983ca65bc40 100644 --- a/server/app/common/exception/HttpException.php +++ b/server/app/common/exception/HttpException.php @@ -3,11 +3,12 @@ namespace app\common\exception; +use RuntimeException; use Throwable; -class HttpException extends \RuntimeException +class HttpException extends RuntimeException { - protected $response = null; + protected ?\support\Response $response = null; public function __construct($message = "", $code = 0, $header=[],Throwable $previous = null) { @@ -16,7 +17,8 @@ class HttpException extends \RuntimeException parent::__construct($message, $code, $previous); } - public function getResponse(){ + public function getResponse(): ?\support\Response + { return $this->response; } } \ No newline at end of file diff --git a/server/app/common/http/middleware/AllowMiddleware.php b/server/app/common/http/middleware/AllowMiddleware.php index af4be6eef969a29abfaf3870fb5326683ba9264e..747532f4943aa1691fcd69bc1c8dad23be98ba9b 100644 --- a/server/app/common/http/middleware/AllowMiddleware.php +++ b/server/app/common/http/middleware/AllowMiddleware.php @@ -17,8 +17,10 @@ declare (strict_types=1); namespace app\common\http\middleware; use app\adminapi\listener\OperationLog; +use Exception; use Fiber; use support\Log; +use Throwable; use Webman\Http\Request; use Webman\Http\Response; use Webman\MiddlewareInterface; @@ -52,8 +54,8 @@ class AllowMiddleware implements MiddlewareInterface OperationLog::handle($request,$response); })); $fiber->start(); - }catch (\Exception|\Throwable $e){ - Log::error('请求日志记录失败:'.$e->getMessage()); + }catch (Exception|Throwable $e){ +// Log::error('请求日志记录失败:'.$e->getMessage()); } } diff --git a/server/app/common/http/middleware/BaseMiddleware.php b/server/app/common/http/middleware/BaseMiddleware.php index 3cfd84c9864b0e93db9193375c79ae4b167f25cd..4771375cdd3cbf145de670b677f439fda53e4143 100644 --- a/server/app/common/http/middleware/BaseMiddleware.php +++ b/server/app/common/http/middleware/BaseMiddleware.php @@ -16,6 +16,8 @@ declare (strict_types=1); namespace app\common\http\middleware; +use Closure; + /** * 基础中间件 * Class LikeShopMiddleware @@ -23,7 +25,7 @@ namespace app\common\http\middleware; */ class BaseMiddleware { - public function handle($request, \Closure $next) + public function handle($request, Closure $next) { return $next($request); } diff --git a/server/app/common/http/middleware/EndMiddleware.php b/server/app/common/http/middleware/EndMiddleware.php index e78c7470dd88f7944a6769642e1351c5b6b3df3d..63c0d3ecfe7da6bec70fd6a2255791c3422953e9 100644 --- a/server/app/common/http/middleware/EndMiddleware.php +++ b/server/app/common/http/middleware/EndMiddleware.php @@ -39,6 +39,7 @@ class EndMiddleware implements MiddlewareInterface { $controllerObject = make($request->controller); // 如果是opitons请求则返回一个空的响应,否则继续向洋葱芯穿越,并得到一个响应 + $controllerObject->setRequest(request()); $controllerObject->initialize(); return $handler($request); diff --git a/server/app/common/lists/BaseDataLists.php b/server/app/common/lists/BaseDataLists.php index dfaa3f279c435da715a6c275b83fbcd11880d842..1ae9ea612d598d90b8acdb4b16842bd9ed2209cc 100644 --- a/server/app/common/lists/BaseDataLists.php +++ b/server/app/common/lists/BaseDataLists.php @@ -6,8 +6,10 @@ namespace app\common\lists; use app\common\enum\ExportEnum; use app\common\service\JsonService; use app\common\validate\ListsValidate; -use app\Request; +use support\Request; +use support\Response; use Webman\Config; +use ArrayObject; abstract class BaseDataLists implements ListsInterface { @@ -15,31 +17,31 @@ abstract class BaseDataLists implements ListsInterface use ListsSortTrait; use ListsExcelTrait; - public $request; //请求对象 + public Request $request; //请求对象 - public $pageNo; //页码 - public $pageSize; //每页数量 - public $limitOffset; //limit查询offset值 - public $limitLength; //limit查询数量 - public $pageSizeMax; - public $pageType = 0; //默认类型:0-一般分页;1-不分页,获取最大所有数据 + public int $pageNo; //页码 + public int $pageSize; //每页数量 + public int $limitOffset; //limit查询offset值 + public int $limitLength; //limit查询数量 + public int $pageSizeMax; + public int $pageType = 0; //默认类型:0-一般分页;1-不分页,获取最大所有数据 - protected $orderBy; - protected $field; + protected string $orderBy; + protected string $field; - protected $startTime; - protected $endTime; + protected int|null $startTime = null; + protected int|null $endTime = null; - protected $start; - protected $end; + protected string|null $start; + protected string|null $end; - protected $params; - protected $sortOrder = []; + protected mixed $params; + protected array $sortOrder = []; - public $export; - public $is_export_max=2000; - public $is_export_batch=false; + public int $export; + public int $is_export_max=2000; + public bool $is_export_batch=false; public function __construct() { @@ -68,7 +70,7 @@ abstract class BaseDataLists implements ListsInterface * @author 令狐冲 * @date 2021/7/30 23:55 */ - private function initPage() + private function initPage(): void { $this->pageSizeMax = Config::get('project.lists.page_size_max'); $this->pageSize = Config::get('project.lists.page_size'); @@ -95,7 +97,7 @@ abstract class BaseDataLists implements ListsInterface * @author 令狐冲 * @date 2021/7/31 00:00 */ - private function initSearch() + private function initSearch(): array { if (!($this instanceof ListsSearchInterface)) { return []; @@ -121,7 +123,7 @@ abstract class BaseDataLists implements ListsInterface * @author 令狐冲 * @date 2021/7/31 00:03 */ - private function initSort() + private function initSort(): array { if (!($this instanceof ListsSortInterface)) { return []; @@ -135,13 +137,13 @@ abstract class BaseDataLists implements ListsInterface /** * @notes 导出初始化 - * @return false|\support\Response + * @return false|Response * @author 令狐冲 * @date 2021/7/31 01:15 */ - private function initExport() + private function initExport(): Response|false { - $this->export = $this->request->get('export', ''); + $this->export = $this->request->get('export', 0); //不做导出操作 if ($this->export != ExportEnum::INFO && $this->export != ExportEnum::EXPORT) { diff --git a/server/app/common/lists/ListsExcelTrait.php b/server/app/common/lists/ListsExcelTrait.php index ccc5d43b8f14f4ce332cfde9276d19d804672718..ac7a5539ef9a1c7844aaf317e8725b6304ec54d3 100644 --- a/server/app/common/lists/ListsExcelTrait.php +++ b/server/app/common/lists/ListsExcelTrait.php @@ -9,12 +9,13 @@ use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Style\Border; use PhpOffice\PhpSpreadsheet\Style\Fill; +use PhpOffice\PhpSpreadsheet\Writer\Exception; trait ListsExcelTrait { - public $pageStart = 1; //导出开始页码 - public $pageEnd = 200; //导出介绍页码 - public $fileName = ''; //文件名称 + public int $pageStart = 1; //导出开始页码 + public int $pageEnd = 200; //导出介绍页码 + public string $fileName = ''; //文件名称 /** * @notes 创建excel @@ -22,11 +23,11 @@ trait ListsExcelTrait * @param $lists * @return string * @throws \PhpOffice\PhpSpreadsheet\Exception - * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * @throws Exception * @author 令狐冲 * @date 2021/7/21 16:04 */ - public function createExcel($excelFields, $lists) + public function createExcel($excelFields, $lists): string { $title = array_values($excelFields); @@ -100,7 +101,7 @@ trait ListsExcelTrait * @author 令狐冲 * @date 2021/7/29 16:08 */ - public function excelInfo() + public function excelInfo(): array { $count = $this->count(); $sum_page = max(ceil($count / $this->pageSize), 1); diff --git a/server/app/common/lists/ListsExtendInterface.php b/server/app/common/lists/ListsExtendInterface.php index 0ade2779d29b3d1d241f4df390e11a93c5ccebd0..b24f8cbc1f4c82196e2e10526d4a55cda19e3820 100644 --- a/server/app/common/lists/ListsExtendInterface.php +++ b/server/app/common/lists/ListsExtendInterface.php @@ -8,9 +8,9 @@ interface ListsExtendInterface { /** * @notes 扩展字段 - * @return mixed + * @return array * @author 令狐冲 * @date 2021/7/21 17:45 */ - public function extend(); + public function extend(): array; } \ No newline at end of file diff --git a/server/app/common/lists/ListsSearchTrait.php b/server/app/common/lists/ListsSearchTrait.php index b848d60c44401a0807a28fd1d44fe1b4c7c9db17..0215a38eb9954a488ca6c6e2bc06b6774defc7b2 100644 --- a/server/app/common/lists/ListsSearchTrait.php +++ b/server/app/common/lists/ListsSearchTrait.php @@ -4,10 +4,12 @@ namespace app\common\lists; +use ArrayObject; + trait ListsSearchTrait { - protected $params; - protected $searchWhere = []; + protected mixed $params; + protected array $searchWhere = []; /** * @notes 搜索条件生成 @@ -16,7 +18,7 @@ trait ListsSearchTrait * @author 令狐冲 * @date 2021/7/7 19:36 */ - private function createWhere($search) + private function createWhere($search): array { if (empty($search)) { return []; diff --git a/server/app/common/lists/ListsSortTrait.php b/server/app/common/lists/ListsSortTrait.php index cefd4e3e4c3d34a8fac1101f223b53a602ee827b..bd456a772d3ff402a8a7c073bfddcb09b6eb04a2 100644 --- a/server/app/common/lists/ListsSortTrait.php +++ b/server/app/common/lists/ListsSortTrait.php @@ -6,8 +6,8 @@ namespace app\common\lists; trait ListsSortTrait { - protected $orderBy; - protected $field; + protected string $orderBy; + protected string $field; /** * @notes 生成排序条件 @@ -17,7 +17,7 @@ trait ListsSortTrait * @author 令狐冲 * @date 2021/7/16 00:06 */ - private function createOrder($sortField, $defaultOrder) + private function createOrder($sortField, $defaultOrder): array { if (empty($sortField) || empty($this->orderBy) || empty($this->field) || !in_array($this->field, array_keys($sortField))) { return $defaultOrder; diff --git a/server/app/common/logic/AccountLogLogic.php b/server/app/common/logic/AccountLogLogic.php index ae1223afe14fcaebe20554724ff19bf65b52ccf9..ff3ca030dc327904e63c6432a7f20a21aedbfe97 100644 --- a/server/app/common/logic/AccountLogLogic.php +++ b/server/app/common/logic/AccountLogLogic.php @@ -5,6 +5,7 @@ namespace app\common\logic; use app\common\enum\user\AccountLogEnum; use app\common\model\user\UserAccountLog; use app\common\model\user\User; +use think\Model; /** * 账户流水记录逻辑层 @@ -23,11 +24,11 @@ class AccountLogLogic extends BaseLogic * @param string $sourceSn * @param string $remark * @param array $extra - * @return UserAccountLog|false|\think\Model + * @return UserAccountLog|false|Model * @author bingo * @date 2023/2/23 12:03 */ - public static function add($userId, $changeType, $action, $changeAmount, string $sourceSn = '', string $remark = '', array $extra = []) + public static function add($userId, $changeType, $action, $changeAmount, string $sourceSn = '', string $remark = '', array $extra = []): false|Model|UserAccountLog { $user = User::findOrEmpty($userId); if($user->isEmpty()) { diff --git a/server/app/common/logic/BaseLogic.php b/server/app/common/logic/BaseLogic.php index cd9a2790f4e144b3a50e767da96831e5506435aa..a2728dd9112027698ae4ef92f706a23b90e44146 100644 --- a/server/app/common/logic/BaseLogic.php +++ b/server/app/common/logic/BaseLogic.php @@ -25,18 +25,18 @@ class BaseLogic { /** * 错误信息 - * @var string + * @var string|null */ - protected static $error; + protected static string|null $error; /** * 返回状态码 * @var int */ - protected static $returnCode = 0; + protected static int $returnCode = 0; - protected static $returnData; + protected static mixed $returnData; /** * @notes 获取错误信息 @@ -106,7 +106,7 @@ class BaseLogic * @author cjhao * @date 2021/9/11 17:29 */ - public static function getReturnData() + public static function getReturnData(): mixed { return self::$returnData; } diff --git a/server/app/common/logic/NoticeLogic.php b/server/app/common/logic/NoticeLogic.php index 6957d7366b4b6cde3ffafb0ed1f934f7f6dc9f82..c4a6b8a9b29b7490c5e0aacb87769316f539d7ad 100644 --- a/server/app/common/logic/NoticeLogic.php +++ b/server/app/common/logic/NoticeLogic.php @@ -20,6 +20,8 @@ use app\common\model\notice\NoticeRecord; use app\common\model\notice\NoticeSetting; use app\common\model\user\User; use app\common\service\sms\SmsMessageService; +use Exception; +use think\Model; /** @@ -37,12 +39,12 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 15:28 */ - public static function noticeByScene($params) + public static function noticeByScene($params): bool { try { $noticeSetting = NoticeSetting::where('scene_id', $params['scene_id'])->findOrEmpty()->toArray(); if (empty($noticeSetting)) { - throw new \Exception('找不到对应场景的配置'); + throw new Exception('找不到对应场景的配置'); } // 合并额外参数 $params = self::mergeParams($params); @@ -55,7 +57,7 @@ class NoticeLogic extends BaseLogic } return $res; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -69,7 +71,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 15:28 */ - public static function mergeParams($params) + public static function mergeParams($params): array { // 用户相关 if (!empty($params['params']['user_id'])) { @@ -97,7 +99,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 15:29 */ - public static function getPathByScene($sceneId, $extraId) + public static function getPathByScene($sceneId, $extraId): array { // 小程序主页路径 $page = '/pages/index/index'; @@ -118,7 +120,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 15:29 */ - public static function contentFormat($content, $params) + public static function contentFormat($content, $params): mixed { foreach ($params['params'] as $k => $v) { $search = '{' . $k . '}'; @@ -135,11 +137,11 @@ class NoticeLogic extends BaseLogic * @param $sendType * @param $content * @param string $extra - * @return NoticeRecord|\think\Model + * @return NoticeRecord|Model * @author 乔峰 * @date 2022/9/15 15:29 */ - public static function addNotice($params, $noticeSetting, $sendType, $content, $extra = '') + public static function addNotice($params, $noticeSetting, $sendType, $content, $extra = ''): NoticeRecord|Model { return NoticeRecord::create([ 'user_id' => $params['params']['user_id'] ?? 0, @@ -163,7 +165,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/9/15 15:30 */ - public static function getTitleByScene($sendType, $noticeSetting) + public static function getTitleByScene($sendType, $noticeSetting): string { switch ($sendType) { case NoticeEnum::SMS: diff --git a/server/app/common/logic/PayNotifyLogic.php b/server/app/common/logic/PayNotifyLogic.php index 09da1cadfc95d1c6a748ba067e03643375ae7f4b..0c369d5e3e0cd502a288065f592bf38a229c4ae0 100644 --- a/server/app/common/logic/PayNotifyLogic.php +++ b/server/app/common/logic/PayNotifyLogic.php @@ -6,6 +6,7 @@ use app\common\enum\PayEnum; use app\common\enum\user\AccountLogEnum; use app\common\model\recharge\RechargeOrder; use app\common\model\user\User; +use Exception; use think\facade\Db; use support\Log; @@ -17,14 +18,14 @@ use support\Log; class PayNotifyLogic extends BaseLogic { - public static function handle($action, $orderSn, $extra = []) + public static function handle($action, $orderSn, $extra = []): true|string { Db::startTrans(); try { self::$action($orderSn, $extra); Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); Log::info(implode('-', [ __CLASS__, @@ -46,7 +47,7 @@ class PayNotifyLogic extends BaseLogic * @author bingo * @date 2023/2/27 15:28 */ - public static function recharge($orderSn, $extra = []) + public static function recharge($orderSn, $extra = []): void { $order = RechargeOrder::where('sn', $orderSn)->findOrEmpty(); // 增加用户累计充值金额及用户余额 diff --git a/server/app/common/logic/PaymentLogic.php b/server/app/common/logic/PaymentLogic.php index dd537a514cfd92d4288cd998d31d816e772b63f8..9cd2bad8a87e07feb8c88c60ef0aa04c55f9b974 100644 --- a/server/app/common/logic/PaymentLogic.php +++ b/server/app/common/logic/PaymentLogic.php @@ -9,6 +9,8 @@ use app\common\model\pay\PayWay; use app\common\model\recharge\RechargeOrder; use app\common\model\user\User; use app\common\service\pay\WeChatPayService; +use Exception; +use think\Model; /** @@ -28,7 +30,7 @@ class PaymentLogic extends BaseLogic * @author bingo * @date 2023/2/24 17:53 */ - public static function getPayWay($userId, $terminal, $params) + public static function getPayWay($userId, $terminal, $params): false|array { try { if ($params['from'] == 'recharge') { @@ -37,7 +39,7 @@ class PaymentLogic extends BaseLogic } if (empty($order)) { - throw new \Exception('待支付订单不存在'); + throw new Exception('待支付订单不存在'); } //获取支付场景 @@ -71,7 +73,7 @@ class PaymentLogic extends BaseLogic 'order_amount' => $order['order_amount'], ]; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -85,7 +87,7 @@ class PaymentLogic extends BaseLogic * @author bingo * @date 2023/3/1 16:23 */ - public static function getPayStatus($params) + public static function getPayStatus($params): false|array { try { $order = []; @@ -107,7 +109,7 @@ class PaymentLogic extends BaseLogic } if (empty($order)) { - throw new \Exception('订单不存在'); + throw new Exception('订单不存在'); } return [ @@ -115,7 +117,7 @@ class PaymentLogic extends BaseLogic 'pay_way' => $order['pay_way'], 'order' => $orderInfo ]; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -125,27 +127,27 @@ class PaymentLogic extends BaseLogic /** * @notes 获取预支付订单信息 * @param $params - * @return RechargeOrder|array|false|\think\Model + * @return RechargeOrder|array|false|Model * @author bingo * @date 2023/2/27 15:19 */ - public static function getPayOrderInfo($params) + public static function getPayOrderInfo($params): false|array|RechargeOrder|Model { try { switch ($params['from']) { case 'recharge': $order = RechargeOrder::findOrEmpty($params['order_id']); if ($order->isEmpty()) { - throw new \Exception('充值订单不存在'); + throw new Exception('充值订单不存在'); } break; } if ($order['pay_status'] == PayEnum::ISPAID) { - throw new \Exception('订单已支付'); + throw new Exception('订单已支付'); } return $order; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -163,7 +165,7 @@ class PaymentLogic extends BaseLogic * @author bingo * @date 2023/2/28 12:15 */ - public static function pay($payWay, $from, $order, $terminal, $redirectUrl) + public static function pay($payWay, $from, $order, $terminal, $redirectUrl): mixed { // 支付编号-仅为微信支付预置(同一商户号下不同客户端支付需使用唯一订单号) $paySn = $order['sn']; @@ -213,7 +215,7 @@ class PaymentLogic extends BaseLogic * @date 2023/3/1 16:31 * @remark 回调时使用了不同的回调地址,导致跨客户端支付时(例如小程序,公众号)可能出现201,商户订单号重复错误 */ - public static function formatOrderSn($orderSn, $terminal) + public static function formatOrderSn($orderSn, $terminal): string { $suffix = mb_substr(time(), -4); return $orderSn . $terminal . $suffix; diff --git a/server/app/common/logic/RefundLogic.php b/server/app/common/logic/RefundLogic.php index d6ce286b5ee9f2db5126fce05811fb65a717a8eb..9f32742e7e3dffd57fc7ec07628c72707f7bc85e 100644 --- a/server/app/common/logic/RefundLogic.php +++ b/server/app/common/logic/RefundLogic.php @@ -23,6 +23,9 @@ use app\common\enum\RefundEnum; use app\common\model\refund\RefundLog; use app\common\model\refund\RefundRecord; use app\common\service\pay\WeChatPayService; +use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; +use EasyWeChat\Kernel\Exceptions\InvalidConfigException; +use Exception; /** @@ -33,7 +36,7 @@ use app\common\service\pay\WeChatPayService; class RefundLogic extends BaseLogic { - protected static $refundLog; + protected static mixed $refundLog; /** @@ -43,11 +46,11 @@ class RefundLogic extends BaseLogic * @param $refundAmount * @param $handleId * @return bool - * @throws \Exception + * @throws Exception * @author bingo * @date 2023/2/28 17:24 */ - public static function refund($order, $refundRecordId, $refundAmount, $handleId) + public static function refund($order, $refundRecordId, $refundAmount, $handleId): bool { // 退款前校验 self::refundBeforeCheck($refundAmount); @@ -63,12 +66,12 @@ class RefundLogic extends BaseLogic self::wechatPayRefund($order, $refundAmount); break; default: - throw new \Exception('支付方式异常'); + throw new Exception('支付方式异常'); } // 此处true并不表示退款成功,仅表示退款请求成功,具体成功与否由定时任务查询或通过退款回调得知 return true; - } catch (\Exception $e) { + } catch (Exception $e) { // 退款请求失败,标记退款记录及日志为失败.在退款记录处重新退款 self::$error = $e->getMessage(); self::refundFailHandle($refundRecordId, $e->getMessage()); @@ -80,14 +83,14 @@ class RefundLogic extends BaseLogic /** * @notes 退款前校验 * @param $refundAmount - * @throws \Exception + * @throws Exception * @author bingo * @date 2023/2/28 16:27 */ - public static function refundBeforeCheck($refundAmount) + public static function refundBeforeCheck($refundAmount): void { if ($refundAmount <= 0) { - throw new \Exception('订单金额异常'); + throw new Exception('订单金额异常'); } } @@ -96,12 +99,12 @@ class RefundLogic extends BaseLogic * @notes 微信支付退款 * @param $order * @param $refundAmount - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author bingo * @date 2023/2/28 17:19 */ - public static function wechatPayRefund($order, $refundAmount) + public static function wechatPayRefund($order, $refundAmount): void { // 发起退款。 若发起退款请求返回明确错误,退款日志和记录标记状态为退款失败 // 退款日志及记录的成功状态目前统一由定时任务查询退款结果为退款成功后才标记成功 @@ -122,7 +125,7 @@ class RefundLogic extends BaseLogic * @date 2023/2/28 16:00 * @remark 【微信,支付宝】退款接口请求失败时,更新退款记录及日志为失败,在退款记录重新发起 */ - public static function refundFailHandle($refundRecordId, $msg) + public static function refundFailHandle($refundRecordId, $msg): void { // 更新退款日志记录 RefundLog::update([ @@ -150,7 +153,7 @@ class RefundLogic extends BaseLogic * @author bingo * @date 2023/2/28 15:29 */ - public static function log($order, $refundRecordId, $refundAmount, $handleId, $refundStatus = RefundEnum::REFUND_ING) + public static function log($order, $refundRecordId, $refundAmount, $handleId, $refundStatus = RefundEnum::REFUND_ING): void { $sn = generate_sn(RefundLog::class, 'sn'); diff --git a/server/app/common/model/BaseModel.php b/server/app/common/model/BaseModel.php index d39821a27456667753500461826c7789e07e3f74..77b8e9dd1f472056e841b2b7ce1afea97700cf09 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -5,12 +5,18 @@ namespace app\common\model; use app\common\service\FileService; +use Closure; +use Generator; use think\db\BaseQuery; use think\db\Query; use think\Model; +use think\model\Collection; +use think\Paginator; /** * Class BaseModel 基础模型 + * @property string $name 表名; + * @property string $deleteTime 删除时间; * * Class Model 框架基础模型 * @package think @@ -39,7 +45,7 @@ use think\Model; * @method Query join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询 * @method Query view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询 * @method Query with(mixed $with) static 关联预载入 - * @method Query count(string $field) static Count统计查询 + * @method int count(string $field) static Count统计查询 * @method Query min(string $field) static Min统计查询 * @method Query max(string $field) static Max统计查询 * @method Query sum(string $field) static SUM统计查询 @@ -53,10 +59,9 @@ use think\Model; * @method Query cache(mixed $key = null, integer $expire = null) static 设置查询缓存 * @method mixed value(string $field) static 获取某个字段的值 * @method array column(string $field, string $key = '') static 获取某个列的值 - * @method Model find(mixed $data = null) static 查询单个记录 不存在返回Null - * @method Model findOrEmpty(mixed $data = null) static 查询单个记录 不存在返回空模型 - * @method \think\model\Collection select(mixed $data = null) static 查询多个记录 - * @method Model withAttr(array $name, \Closure $closure) 动态定义获取器 + * @method static $this find(mixed $data = null) static 查询单个记录 不存在返回Null + * @method static $this findOrEmpty(mixed $data = null) static 查询单个记录 不存在返回空模型 + * @method Collection select(mixed $data = null) static 查询多个记录 * * Class DbManager 数据库管理类 * @package think @@ -67,16 +72,16 @@ use think\Model; * @method Query table(string $table) static 指定数据表(含前缀) * @method Query name(string $name) static 指定数据表(不含前缀) * @method Query withAttr(string $name, callable $callback = null) static 使用获取器获取数据 - * @method integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录 - * @method integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID - * @method integer insertAll(array $dataSet) static 插入多条记录 - * @method integer update(array $data) static 更新记录 - * @method integer delete(mixed $data = null) static 删除记录 - * @method boolean chunk(integer $count, callable $callback, string $column = null) static 分块获取数据 - * @method \Generator cursor(mixed $data = null) static 使用游标查找记录 + * @method int insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录 + * @method int insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID + * @method int insertAll(array $dataSet) static 插入多条记录 + * @method int update(array $data) static 更新记录 + * @method int delete(mixed $data = null) static 删除记录 + * @method boolean chunk(int $count, callable $callback, string $column = null) static 分块获取数据 + * @method Generator cursor(mixed $data = null) static 使用游标查找记录 * @method mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查询 - * @method integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行 - * @method \think\Paginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分页查询 + * @method int execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行 + * @method Paginator paginate(int $listRows = 15, mixed $simple = null, array $config = []) static 分页查询 * @method mixed transaction(callable $callback) static 执行数据库事务 * @method void startTrans() static 启动事务 * @method void commit() static 用于非自动提交状态下面的查询提交 diff --git a/server/app/common/model/Config.php b/server/app/common/model/Config.php index 1b75fb6392d80e5a52bc68b844022a1fa372f2bf..d7f2ba0838253bd6ab137b136517a6cfaaa6b149 100644 --- a/server/app/common/model/Config.php +++ b/server/app/common/model/Config.php @@ -3,8 +3,36 @@ namespace app\common\model; +/** + * 配置表模型 + * Class Config + * @package app\common\model + * @property int $id 主键 + * @property string $type 类型 + * @property string $name 名称 + * @property string $value 值 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + */ class Config extends BaseModel { + protected $name = 'config'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //类型 + 'type' => 'string', + //名称 + 'name' => 'string', + //值 + 'value' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/Crontab.php b/server/app/common/model/Crontab.php index 9a90549022b7accb7e5460c5281fb09e5d512f63..62c05c036888452f8590b0ca6b99fc35f77fd2b6 100644 --- a/server/app/common/model/Crontab.php +++ b/server/app/common/model/Crontab.php @@ -21,6 +21,22 @@ use think\model\concern\SoftDelete; * 定时任务模型 * Class Crontab * @package app\common\model + * @property int $id 主键 + * @property string $name 定时任务名称 + * @property int $type 类型 1-定时任务 + * @property int $system 是否系统任务 0-否 1-是 + * @property string $remark 备注 + * @property string $command 命令内容 + * @property string $params 参数 + * @property int $status 状态 1-运行 2-停止 3-错误 + * @property string $expression 运行规则 + * @property string $error 运行失败原因 + * @property int $last_time 最后执行时间 + * @property string $time 实时执行时长 + * @property string $max_time 最大执行时长 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class Crontab extends BaseModel { @@ -29,6 +45,42 @@ class Crontab extends BaseModel protected $deleteTime = 'delete_time'; protected $name = 'dev_crontab'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //定时任务名称 + 'name' => 'string', + //类型 1-定时任务 + 'type' => 'int', + //是否系统任务 0-否 1-是 + 'system' => 'int', + //备注 + 'remark' => 'string', + //命令内容 + 'command' => 'string', + //参数 + 'params' => 'string', + //状态 1-运行 2-停止 3-错误 + 'status' => 'int', + //运行规则 + 'expression' => 'string', + //运行失败原因 + 'error' => 'string', + //最后执行时间 + 'last_time' => 'int', + //实时执行时长 + 'time' => 'string', + //最大执行时长 + 'max_time' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** diff --git a/server/app/common/model/HotSearch.php b/server/app/common/model/HotSearch.php index 2565e2e2db578d7314480848a011b0cab99350d9..9d41e4e7e47c63737bb194c079b4002433a79fcd 100644 --- a/server/app/common/model/HotSearch.php +++ b/server/app/common/model/HotSearch.php @@ -14,7 +14,30 @@ namespace app\common\model; +/** + * 热门搜索表模型 + * Class HotSearch + * @package app\common\model + * @property int $id 主键 主键 + * @property string $name 关键词 + * @property int $sort 排序号 + * @property int $create_time 创建时间 + + */ class HotSearch extends BaseModel { + protected $name = 'hot_search'; + + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //关键词 + 'name' => 'string', + //排序号 + 'sort' => 'int', + //创建时间 + 'create_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/OperationLog.php b/server/app/common/model/OperationLog.php index e9a393ff0cb5e33d69dea39717f715d9c19e2b98..6e581d585a11a412e06e6cd441625b5b37d40233 100644 --- a/server/app/common/model/OperationLog.php +++ b/server/app/common/model/OperationLog.php @@ -4,6 +4,51 @@ namespace app\common\model; +/** + * 系统日志表模型 + * Class OperationLog + * @package app\common\model + * @property int $id 主键 + * @property int $admin_id 管理员ID + * @property string $admin_name 管理员名称 + * @property string $account 管理员账号 + * @property string $action 操作名称 + * @property string $type 请求方式 + * @property string $url 访问链接 + * @property string $params 请求数据 + * @property string $result 请求结果 + * @property string $ip ip地址 + * @property int $create_time 创建时间 + + */ class OperationLog extends BaseModel { + protected $name = 'operation_log'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //管理员ID + 'admin_id' => 'int', + //管理员名称 + 'admin_name' => 'string', + //管理员账号 + 'account' => 'string', + //操作名称 + 'action' => 'string', + //请求方式 + 'type' => 'string', + //访问链接 + 'url' => 'string', + //请求数据 + 'params' => 'string', + //请求结果 + 'result' => 'string', + //ip地址 + 'ip' => 'string', + //创建时间 + 'create_time' => 'int', + ]; + } \ No newline at end of file diff --git a/server/app/common/model/article/Article.php b/server/app/common/model/article/Article.php index edc466adb81fdd33fda310771a90d6abec86ed0a..182ebe60e5a7c06bc56ccde94a49688d1ad609ab 100644 --- a/server/app/common/model/article/Article.php +++ b/server/app/common/model/article/Article.php @@ -22,13 +22,63 @@ use think\model\concern\SoftDelete; * 资讯管理模型 * Class Article * @package app\common\model\article; + * @property int $id 主键 文章id + * @property int $cid 文章分类 + * @property string $title 文章标题 + * @property string $desc 简介 + * @property string $abstract 文章摘要 + * @property string $image 文章图片 + * @property string $author 作者 + * @property string $content 文章内容 + * @property int $click_virtual 虚拟浏览量 + * @property int $click_actual 实际浏览量 + * @property int $is_show 是否显示:1-是.0-否 + * @property int $sort 排序 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class Article extends BaseModel { use SoftDelete; + protected $name = 'article'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 文章id + 'id' => 'int', + //文章分类 + 'cid' => 'int', + //文章标题 + 'title' => 'string', + //简介 + 'desc' => 'string', + //文章摘要 + 'abstract' => 'string', + //文章图片 + 'image' => 'string', + //作者 + 'author' => 'string', + //文章内容 + 'content' => 'string', + //虚拟浏览量 + 'click_virtual' => 'int', + //实际浏览量 + 'click_actual' => 'int', + //是否显示:1-是.0-否 + 'is_show' => 'int', + //排序 + 'sort' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** * @notes 获取分类名称 * @param $value diff --git a/server/app/common/model/article/ArticleCate.php b/server/app/common/model/article/ArticleCate.php index d6928d705a6b7beee9d2438f4b3edbefd551b483..7de91c09c57423d26de6bee19a9cda0a9f6b94ee 100644 --- a/server/app/common/model/article/ArticleCate.php +++ b/server/app/common/model/article/ArticleCate.php @@ -16,26 +16,51 @@ namespace app\common\model\article; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +use think\model\relation\HasMany; /** * 资讯分类管理模型 * Class ArticleCate * @package app\common\model\article; + * @property int $id 主键 文章分类id + * @property string $name 分类名称 + * @property int $sort 排序 + * @property int $is_show 是否显示:1-是;0-否 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class ArticleCate extends BaseModel { use SoftDelete; + protected $name = 'article_cate'; protected $deleteTime = 'delete_time'; - + //设置字段信息 + protected $schema = [ + //主键 文章分类id + 'id' => 'int', + //分类名称 + 'name' => 'string', + //排序 + 'sort' => 'int', + //是否显示:1-是;0-否 + 'is_show' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; /** * @notes 关联文章 - * @return \think\model\relation\HasMany + * @return HasMany * @author 段誉 * @date 2022/10/19 16:59 */ - public function article() + public function article(): HasMany { return $this->hasMany(Article::class, 'cid', 'id'); } diff --git a/server/app/common/model/article/ArticleCollect.php b/server/app/common/model/article/ArticleCollect.php index 8c683f749898a30d06335c32d4985cc6e1f7a0ca..8d06c1209429151476fdb80b7c1bf06cecc22757 100644 --- a/server/app/common/model/article/ArticleCollect.php +++ b/server/app/common/model/article/ArticleCollect.php @@ -22,13 +22,38 @@ use think\model\concern\SoftDelete; * 资讯收藏 * Class ArticleCollect * @package app\common\model\article + * @property int $id 主键 主键 + * @property int $user_id 用户ID + * @property int $article_id 文章ID + * @property int $status 收藏状态 0-未收藏 1-已收藏 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class ArticleCollect extends BaseModel { use SoftDelete; + protected $name = 'article_collect'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //用户ID + 'user_id' => 'int', + //文章ID + 'article_id' => 'int', + //收藏状态 0-未收藏 1-已收藏 + 'status' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; /** * @notes 是否已收藏文章 diff --git a/server/app/common/model/auth/Admin.php b/server/app/common/model/auth/Admin.php index 3a0d873a9baa21e22ee8c6e0ba91493ce1fa3c1f..7b0adbcdb877967d296bab6f96bb9be76b2ebe2f 100644 --- a/server/app/common/model/auth/Admin.php +++ b/server/app/common/model/auth/Admin.php @@ -8,13 +8,61 @@ use app\common\enum\YesNoEnum; use app\common\model\BaseModel; use app\common\service\FileService; use think\model\concern\SoftDelete; - +/** + * 管理员表模型 + * Class Admin + * @package app\common\model\auth + * @property int $id 主键 + * @property int $root 是否超级管理员 0-否 1-是 + * @property string $name 名称 + * @property string $avatar 用户头像 + * @property string $account 账号 + * @property string $password 密码 + * @property int $login_time 最后登录时间 + * @property string $login_ip 最后登录ip + * @property int $multipoint_login 是否支持多处登录:1-是;0-否; + * @property int $disable 是否禁用:0-否;1-是; + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 + * @property int $delete_time 删除时间 + + */ class Admin extends BaseModel { use SoftDelete; + protected $name = 'admin'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //是否超级管理员 0-否 1-是 + 'root' => 'int', + //名称 + 'name' => 'string', + //用户头像 + 'avatar' => 'string', + //账号 + 'account' => 'string', + //密码 + 'password' => 'string', + //最后登录时间 + 'login_time' => 'int', + //最后登录ip + 'login_ip' => 'string', + //是否支持多处登录:1-是;0-否; + 'multipoint_login' => 'int', + //是否禁用:0-否;1-是; + 'disable' => 'int', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; protected $append = [ 'role_id', 'dept_id', diff --git a/server/app/common/model/auth/AdminDept.php b/server/app/common/model/auth/AdminDept.php index 0bae455ffe3067c347e4da5c8f1eeb3d442d267f..74ca07487b48117d83bd55bd2fb4bfb2fb8673b2 100644 --- a/server/app/common/model/auth/AdminDept.php +++ b/server/app/common/model/auth/AdminDept.php @@ -16,8 +16,25 @@ namespace app\common\model\auth; use app\common\model\BaseModel; +/** + * 部门关联表模型 + * Class AdminDept + * @package app\common\model\auth + * @property int $admin_id 管理员id + * @property int $dept_id 主键 部门id + + */ class AdminDept extends BaseModel { + protected $name = 'admin_dept'; + //设置字段信息 + protected $schema = [ + //管理员id + 'admin_id' => 'int', + //主键 部门id + 'dept_id' => 'int', + ]; + /** * @notes 删除用户关联部门 * @param $adminId diff --git a/server/app/common/model/auth/AdminJobs.php b/server/app/common/model/auth/AdminJobs.php index 6e8c5b3d01c08be54144b229f3cf7d863ca273ba..423c199b7650a0941e66874e4763c3c9242439cc 100644 --- a/server/app/common/model/auth/AdminJobs.php +++ b/server/app/common/model/auth/AdminJobs.php @@ -16,8 +16,24 @@ namespace app\common\model\auth; use app\common\model\BaseModel; +/** + * 岗位关联表模型 + * Class AdminJobs + * @package app\common\model\auth + * @property int $admin_id 管理员id + * @property int $jobs_id 主键 岗位id + + */ class AdminJobs extends BaseModel { + protected $name = 'admin_jobs'; + //设置字段信息 + protected $schema = [ + //管理员id + 'admin_id' => 'int', + //主键 岗位id + 'jobs_id' => 'int', + ]; /** * @notes 删除用户关联岗位 * @param $adminId diff --git a/server/app/common/model/auth/AdminRole.php b/server/app/common/model/auth/AdminRole.php index 79433cdd119d193db869bc102ab063f669f1e7ca..e9c46ba87224b52979e320d364865b086eec5e68 100644 --- a/server/app/common/model/auth/AdminRole.php +++ b/server/app/common/model/auth/AdminRole.php @@ -16,9 +16,24 @@ namespace app\common\model\auth; use app\common\model\BaseModel; +/** + * 角色关联表模型 + * Class AdminRole + * @package app\common\model\auth + * @property int $admin_id 管理员id + * @property int $role_id 主键 角色id + + */ class AdminRole extends BaseModel { - + protected $name = 'admin_role'; + //设置字段信息 + protected $schema = [ + //管理员id + 'admin_id' => 'int', + //主键 角色id + 'role_id' => 'int', + ]; /** * @notes 删除用户关联角色 * @param $adminId diff --git a/server/app/common/model/auth/AdminSession.php b/server/app/common/model/auth/AdminSession.php index f8b20266ec05329dc4816a2608931573280fcaf5..f0272a5e700087202429296b456afec78acbcc06 100644 --- a/server/app/common/model/auth/AdminSession.php +++ b/server/app/common/model/auth/AdminSession.php @@ -15,16 +15,45 @@ namespace app\common\model\auth; use app\common\model\BaseModel; +use think\model\relation\HasOne; +/** + * 管理员会话表模型 + * Class AdminSession + * @package app\common\model\auth + * @property int $id 主键 + * @property int $admin_id 用户id + * @property int $terminal 客户端类型:1-pc管理后台 2-mobile手机管理后台 + * @property string $token 令牌 + * @property int $update_time 更新时间 + * @property int $expire_time 到期时间 + */ class AdminSession extends BaseModel { + protected $name = 'admin_session'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //用户id + 'admin_id' => 'int', + //客户端类型:1-pc管理后台 2-mobile手机管理后台 + 'terminal' => 'int', + //令牌 + 'token' => 'string', + //更新时间 + 'update_time' => 'int', + //到期时间 + 'expire_time' => 'int', + ]; + /** * @notes 关联管理员表 - * @return \think\model\relation\HasOne + * @return HasOne * @author 令狐冲 * @date 2021/7/5 14:39 */ - public function admin() + public function admin(): HasOne { return $this->hasOne(Admin::class, 'id', 'admin_id') ->field('id,multipoint_login'); diff --git a/server/app/common/model/auth/SystemMenu.php b/server/app/common/model/auth/SystemMenu.php index 246c735625cd7895641f3785212096c284f486f7..f28469bcb67d7ecc46f5a14bd6e00899dab404f4 100644 --- a/server/app/common/model/auth/SystemMenu.php +++ b/server/app/common/model/auth/SystemMenu.php @@ -22,10 +22,61 @@ use app\common\model\BaseModel; * 系统菜单 * Class SystemMenu * @package app\common\model\auth + * @property int $id 主键 主键 + * @property int $pid 上级菜单 + * @property string $type 权限类型: M=目录,C=菜单,A=按钮 + * @property string $name 菜单名称 + * @property string $icon 菜单图标 + * @property int $sort 菜单排序 + * @property string $perms 权限标识 + * @property string $paths 路由地址 + * @property string $component 前端组件 + * @property string $selected 选中路径 + * @property string $params 路由参数 + * @property int $is_cache 是否缓存: 0=否, 1=是 + * @property int $is_show 是否显示: 0=否, 1=是 + * @property int $is_disable 是否禁用: 0=否, 1=是 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class SystemMenu extends BaseModel { - + protected $name = 'system_menu'; + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //上级菜单 + 'pid' => 'int', + //权限类型: M=目录,C=菜单,A=按钮 + 'type' => 'string', + //菜单名称 + 'name' => 'string', + //菜单图标 + 'icon' => 'string', + //菜单排序 + 'sort' => 'int', + //权限标识 + 'perms' => 'string', + //路由地址 + 'paths' => 'string', + //前端组件 + 'component' => 'string', + //选中路径 + 'selected' => 'string', + //路由参数 + 'params' => 'string', + //是否缓存: 0=否, 1=是 + 'is_cache' => 'int', + //是否显示: 0=否, 1=是 + 'is_show' => 'int', + //是否禁用: 0=否, 1=是 + 'is_disable' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/auth/SystemRole.php b/server/app/common/model/auth/SystemRole.php index fd0c52898285c6cf217546c085a31d58d9a43c8e..36e83062d72789efe3c31cf71f73909639260cb7 100644 --- a/server/app/common/model/auth/SystemRole.php +++ b/server/app/common/model/auth/SystemRole.php @@ -16,11 +16,19 @@ namespace app\common\model\auth; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +use think\model\relation\HasMany; /** * 角色模型 * Class Role * @package app\common\model + * @property int $id 主键 + * @property string $name 名称 + * @property string $desc 描述 + * @property int $sort 排序 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class SystemRole extends BaseModel { @@ -30,9 +38,26 @@ class SystemRole extends BaseModel protected $name = 'system_role'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //名称 + 'name' => 'string', + //描述 + 'desc' => 'string', + //排序 + 'sort' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; /** * @notes 角色与菜单关联关系 - * @return \think\model\relation\HasMany + * @return HasMany * @author 乔峰 * @date 2022/7/6 11:16 */ diff --git a/server/app/common/model/auth/SystemRoleMenu.php b/server/app/common/model/auth/SystemRoleMenu.php index 238415f72468718d32af22dacb5650de684a4ddf..a9ef5a8141c07e4f68174db161e8b0f4b83b4dd1 100644 --- a/server/app/common/model/auth/SystemRoleMenu.php +++ b/server/app/common/model/auth/SystemRoleMenu.php @@ -22,9 +22,17 @@ use app\common\model\BaseModel; * 角色与菜单权限关系 * Class SystemRoleMenu * @package app\common\model\auth + * @property int $role_id 角色ID + * @property int $menu_id 主键 菜单ID */ class SystemRoleMenu extends BaseModel { - - + protected $name = 'system_role_menu'; + //设置字段信息 + protected $schema = [ + //角色ID + 'role_id' => 'int', + //主键 菜单ID + 'menu_id' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/channel/OfficialAccountReply.php b/server/app/common/model/channel/OfficialAccountReply.php index 084d76f135a5fa856cdee518b0d9382235880000..2ca5e27b943e0f8326993b5e5e6f0c52ba52a00b 100644 --- a/server/app/common/model/channel/OfficialAccountReply.php +++ b/server/app/common/model/channel/OfficialAccountReply.php @@ -21,8 +21,50 @@ use app\common\model\BaseModel; * 微信公众号回复 * Class OfficialAccountReply * @package app\common\model\channel + * @property int $id 主键 + * @property string $name 规则名称 + * @property string $keyword 关键词 + * @property int $reply_type 回复类型 1-关注回复 2-关键字回复 3-默认回复 + * @property int $matching_type 匹配方式:1-全匹配;2-模糊匹配 + * @property int $content_type 内容类型:1-文本 + * @property string $content 回复内容 + * @property int $status 启动状态:1-启动;0-关闭 + * @property int $sort 排序 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class OfficialAccountReply extends BaseModel { + protected $name = 'official_account_reply'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //规则名称 + 'name' => 'string', + //关键词 + 'keyword' => 'string', + //回复类型 1-关注回复 2-关键字回复 3-默认回复 + 'reply_type' => 'int', + //匹配方式:1-全匹配;2-模糊匹配 + 'matching_type' => 'int', + //内容类型:1-文本 + 'content_type' => 'int', + //回复内容 + 'content' => 'string', + //启动状态:1-启动;0-关闭 + 'status' => 'int', + //排序 + 'sort' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + } \ No newline at end of file diff --git a/server/app/common/model/decorate/DecoratePage.php b/server/app/common/model/decorate/DecoratePage.php index caa980d46b4fa94874c6965a19fd38545dece855..9e428e1588210a0bf8d91a10181c11f09f14bbca 100644 --- a/server/app/common/model/decorate/DecoratePage.php +++ b/server/app/common/model/decorate/DecoratePage.php @@ -21,8 +21,32 @@ use app\common\model\BaseModel; * 装修配置-页面 * Class DecorateTabbar * @package app\common\model\decorate + * @property int $id 主键 主键 + * @property int $type 页面类型 1=商城首页, 2=个人中心, 3=客服设置 4-PC首页 + * @property string $name 页面名称 + * @property string $data 页面数据 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class DecoratePage extends BaseModel { + protected $name = 'decorate_page'; + + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //页面类型 1=商城首页, 2=个人中心, 3=客服设置 4-PC首页 + 'type' => 'int', + //页面名称 + 'name' => 'string', + //页面数据 + 'data' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; + } \ No newline at end of file diff --git a/server/app/common/model/decorate/DecorateTabbar.php b/server/app/common/model/decorate/DecorateTabbar.php index d1405a910e62ba87872f1f82b47bb0cd6363747d..a3d7d35e0b8c8f41e74fbe1878f7be78ca71fe56 100644 --- a/server/app/common/model/decorate/DecorateTabbar.php +++ b/server/app/common/model/decorate/DecorateTabbar.php @@ -16,15 +16,44 @@ namespace app\common\model\decorate; use app\common\model\BaseModel; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; /** * 装修配置-底部导航 * Class DecorateTabbar * @package app\common\model\decorate + * @property int $id 主键 主键 + * @property string $name 导航名称 + * @property string $selected 未选图标 + * @property string $unselected 已选图标 + * @property string $link 链接地址 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class DecorateTabbar extends BaseModel { + protected $name = 'decorate_tabbar'; + + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //导航名称 + 'name' => 'string', + //未选图标 + 'selected' => 'string', + //已选图标 + 'unselected' => 'string', + //链接地址 + 'link' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; // 设置json类型字段 protected $json = ['link']; @@ -35,9 +64,9 @@ class DecorateTabbar extends BaseModel /** * @notes 获取底部导航列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 段誉 * @date 2022/9/23 12:07 */ diff --git a/server/app/common/model/dept/Dept.php b/server/app/common/model/dept/Dept.php index 5a1cb7c0fb033c7590266badc7e5316d4181aa90..e01feb68e849a5d8883e9c0debb5248cf69a6454 100644 --- a/server/app/common/model/dept/Dept.php +++ b/server/app/common/model/dept/Dept.php @@ -22,14 +22,49 @@ use think\model\concern\SoftDelete; * 部门模型 * Class Dept * @package app\common\model\article + * @property int $id 主键 id + * @property string $name 部门名称 + * @property int $pid 上级部门id + * @property int $sort 排序 + * @property string $leader 负责人 + * @property string $mobile 联系电话 + * @property int $status 部门状态(0停用 1正常) + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 + * @property int $delete_time 删除时间 */ class Dept extends BaseModel { use SoftDelete; + protected $name = 'dept'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //部门名称 + 'name' => 'string', + //上级部门id + 'pid' => 'int', + //排序 + 'sort' => 'int', + //负责人 + 'leader' => 'string', + //联系电话 + 'mobile' => 'string', + //部门状态(0停用 1正常) + 'status' => 'int', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** * @notes 状态描述 * @param $value diff --git a/server/app/common/model/dept/Jobs.php b/server/app/common/model/dept/Jobs.php index d1c7346eb2e93769e58823787fb8118901f5c131..be0acea770d5b3c465d38a6101b89ba6e631e872 100644 --- a/server/app/common/model/dept/Jobs.php +++ b/server/app/common/model/dept/Jobs.php @@ -22,13 +22,46 @@ use think\model\concern\SoftDelete; * 岗位模型 * Class Jobs * @package app\common\model\dept + * @property int $id 主键 id + * @property string $name 岗位名称 + * @property string $code 岗位编码 + * @property int $sort 显示顺序 + * @property int $status 状态(0停用 1正常) + * @property string $remark 备注 + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 + * @property int $delete_time 删除时间 */ class Jobs extends BaseModel { use SoftDelete; + protected $name = 'jobs'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //岗位名称 + 'name' => 'string', + //岗位编码 + 'code' => 'string', + //显示顺序 + 'sort' => 'int', + //状态(0停用 1正常) + 'status' => 'int', + //备注 + 'remark' => 'string', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + + /** * @notes 状态描述 * @param $value diff --git a/server/app/common/model/dict/DictData.php b/server/app/common/model/dict/DictData.php index 8773ff35ac185c703d3ac0638b87d2a510653a02..6b63b049248dba624646755ad86e7c1b3904c7a6 100644 --- a/server/app/common/model/dict/DictData.php +++ b/server/app/common/model/dict/DictData.php @@ -22,14 +22,52 @@ use think\model\concern\SoftDelete; * 字典数据模型 * Class DictData * @package app\common\model\dict + * @property int $id 主键 id + * @property string $name 数据名称 + * @property string $value 数据值 + * @property int $type_id 字典类型id + * @property string $type_value 字典类型 + * @property int $sort 排序值 + * @property int $status 状态 0-停用 1-正常 + * @property string $remark 备注 + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 + * @property int $delete_time 删除时间 */ class DictData extends BaseModel { use SoftDelete; + protected $name = 'dict_data'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //数据名称 + 'name' => 'string', + //数据值 + 'value' => 'string', + //字典类型id + 'type_id' => 'int', + //字典类型 + 'type_value' => 'string', + //排序值 + 'sort' => 'int', + //状态 0-停用 1-正常 + 'status' => 'int', + //备注 + 'remark' => 'string', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** * @notes 状态描述 diff --git a/server/app/common/model/dict/DictType.php b/server/app/common/model/dict/DictType.php index cca92187b22bfdf8637f8fb3a993c27d0f43004c..ef9e85bdd738df6061978eb71091dcb42852e09b 100644 --- a/server/app/common/model/dict/DictType.php +++ b/server/app/common/model/dict/DictType.php @@ -22,14 +22,44 @@ use think\model\concern\SoftDelete; * 字典类型模型 * Class DictType * @package app\common\model\dict + * @property int $id 主键 id + * @property string $name 字典名称 + * @property string $type 字典类型名称 + * @property int $status 状态 0-停用 1-正常 + * @property string $remark 备注 + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 + * @property int $delete_time 删除时间 */ class DictType extends BaseModel { use SoftDelete; + protected $name = 'dict_type'; + protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //字典名称 + 'name' => 'string', + //字典类型名称 + 'type' => 'string', + //状态 0-停用 1-正常 + 'status' => 'int', + //备注 + 'remark' => 'string', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** * @notes 状态描述 diff --git a/server/app/common/model/file/File.php b/server/app/common/model/file/File.php index b17e5de606376ca4482ce1798719690024386af0..af6170dcb26ff481850a765e8cdee2ee616f7f1d 100644 --- a/server/app/common/model/file/File.php +++ b/server/app/common/model/file/File.php @@ -17,8 +17,50 @@ namespace app\common\model\file; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +/** + * 文件表模型 + * Class File + * @package app\common\model\file + * @property int $id 主键 主键ID + * @property int $cid 类目ID + * @property int $source_id 上传者id + * @property int $source 来源类型[0-后台,1-用户] + * @property int $type 类型[10=图片, 20=视频] + * @property string $name 文件名称 + * @property string $uri 文件路径 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 + + */ class File extends BaseModel { use SoftDelete; + protected $name = 'file'; + protected $deleteTime = 'delete_time'; + + //设置字段信息 + protected $schema = [ + //主键 主键ID + 'id' => 'int', + //类目ID + 'cid' => 'int', + //上传者id + 'source_id' => 'int', + //来源类型[0-后台,1-用户] + 'source' => 'int', + //类型[10=图片, 20=视频] + 'type' => 'int', + //文件名称 + 'name' => 'string', + //文件路径 + 'uri' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/file/FileCate.php b/server/app/common/model/file/FileCate.php index b0e4c92ca39cfb9ce154cf7338fcd7d863c447bf..5ab9e9c3d3472bad4127290c1d43804d193f2eb8 100644 --- a/server/app/common/model/file/FileCate.php +++ b/server/app/common/model/file/FileCate.php @@ -18,8 +18,41 @@ namespace app\common\model\file; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +/** + * 文件分类表模型 + * Class FileCate + * @package app\common\model + * @property int $id 主键 主键ID + * @property int $pid 父级ID + * @property int $type 类型[10=图片,20=视频,30=文件] + * @property string $name 分类名称 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 + + */ class FileCate extends BaseModel { use SoftDelete; + protected $name = 'file_cate'; + protected $deleteTime = 'delete_time'; + + //设置字段信息 + protected $schema = [ + //主键 主键ID + 'id' => 'int', + //父级ID + 'pid' => 'int', + //类型[10=图片,20=视频,30=文件] + 'type' => 'int', + //分类名称 + 'name' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/notice/NoticeRecord.php b/server/app/common/model/notice/NoticeRecord.php index 60f6d7aeed1f6b0a8077db89ef57e3f2d7481eb9..378fa5286bbe3ce8f6907ce34cb3e75a65268d38 100644 --- a/server/app/common/model/notice/NoticeRecord.php +++ b/server/app/common/model/notice/NoticeRecord.php @@ -36,12 +36,57 @@ use think\model\concern\SoftDelete; /** * 通知记录模型 * Class Notice - * @package app\common\model + * @package app\common\model\notice + * @property int $id 主键 ID + * @property int $user_id 用户id + * @property string $title 标题 + * @property string $content 内容 + * @property int $scene_id 场景 + * @property int $read 已读状态;0-未读,1-已读 + * @property int $recipient 通知接收对象类型;1-会员;2-商家;3-平台;4-游客(未注册用户) + * @property int $send_type 通知发送类型 1-系统通知 2-短信通知 3-微信模板 4-微信小程序 + * @property int $notice_type 通知类型 1-业务通知 2-验证码 + * @property string $extra 其他 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class NoticeRecord extends BaseModel { use SoftDelete; + protected $name = 'notice_record'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 ID + 'id' => 'int', + //用户id + 'user_id' => 'int', + //标题 + 'title' => 'string', + //内容 + 'content' => 'string', + //场景 + 'scene_id' => 'int', + //已读状态;0-未读,1-已读 + 'read' => 'int', + //通知接收对象类型;1-会员;2-商家;3-平台;4-游客(未注册用户) + 'recipient' => 'int', + //通知发送类型 1-系统通知 2-短信通知 3-微信模板 4-微信小程序 + 'send_type' => 'int', + //通知类型 1-业务通知 2-验证码 + 'notice_type' => 'int', + //其他 + 'extra' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + + } \ No newline at end of file diff --git a/server/app/common/model/notice/NoticeSetting.php b/server/app/common/model/notice/NoticeSetting.php index e8d6ecc484e5cc562c3e1c166c46d48b347c4f22..1534afdcefd70e48efed36b36071cdd79fdc9b02 100644 --- a/server/app/common/model/notice/NoticeSetting.php +++ b/server/app/common/model/notice/NoticeSetting.php @@ -19,8 +19,56 @@ use app\common\enum\DefaultEnum; use app\common\enum\notice\NoticeEnum; use app\common\model\BaseModel; +/** + * 通知设置表模型 + * Class NoticeSetting + * @package app\common\model\notice + * @property int $id 主键 + * @property int $scene_id 场景id + * @property string $scene_name 场景名称 + * @property string $scene_desc 场景描述 + * @property int $recipient 接收者 1-用户 2-平台 + * @property int $type 通知类型: 1-业务通知 2-验证码 + * @property string $system_notice 系统通知设置 + * @property string $sms_notice 短信通知设置 + * @property string $oa_notice 公众号通知设置 + * @property string $mnp_notice 小程序通知设置 + * @property string $support 支持的发送类型 1-系统通知 2-短信通知 3-微信模板消息 4-小程序提醒 + * @property int $update_time 更新时间 + + */ class NoticeSetting extends BaseModel { + protected $name = 'notice_setting'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //场景id + 'scene_id' => 'int', + //场景名称 + 'scene_name' => 'string', + //场景描述 + 'scene_desc' => 'string', + //接收者 1-用户 2-平台 + 'recipient' => 'int', + //通知类型: 1-业务通知 2-验证码 + 'type' => 'int', + //系统通知设置 + 'system_notice' => 'string', + //短信通知设置 + 'sms_notice' => 'string', + //公众号通知设置 + 'oa_notice' => 'string', + //小程序通知设置 + 'mnp_notice' => 'string', + //支持的发送类型 1-系统通知 2-短信通知 3-微信模板消息 4-小程序提醒 + 'support' => 'string', + //更新时间 + 'update_time' => 'int', + ]; + /** * @notes 短信通知状态 @@ -30,7 +78,7 @@ class NoticeSetting extends BaseModel * @author ljj * @date 2022/2/16 3:22 下午 */ - public function getSmsStatusDescAttr($value,$data) + public function getSmsStatusDescAttr($value,$data): array|string { if ($data['sms_notice']) { $sms_text = json_decode($data['sms_notice'],true); @@ -48,7 +96,7 @@ class NoticeSetting extends BaseModel * @author ljj * @date 2022/2/17 2:50 下午 */ - public function getTypeDescAttr($value,$data) + public function getTypeDescAttr($value,$data): array|string { return NoticeEnum::getTypeDesc($data['type']); } @@ -61,7 +109,7 @@ class NoticeSetting extends BaseModel * @author Tab * @date 2021/8/18 16:42 */ - public function getRecipientDescAttr($value) + public function getRecipientDescAttr($value): string { $desc = [ 1 => '买家', @@ -77,7 +125,7 @@ class NoticeSetting extends BaseModel * @author Tab * @date 2021/8/18 19:11 */ - public function getSystemNoticeAttr($value) + public function getSystemNoticeAttr($value): mixed { return empty($value) ? [] : json_decode($value, true); } @@ -89,7 +137,7 @@ class NoticeSetting extends BaseModel * @author Tab * @date 2021/8/18 19:12 */ - public function getSmsNoticeAttr($value) + public function getSmsNoticeAttr($value): mixed { return empty($value) ? [] : json_decode($value, true); } @@ -101,7 +149,7 @@ class NoticeSetting extends BaseModel * @author Tab * @date 2021/8/18 19:13 */ - public function getOaNoticeAttr($value) + public function getOaNoticeAttr($value): mixed { return empty($value) ? [] : json_decode($value, true); } @@ -113,7 +161,7 @@ class NoticeSetting extends BaseModel * @author Tab * @date 2021/8/18 19:13 */ - public function getMnpNoticeAttr($value) + public function getMnpNoticeAttr($value): mixed { return empty($value) ? [] : json_decode($value, true); } diff --git a/server/app/common/model/notice/SmsLog.php b/server/app/common/model/notice/SmsLog.php index 4c3dedd454c1a819857e0be13631c6b2adc4634b..f2e8a529cf5f375ec85a7a0818fd2fa34747d6d5 100644 --- a/server/app/common/model/notice/SmsLog.php +++ b/server/app/common/model/notice/SmsLog.php @@ -21,10 +21,54 @@ use think\model\concern\SoftDelete; * 短信记录模型 * Class SmsLog * @package app\common\model + * @property int $id 主键 id + * @property int $scene_id 场景id + * @property string $mobile 手机号码 + * @property string $content 发送内容 + * @property string $code 发送关键字(注册、找回密码) + * @property int $is_verify 是否已验证;0-否;1-是 + * @property int $check_num 验证次数 + * @property int $send_status 发送状态:0-发送中;1-发送成功;2-发送失败 + * @property int $send_time 发送时间 + * @property string $results 短信结果 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class SmsLog extends BaseModel { use SoftDelete; + protected $name = 'sms_log'; protected $deleteTime = 'delete_time'; + + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //场景id + 'scene_id' => 'int', + //手机号码 + 'mobile' => 'string', + //发送内容 + 'content' => 'string', + //发送关键字(注册、找回密码) + 'code' => 'string', + //是否已验证;0-否;1-是 + 'is_verify' => 'int', + //验证次数 + 'check_num' => 'int', + //发送状态:0-发送中;1-发送成功;2-发送失败 + 'send_status' => 'int', + //发送时间 + 'send_time' => 'int', + //短信结果 + 'results' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/pay/PayConfig.php b/server/app/common/model/pay/PayConfig.php index 30f3d617ef17e16f311c2c692278eb1ace007edf..4988048e0b22aa983a20e59da51e5218fd7780b3 100644 --- a/server/app/common/model/pay/PayConfig.php +++ b/server/app/common/model/pay/PayConfig.php @@ -18,10 +18,40 @@ use app\common\enum\PayEnum; use app\common\model\BaseModel; use app\common\service\FileService; +/** + * DevPayConfig模型 + * Class DevPayConfig + * @package app\common\model\pay + * @property int $id 主键 + * @property string $name 模版名称 + * @property int $pay_way 支付方式:1-余额支付;2-微信支付;3-支付宝支付; + * @property string $config 对应支付配置(json字符串) + * @property string $icon 图标 + * @property int $sort 排序 + * @property string $remark 备注 + */ class PayConfig extends BaseModel { protected $name = 'dev_pay_config'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //模版名称 + 'name' => 'string', + //支付方式:1-余额支付;2-微信支付;3-支付宝支付; + 'pay_way' => 'int', + //对应支付配置(json字符串) + 'config' => 'string', + //图标 + 'icon' => 'string', + //排序 + 'sort' => 'int', + //备注 + 'remark' => 'string', + ]; + // 设置json类型字段 protected $json = ['config']; diff --git a/server/app/common/model/pay/PayWay.php b/server/app/common/model/pay/PayWay.php index 011fb9b9849e46bd2edde61a3b02adb7955427f0..ba3e079d5c39a4defcc0a2c4edcc253083743f30 100644 --- a/server/app/common/model/pay/PayWay.php +++ b/server/app/common/model/pay/PayWay.php @@ -17,11 +17,34 @@ namespace app\common\model\pay; use app\common\model\BaseModel; use app\common\service\FileService; +use think\model\relation\HasOne; +/** + * DevPayWay模型 + * Class DevPayWay + * @package app\common\model\pay + * @property int $id 主键 + * @property int $pay_config_id 支付配置ID + * @property int $scene 场景:1-微信小程序;2-微信公众号;3-H5;4-PC;5-APP; + * @property int $is_default 是否默认支付:0-否;1-是; + * @property int $status 状态:0-关闭;1-开启; - + */ class PayWay extends BaseModel { protected $name = 'dev_pay_way'; + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //支付配置ID + 'pay_config_id' => 'int', + //场景:1-微信小程序;2-微信公众号;3-H5;4-PC;5-APP; + 'scene' => 'int', + //是否默认支付:0-否;1-是; + 'is_default' => 'int', + //状态:0-关闭;1-开启; + 'status' => 'int', + ]; public function getIconAttr($value,$data) { @@ -43,7 +66,7 @@ class PayWay extends BaseModel /** * @notes 关联支配配置模型 - * @return \think\model\relation\HasOne + * @return HasOne * @author ljj * @date 2021/10/11 3:04 下午 */ diff --git a/server/app/common/model/recharge/RechargeOrder.php b/server/app/common/model/recharge/RechargeOrder.php index 2465dea2304757c4755373703e49997c38dae371..34db50b6b441be09d80e5780b4d304a924893734 100644 --- a/server/app/common/model/recharge/RechargeOrder.php +++ b/server/app/common/model/recharge/RechargeOrder.php @@ -21,14 +21,61 @@ use think\model\concern\SoftDelete; /** * 充值订单模型 * Class RechargeOrder - * @package app\common\model + * @package app\common\model\recharge + * @property int $id 主键 id + * @property string $sn 订单编号 + * @property int $user_id 用户id + * @property string $pay_sn 支付编号-冗余字段,针对微信同一主体不同客户端支付需用不同订单号预留。 + * @property int $pay_way 支付方式 2-微信支付 3-支付宝支付 + * @property int $pay_status 支付状态:0-待支付;1-已支付 + * @property int $pay_time 支付时间 + * @property float $order_amount 充值金额 + * @property int $order_terminal 终端 + * @property string $transaction_id 第三方平台交易流水号 + * @property int $refund_status 退款状态 0-未退款 1-已退款 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class RechargeOrder extends BaseModel { use SoftDelete; + protected $name = 'recharge_order'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //订单编号 + 'sn' => 'string', + //用户id + 'user_id' => 'int', + //支付编号-冗余字段,针对微信同一主体不同客户端支付需用不同订单号预留。 + 'pay_sn' => 'string', + //支付方式 2-微信支付 3-支付宝支付 + 'pay_way' => 'int', + //支付状态:0-待支付;1-已支付 + 'pay_status' => 'int', + //支付时间 + 'pay_time' => 'int', + //充值金额 + 'order_amount' => 'float', + //终端 + 'order_terminal' => 'int', + //第三方平台交易流水号 + 'transaction_id' => 'string', + //退款状态 0-未退款 1-已退款 + 'refund_status' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; + /** * @notes 支付方式 diff --git a/server/app/common/model/refund/RefundLog.php b/server/app/common/model/refund/RefundLog.php index 8429a4d8420fd0b092907ce6a9bb2ac24f867321..845794573d96ad1533823efc7276c2cc461cf2d0 100644 --- a/server/app/common/model/refund/RefundLog.php +++ b/server/app/common/model/refund/RefundLog.php @@ -24,9 +24,48 @@ use app\common\model\BaseModel; * 退款日志模型 * Class RefundLog * @package app\common\model\refund + * @property int $id 主键 id + * @property string $sn 编号 + * @property int $record_id 退款记录id + * @property int $user_id 关联用户 + * @property int $handle_id 处理人id(管理员id) + * @property float $order_amount 订单总的应付款金额,冗余字段 + * @property float $refund_amount 本次退款金额 + * @property int $refund_status 退款状态,0退款中,1退款成功,2退款失败 + * @property string $refund_msg 退款信息 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class RefundLog extends BaseModel { + protected $name = 'refund_log'; + + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //编号 + 'sn' => 'string', + //退款记录id + 'record_id' => 'int', + //关联用户 + 'user_id' => 'int', + //处理人id(管理员id) + 'handle_id' => 'int', + //订单总的应付款金额,冗余字段 + 'order_amount' => 'float', + //本次退款金额 + 'refund_amount' => 'float', + //退款状态,0退款中,1退款成功,2退款失败 + 'refund_status' => 'int', + //退款信息 + 'refund_msg' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; + /** * @notes 操作人描述 diff --git a/server/app/common/model/refund/RefundRecord.php b/server/app/common/model/refund/RefundRecord.php index 7b6f3c6b39b6071fbe4370038d46bf2a3b23bc7d..96e9cea4a2b32bd1ba497de62121ccc9aa45b8df 100644 --- a/server/app/common/model/refund/RefundRecord.php +++ b/server/app/common/model/refund/RefundRecord.php @@ -23,9 +23,56 @@ use app\common\model\BaseModel; * 退款记录模型 * Class RefundRecord * @package app\common\model\refund + * @property int $id 主键 id + * @property string $sn 退款编号 + * @property int $user_id 关联用户 + * @property int $order_id 来源订单id + * @property string $order_sn 来源单号 + * @property string $order_type 订单来源 order-商品订单 recharge-充值订单 + * @property float $order_amount 订单总的应付款金额,冗余字段 + * @property float $refund_amount 本次退款金额 + * @property string $transaction_id 第三方平台交易流水号 + * @property int $refund_way 退款方式 1-线上退款 2-线下退款 + * @property int $refund_type 退款类型 1-后台退款 + * @property int $refund_status 退款状态,0退款中,1退款成功,2退款失败 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class RefundRecord extends BaseModel { + protected $name = 'refund_record'; + + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //退款编号 + 'sn' => 'string', + //关联用户 + 'user_id' => 'int', + //来源订单id + 'order_id' => 'int', + //来源单号 + 'order_sn' => 'string', + //订单来源 order-商品订单 recharge-充值订单 + 'order_type' => 'string', + //订单总的应付款金额,冗余字段 + 'order_amount' => 'float', + //本次退款金额 + 'refund_amount' => 'float', + //第三方平台交易流水号 + 'transaction_id' => 'string', + //退款方式 1-线上退款 2-线下退款 + 'refund_way' => 'int', + //退款类型 1-后台退款 + 'refund_type' => 'int', + //退款状态,0退款中,1退款成功,2退款失败 + 'refund_status' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; /** * @notes 退款类型描述 diff --git a/server/app/common/model/tools/GenerateColumn.php b/server/app/common/model/tools/GenerateColumn.php index 98e8dd8949b179c1586db1f53ddd3fdb9221f1e3..4b764f69123e19ba20378d89cbfeca9490ce3898 100644 --- a/server/app/common/model/tools/GenerateColumn.php +++ b/server/app/common/model/tools/GenerateColumn.php @@ -5,19 +5,73 @@ namespace app\common\model\tools; use app\common\model\BaseModel; +use think\model\relation\BelongsTo; /** * 代码生成器-数据表字段信息模型 * Class GenerateColumn * @package app\common\model\tools + * @property int $id 主键 id + * @property int $table_id 表id + * @property string $column_name 字段名称 + * @property string $column_comment 字段描述 + * @property string $column_type 字段类型 + * @property int $is_required 是否必填 0-非必填 1-必填 + * @property int $is_pk 是否为主键 0-不是 1-是 + * @property int $is_insert 是否为插入字段 0-不是 1-是 + * @property int $is_update 是否为更新字段 0-不是 1-是 + * @property int $is_lists 是否为列表字段 0-不是 1-是 + * @property int $is_query 是否为查询字段 0-不是 1-是 + * @property string $query_type 查询类型 + * @property string $view_type 显示类型 + * @property string $dict_type 字典类型 + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 */ class GenerateColumn extends BaseModel { + protected $name = 'generate_column'; + + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //表id + 'table_id' => 'int', + //字段名称 + 'column_name' => 'string', + //字段描述 + 'column_comment' => 'string', + //字段类型 + 'column_type' => 'string', + //是否必填 0-非必填 1-必填 + 'is_required' => 'int', + //是否为主键 0-不是 1-是 + 'is_pk' => 'int', + //是否为插入字段 0-不是 1-是 + 'is_insert' => 'int', + //是否为更新字段 0-不是 1-是 + 'is_update' => 'int', + //是否为列表字段 0-不是 1-是 + 'is_lists' => 'int', + //是否为查询字段 0-不是 1-是 + 'is_query' => 'int', + //查询类型 + 'query_type' => 'string', + //显示类型 + 'view_type' => 'string', + //字典类型 + 'dict_type' => 'string', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + ]; /** * @notes 关联table表 - * @return \think\model\relation\BelongsTo + * @return BelongsTo * @author bingo * @date 2022/6/15 18:59 */ diff --git a/server/app/common/model/tools/GenerateTable.php b/server/app/common/model/tools/GenerateTable.php index 715a0a6a501363012ed92bd5ea8433a363b38c97..94caf94e7248348d0c03358ac95de44f4359c458 100644 --- a/server/app/common/model/tools/GenerateTable.php +++ b/server/app/common/model/tools/GenerateTable.php @@ -5,23 +5,80 @@ namespace app\common\model\tools; use app\common\enum\GeneratorEnum; use app\common\model\BaseModel; +use think\model\relation\HasMany; /** * 代码生成器-数据表信息模型 * Class GenerateTable * @package app\common\model\tools + * @property int $id 主键 id + * @property string $table_name 表名称 + * @property string $table_comment 表描述 + * @property int $template_type 模板类型 0-单表(curd) 1-树表(curd) + * @property string $author 作者 + * @property string $remark 备注 + * @property int $generate_type 生成方式 0-压缩包下载 1-生成到模块 + * @property string $module_name 模块名 + * @property string $class_dir 类目录名 + * @property string $class_comment 类描述 + * @property int $admin_id 管理员id + * @property string $menu 菜单配置 + * @property string $delete 删除配置 + * @property string $tree 树表配置 + * @property string $relations 关联配置 + * @property int $create_time 创建时间 + * @property int $update_time 修改时间 */ class GenerateTable extends BaseModel { + protected $name = 'generate_table'; + + //设置字段信息 + protected $schema = [ + //主键 id + 'id' => 'int', + //表名称 + 'table_name' => 'string', + //表描述 + 'table_comment' => 'string', + //模板类型 0-单表(curd) 1-树表(curd) + 'template_type' => 'int', + //作者 + 'author' => 'string', + //备注 + 'remark' => 'string', + //生成方式 0-压缩包下载 1-生成到模块 + 'generate_type' => 'int', + //模块名 + 'module_name' => 'string', + //类目录名 + 'class_dir' => 'string', + //类描述 + 'class_comment' => 'string', + //管理员id + 'admin_id' => 'int', + //菜单配置 + 'menu' => 'string', + //删除配置 + 'delete' => 'string', + //树表配置 + 'tree' => 'string', + //关联配置 + 'relations' => 'string', + //创建时间 + 'create_time' => 'int', + //修改时间 + 'update_time' => 'int', + ]; protected $json = ['menu', 'tree', 'relations', 'delete']; protected $jsonAssoc = true; /** * @notes 关联数据表字段 - * @return \think\model\relation\HasMany + * @return HasMany * @author bingo * @date 2022/6/15 10:46 */ diff --git a/server/app/common/model/user/User.php b/server/app/common/model/user/User.php index ebd6cf2347e9c07409ac55f61b76917aa230b58d..9f91b32181331a74b792fa1df59c190f4884291d 100644 --- a/server/app/common/model/user/User.php +++ b/server/app/common/model/user/User.php @@ -7,23 +7,87 @@ namespace app\common\model\user; use app\common\enum\user\UserEnum; use app\common\model\BaseModel; use app\common\service\FileService; +use think\db\exception\DataNotFoundException; +use think\db\exception\DbException; +use think\db\exception\ModelNotFoundException; use think\model\concern\SoftDelete; +use think\model\relation\HasOne; /** * 用户模型 * Class User * @package app\common\model\user + * @property int $id 主键 主键 + * @property int $sn 编号 + * @property string $avatar 头像 + * @property string $real_name 真实姓名 + * @property string $nickname 用户昵称 + * @property string $account 用户账号 + * @property string $password 用户密码 + * @property string $mobile 用户电话 + * @property int $sex 用户性别: [1=男, 2=女] + * @property int $channel 注册渠道: [1-微信小程序 2-微信公众号 3-手机H5 4-电脑PC 5-苹果APP 6-安卓APP] + * @property int $is_disable 是否禁用: [0=否, 1=是] + * @property string $login_ip 最后登录IP + * @property int $login_time 最后登录时间 + * @property int $is_new_user 是否是新注册用户: [1-是, 0-否] + * @property float $user_money 用户余额 + * @property float $total_recharge_amount 累计充值 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class User extends BaseModel { use SoftDelete; - + protected $name = 'user'; protected $deleteTime = 'delete_time'; + //设置字段信息 + protected $schema = [ + //主键 主键 + 'id' => 'int', + //编号 + 'sn' => 'int', + //头像 + 'avatar' => 'string', + //真实姓名 + 'real_name' => 'string', + //用户昵称 + 'nickname' => 'string', + //用户账号 + 'account' => 'string', + //用户密码 + 'password' => 'string', + //用户电话 + 'mobile' => 'string', + //用户性别: [1=男, 2=女] + 'sex' => 'int', + //注册渠道: [1-微信小程序 2-微信公众号 3-手机H5 4-电脑PC 5-苹果APP 6-安卓APP] + 'channel' => 'int', + //是否禁用: [0=否, 1=是] + 'is_disable' => 'int', + //最后登录IP + 'login_ip' => 'string', + //最后登录时间 + 'login_time' => 'int', + //是否是新注册用户: [1-是, 0-否] + 'is_new_user' => 'int', + //用户余额 + 'user_money' => 'float', + //累计充值 + 'total_recharge_amount' => 'float', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; /** * @notes 关联用户授权模型 - * @return \think\model\relation\HasOne + * @return HasOne * @author 乔峰 * @date 2022/9/22 16:03 */ @@ -141,9 +205,9 @@ class User extends BaseModel * @param string $prefix * @param int $length * @return string - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws DataNotFoundException + * @throws DbException + * @throws ModelNotFoundException * @author 乔峰 * @date 2022/9/16 10:33 */ diff --git a/server/app/common/model/user/UserAccountLog.php b/server/app/common/model/user/UserAccountLog.php index 9c4e688b454fdb451914430ee80b45309a29c46c..e5f88a0e1c13f78ba3880e6e2259a8da0442dcf1 100644 --- a/server/app/common/model/user/UserAccountLog.php +++ b/server/app/common/model/user/UserAccountLog.php @@ -21,10 +21,57 @@ use think\model\concern\SoftDelete; * 账户流水记录模型 * Class AccountLog * @package app\common\model\user + * @property int $id 主键 + * @property string $sn 流水号 + * @property int $user_id 用户id + * @property int $change_object 变动对象 + * @property int $change_type 变动类型 + * @property int $action 动作 1-增加 2-减少 + * @property float $change_amount 变动数量 + * @property float $left_amount 变动后数量 + * @property string $source_sn 关联单号 + * @property string $remark 备注 + * @property string $extra 预留扩展字段 + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 + * @property int $delete_time 删除时间 */ class UserAccountLog extends BaseModel { use SoftDelete; protected $deleteTime = 'delete_time'; + protected $name = 'user_account_log'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //流水号 + 'sn' => 'string', + //用户id + 'user_id' => 'int', + //变动对象 + 'change_object' => 'int', + //变动类型 + 'change_type' => 'int', + //动作 1-增加 2-减少 + 'action' => 'int', + //变动数量 + 'change_amount' => 'float', + //变动后数量 + 'left_amount' => 'float', + //关联单号 + 'source_sn' => 'string', + //备注 + 'remark' => 'string', + //预留扩展字段 + 'extra' => 'string', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + //删除时间 + 'delete_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/model/user/UserAuth.php b/server/app/common/model/user/UserAuth.php index 18f190a93331a7657be4fd5d6e37b000e191edd0..62ac4c0ab5691edecce7cd13db5af144a581bab5 100644 --- a/server/app/common/model/user/UserAuth.php +++ b/server/app/common/model/user/UserAuth.php @@ -9,9 +9,36 @@ use app\common\model\BaseModel; /** * 用户授权表 * Class UserAuth - * @package app\common\model + * @package app\common\model\user + * @property int $id 主键 + * @property int $user_id 用户id + * @property string $openid 微信openid + * @property string $unionid 微信unionid + * @property int $terminal 客户端类型:1-微信小程序;2-微信公众号;3-手机H5;4-电脑PC;5-苹果APP;6-安卓APP + * @property int $create_time 创建时间 + * @property int $update_time 更新时间 */ class UserAuth extends BaseModel { + protected $name = 'user_auth'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //用户id + 'user_id' => 'int', + //微信openid + 'openid' => 'string', + //微信unionid + 'unionid' => 'string', + //客户端类型:1-微信小程序;2-微信公众号;3-手机H5;4-电脑PC;5-苹果APP;6-安卓APP + 'terminal' => 'int', + //创建时间 + 'create_time' => 'int', + //更新时间 + 'update_time' => 'int', + ]; + } \ No newline at end of file diff --git a/server/app/common/model/user/UserSession.php b/server/app/common/model/user/UserSession.php index e348e62136518353520da5392f16101a41cc3ea2..29a9aeb0c832f541cba2f162d3192457afdfd2cc 100644 --- a/server/app/common/model/user/UserSession.php +++ b/server/app/common/model/user/UserSession.php @@ -21,8 +21,31 @@ use app\common\model\BaseModel; * 用户登录token信息 * Class UserSession * @package app\common\model\user + * @property int $id 主键 + * @property int $user_id 用户id + * @property int $terminal 客户端类型:1-微信小程序;2-微信公众号;3-手机H5;4-电脑PC;5-苹果APP;6-安卓APP + * @property string $token 令牌 + * @property int $update_time 更新时间 + * @property int $expire_time 到期时间 */ class UserSession extends BaseModel { + protected $name = 'user_session'; + + //设置字段信息 + protected $schema = [ + //主键 + 'id' => 'int', + //用户id + 'user_id' => 'int', + //客户端类型:1-微信小程序;2-微信公众号;3-手机H5;4-电脑PC;5-苹果APP;6-安卓APP + 'terminal' => 'int', + //令牌 + 'token' => 'string', + //更新时间 + 'update_time' => 'int', + //到期时间 + 'expire_time' => 'int', + ]; } \ No newline at end of file diff --git a/server/app/common/service/ConfigService.php b/server/app/common/service/ConfigService.php index 47002491cd2799244eda43b9cd726e9eb8f00746..4485263c669115fe9c5c55e6af95e000fc86fa8a 100644 --- a/server/app/common/service/ConfigService.php +++ b/server/app/common/service/ConfigService.php @@ -17,7 +17,7 @@ class ConfigService * @author 乔峰 * @date 2021/12/27 15:00 */ - public static function set(string $type, string $name, $value) + public static function set(string $type, string $name, $value): mixed { $original = $value; if (is_array($value)) { @@ -50,7 +50,7 @@ class ConfigService * @author Tab * @date 2021/7/15 15:16 */ - public static function get(string $type, string $name = '', $default_value = null) + public static function get(string $type, string $name = '', $default_value = null): mixed { if (!empty($name)) { $value = Config::where(['type' => $type, 'name' => $name])->value('value'); @@ -84,5 +84,6 @@ class ConfigService if ($data) { return $data; } + return false; } } \ No newline at end of file diff --git a/server/app/common/service/FileService.php b/server/app/common/service/FileService.php index 17e7778975573cdb3fe1392248f4721bfd3e1a32..cc79d0b513798c194ba51af7c4e5457d653e4517 100644 --- a/server/app/common/service/FileService.php +++ b/server/app/common/service/FileService.php @@ -58,12 +58,12 @@ class FileService /** * @notes 转相对路径 - * @param $uri + * @param string|null $uri * @return mixed * @author 乔峰 * @date 2021/7/28 15:09 */ - public static function setFileUrl($uri) + public static function setFileUrl(string|null $uri): mixed { $default = ConfigService::get('storage', 'default', 'local'); if ($default === 'local') { diff --git a/server/app/common/service/LockService.php b/server/app/common/service/LockService.php index bbf2d018a249015227b004d87e84c9108de9c35f..9fc0f7e10c1bee91320d6b39f83a0dafed978e0a 100644 --- a/server/app/common/service/LockService.php +++ b/server/app/common/service/LockService.php @@ -109,7 +109,7 @@ class LockService extends BaseService */ protected function set(string $name, mixed $value, array $expire = ['nx']): bool { - $key = "lock_".getenv('CACHE_PREFIX','') . $name;; + $key = "lock_".getenv('CACHE_PREFIX','') . $name; $value = is_scalar($value) ? $value : 'think_serialize:' . serialize($value); return Cache::set($key, $value, $expire); } diff --git a/server/app/common/service/NoticeService.php b/server/app/common/service/NoticeService.php index 67ed24cf13294479fa9e586c2af2bfd86e3b703a..fa0291147addac5e2d7c9b1b9e0d6dc5ee7490f7 100644 --- a/server/app/common/service/NoticeService.php +++ b/server/app/common/service/NoticeService.php @@ -2,6 +2,7 @@ namespace app\common\service; use app\common\logic\NoticeLogic; +use Exception; use support\Log; /** @@ -11,19 +12,19 @@ use support\Log; */ class NoticeService { - public function handle($params) + public function handle($params): true|string { try { if (empty($params['scene_id'])) { - throw new \Exception('场景ID不能为空'); + throw new Exception('场景ID不能为空'); } // 根据不同的场景发送通知 $result = NoticeLogic::noticeByScene($params); if (false === $result) { - throw new \Exception(NoticeLogic::getError()); + throw new Exception(NoticeLogic::getError()); } return true; - } catch (\Exception $e) { + } catch (Exception $e) { Log::info('通知发送失败:'.$e->getMessage()); return $e->getMessage(); } diff --git a/server/app/common/service/generator/GenerateService.php b/server/app/common/service/generator/GenerateService.php index b5c6ef708ccec621b9b768752fa3622c21e93bd1..335a7cfc38adb902311a985755238fc0adbb8863 100644 --- a/server/app/common/service/generator/GenerateService.php +++ b/server/app/common/service/generator/GenerateService.php @@ -15,6 +15,7 @@ use app\common\service\generator\core\VueEditGenerator; use app\common\service\generator\core\VueIndexGenerator; use support\Request; use Webman\App; +use ZipArchive; /** @@ -26,19 +27,19 @@ class GenerateService { // 标记 - protected $flag; + protected string|null $flag; // 生成文件路径 - protected $generatePath; + protected string $generatePath; // runtime目录 - protected $runtimePath; + protected string $runtimePath; // 压缩包名称 - protected $zipTempName; + protected string $zipTempName; // 压缩包临时路径 - protected $zipTempPath; + protected string $zipTempPath; public function __construct() { @@ -171,8 +172,8 @@ class GenerateService $fileName = 'curd-' . date('YmdHis') . '.zip'; $this->zipTempName = $fileName; $this->zipTempPath = $this->generatePath . $fileName; - $zip = new \ZipArchive(); - $zip->open($this->zipTempPath, \ZipArchive::CREATE); + $zip = new ZipArchive(); + $zip->open($this->zipTempPath, ZipArchive::CREATE); $this->addFileZip($this->runtimePath, 'generate', $zip); $zip->close(); } diff --git a/server/app/common/service/generator/core/ModelGenerator.php b/server/app/common/service/generator/core/ModelGenerator.php index 8187e6f82b5a26d8ef4a0b2f34f8ae7c5fe29156..1b48bd9cc969ada86c27f0e358d7fe6a09b3ec4b 100644 --- a/server/app/common/service/generator/core/ModelGenerator.php +++ b/server/app/common/service/generator/core/ModelGenerator.php @@ -32,8 +32,9 @@ class ModelGenerator extends BaseGenerator implements GenerateInterface '{DELETE_USE}', '{DELETE_TIME}', '{RELATION_MODEL}', + '{TABLE_COLUMNS}', + '{TABLE_COLUMNS_PROPERTY}', ]; - // 等待替换的内容 $waitReplace = [ $this->getNameSpaceContent(), @@ -45,6 +46,8 @@ class ModelGenerator extends BaseGenerator implements GenerateInterface $this->getDeleteUseContent(), $this->getDeleteTimeContent(), $this->getRelationModel(), + $this->getTableColumns(), + $this->getTableColumnsProperty(), ]; $templatePath = $this->getTemplatePath('php/model'); @@ -55,6 +58,44 @@ class ModelGenerator extends BaseGenerator implements GenerateInterface $this->setContent($content); } + /** + * 获取表字段 + * @return string + */ + public function getTableColumns(){ + $columnValue = ' //设置字段信息'. PHP_EOL; + $columnValue .= ' protected $schema = ['. PHP_EOL; + $pk = $this->getPkContent(); + foreach ($this->tableColumn as $column) { + $column_comment = $column['column_comment']; + if ($pk==$column['column_name']){ + $column_comment = "主键 " . $column_comment; + } + $columnValue.= ' //'.$column_comment. PHP_EOL; + $columnValue.= " '".$column['column_name']."' => '".$column['column_type']. "',". PHP_EOL; + } + $columnValue .= ' ];'. PHP_EOL; + return $columnValue; + } + + + /** + * 获取表字段 + * @return string + */ + public function getTableColumnsProperty(){ + $columnValue = ''; + $pk = $this->getPkContent(); + foreach ($this->tableColumn as $column) { + $column_comment = $column['column_comment']; + if ($pk==$column['column_name']){ + $column_comment = "主键 " . $column_comment; + } + //@property int $id 主键 + $columnValue.= " * @property ".$column['column_type']." $".$column['column_name']. " ".$column_comment. PHP_EOL; + } + return $columnValue; + } /** * @notes 获取命名空间模板内容 @@ -79,8 +120,8 @@ class ModelGenerator extends BaseGenerator implements GenerateInterface */ public function getClassCommentContent() { - if (!empty($this->tableData['class_comment'])) { - $tpl = $this->tableData['class_comment'] . '模型'; + if (!empty($this->tableData['table_comment'])) { + $tpl = $this->tableData['table_comment'] . '模型'; } else { $tpl = $this->getUpperCamelName() . '模型'; } diff --git a/server/app/common/service/generator/stub/php/controller.stub b/server/app/common/service/generator/stub/php/controller.stub index ad91a00804ba91e7076b480dd4cabd278bb90517..84ba4675bd33d9497728f8b5976810dba2045ee6 100644 --- a/server/app/common/service/generator/stub/php/controller.stub +++ b/server/app/common/service/generator/stub/php/controller.stub @@ -5,7 +5,7 @@ {USE} - +use support\Response; /** * {CLASS_COMMENT} @@ -22,11 +22,11 @@ class {UPPER_CAMEL_NAME}Controller extends {EXTENDS_CONTROLLER} } /** * @notes 获取{NOTES}列表 - * @return \support\Response + * @return Response * @author bingo * @date {DATE} */ - public function lists() + public function lists(): Response { return $this->dataLists(new {UPPER_CAMEL_NAME}Lists()); } @@ -34,11 +34,11 @@ class {UPPER_CAMEL_NAME}Controller extends {EXTENDS_CONTROLLER} /** * @notes 添加{NOTES} - * @return \support\Response + * @return Response * @author bingo * @date {DATE} */ - public function add() + public function add(): Response { $params = $this->validateObj->post()->goCheck('add'); $result = {UPPER_CAMEL_NAME}Logic::add($params); @@ -51,11 +51,11 @@ class {UPPER_CAMEL_NAME}Controller extends {EXTENDS_CONTROLLER} /** * @notes 编辑{NOTES} - * @return \support\Response + * @return Response * @author bingo * @date {DATE} */ - public function edit() + public function edit(): Response { $params = $this->validateObj->post()->goCheck('edit'); $result = {UPPER_CAMEL_NAME}Logic::edit($params); @@ -68,11 +68,11 @@ class {UPPER_CAMEL_NAME}Controller extends {EXTENDS_CONTROLLER} /** * @notes 删除{NOTES} - * @return \support\Response + * @return Response * @author bingo * @date {DATE} */ - public function delete() + public function delete(): Response { $params = $this->validateObj->post()->goCheck('delete'); {UPPER_CAMEL_NAME}Logic::delete($params); @@ -82,11 +82,11 @@ class {UPPER_CAMEL_NAME}Controller extends {EXTENDS_CONTROLLER} /** * @notes 获取{NOTES}详情 - * @return \support\Response + * @return Response * @author bingo * @date {DATE} */ - public function detail() + public function detail(): Response { $params = $this->validateObj->goCheck('detail'); $result = {UPPER_CAMEL_NAME}Logic::detail($params); diff --git a/server/app/common/service/generator/stub/php/lists.stub b/server/app/common/service/generator/stub/php/lists.stub index ba05bbab2fb20b51477cb342dab56611513ffd1b..be061c4153128210319843998dc8a76a045abd03 100644 --- a/server/app/common/service/generator/stub/php/lists.stub +++ b/server/app/common/service/generator/stub/php/lists.stub @@ -6,7 +6,7 @@ {USE} use app\common\lists\ListsSearchInterface; use app\common\lists\ListsExcelInterface; - +use think\db\Query; /** * {CLASS_COMMENT} @@ -30,18 +30,18 @@ class {UPPER_CAMEL_NAME}Lists extends {EXTENDS_LISTS} implements ListsSearchInte /** * 设置别名 - * @return {UPPER_CAMEL_NAME} + * @return {UPPER_CAMEL_NAME}|Query */ - public function getModel(){ + public function getModel(): {UPPER_CAMEL_NAME}|Query{ return {UPPER_CAMEL_NAME}::whereRaw('1=1'); } /** * @notes 获取{NOTES}列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws think\db\exception\DataNotFoundException + * @throws think\db\exception\DbException + * @throws think\db\exception\ModelNotFoundException * @author bingo * @date {DATE} */ diff --git a/server/app/common/service/generator/stub/php/model.stub b/server/app/common/service/generator/stub/php/model.stub index 32e8eeb434b483d0794547583f9aa531ccfc9e8c..f8cb435cc9e468d057e6643702370877828b85c6 100644 --- a/server/app/common/service/generator/stub/php/model.stub +++ b/server/app/common/service/generator/stub/php/model.stub @@ -4,6 +4,8 @@ use app\common\model\BaseModel; +use think\model\relation\HasMany; +use think\model\relation\HasOne; {USE} @@ -11,12 +13,13 @@ use app\common\model\BaseModel; * {CLASS_COMMENT} * Class {UPPER_CAMEL_NAME} * @package app\common\model{PACKAGE_NAME} +{TABLE_COLUMNS_PROPERTY} */ class {UPPER_CAMEL_NAME} extends BaseModel { {DELETE_USE} protected $name = '{TABLE_NAME}'; {DELETE_TIME} - +{TABLE_COLUMNS} {RELATION_MODEL} } \ No newline at end of file diff --git a/server/app/common/service/generator/stub/php/model/has_many.stub b/server/app/common/service/generator/stub/php/model/has_many.stub index 3155e75fc39af8e8a736241e2b690129a9fe3239..f15fe50a002c68322964397a9afd8e4a0f09b448 100644 --- a/server/app/common/service/generator/stub/php/model/has_many.stub +++ b/server/app/common/service/generator/stub/php/model/has_many.stub @@ -1,11 +1,11 @@ /** * @notes 关联{RELATION_NAME} - * @return \think\model\relation\HasMany + * @return HasMany * @author bingo * @date {DATE} */ - public function {RELATION_NAME}() + public function {RELATION_NAME}(): HasMany { return $this->hasMany({RELATION_MODEL}::class, '{FOREIGN_KEY}', '{LOCAL_KEY}'); } \ No newline at end of file diff --git a/server/app/common/service/generator/stub/php/model/has_one.stub b/server/app/common/service/generator/stub/php/model/has_one.stub index db2396a82db1bd9a646ded170b24fafa3e6d5350..8461791f88bc1eedd8b80a343caa0f8a460e61cd 100644 --- a/server/app/common/service/generator/stub/php/model/has_one.stub +++ b/server/app/common/service/generator/stub/php/model/has_one.stub @@ -1,11 +1,11 @@ /** * @notes 关联{RELATION_NAME} - * @return \think\model\relation\HasOne + * @return HasOne * @author bingo * @date {DATE} */ - public function {RELATION_NAME}() + public function {RELATION_NAME}(): HasOne { return $this->hasOne({RELATION_MODEL}::class, '{FOREIGN_KEY}', '{LOCAL_KEY}'); } \ No newline at end of file diff --git a/server/app/common/service/generator/stub/php/tree_lists.stub b/server/app/common/service/generator/stub/php/tree_lists.stub index dc7ea5ab204a0c722be90f5afeda9d95fa4c6d4b..637fffac6183862488f25d5725fd69d175e440fb 100644 --- a/server/app/common/service/generator/stub/php/tree_lists.stub +++ b/server/app/common/service/generator/stub/php/tree_lists.stub @@ -36,9 +36,9 @@ class {UPPER_CAMEL_NAME}Lists extends {EXTENDS_LISTS} implements ListsSearchInte /** * @notes 获取{NOTES}列表 * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException + * @throws think\db\exception\DataNotFoundException + * @throws think\db\exception\DbException + * @throws think\db\exception\ModelNotFoundException * @author bingo * @date {DATE} */ diff --git a/server/app/common/service/generator/stub/php/validate.stub b/server/app/common/service/generator/stub/php/validate.stub index 7d9aa712a77110ca7847cbdfe02ba8fa8d648621..2ccf75e9dcba5868b859da36b5301218920083e1 100644 --- a/server/app/common/service/generator/stub/php/validate.stub +++ b/server/app/common/service/generator/stub/php/validate.stub @@ -38,7 +38,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * @author bingo * @date {DATE} */ - public function sceneAdd() + public function sceneAdd():{UPPER_CAMEL_NAME}Validate { {ADD_PARAMS} } @@ -50,7 +50,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * @author bingo * @date {DATE} */ - public function sceneEdit() + public function sceneEdit():{UPPER_CAMEL_NAME}Validate { {EDIT_PARAMS} } @@ -62,7 +62,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * @author bingo * @date {DATE} */ - public function sceneDelete() + public function sceneDelete():{UPPER_CAMEL_NAME}Validate { return $this->only(['{PK}']); } @@ -74,7 +74,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * @author bingo * @date {DATE} */ - public function sceneDetail() + public function sceneDetail():{UPPER_CAMEL_NAME}Validate { return $this->only(['{PK}']); } diff --git a/server/app/common/service/pay/BasePayService.php b/server/app/common/service/pay/BasePayService.php index 187038f51b666eac189d7bb04364c72a3138d9f4..34e8066427f78af5014a85527634afffc6692fa8 100644 --- a/server/app/common/service/pay/BasePayService.php +++ b/server/app/common/service/pay/BasePayService.php @@ -24,13 +24,13 @@ class BasePayService * 错误信息 * @var string */ - protected $error; + protected string $error; /** * 返回状态码 * @var int */ - protected $returnCode = 0; + protected int $returnCode = 0; /** @@ -39,7 +39,7 @@ class BasePayService * @author 段誉 * @date 2021/7/21 18:23 */ - public function getError() + public function getError(): string { if (false === self::hasError()) { return '系统错误'; @@ -54,7 +54,7 @@ class BasePayService * @author 段誉 * @date 2021/7/21 18:20 */ - public function setError($error) + public function setError($error): void { $this->error = $error; } @@ -66,7 +66,7 @@ class BasePayService * @author 段誉 * @date 2021/7/21 18:32 */ - public function hasError() + public function hasError(): bool { return !empty($this->error); } @@ -78,7 +78,7 @@ class BasePayService * @author 段誉 * @date 2021/7/28 17:05 */ - public function setReturnCode($code) + public function setReturnCode($code): void { $this->returnCode = $code; } @@ -90,7 +90,7 @@ class BasePayService * @author 段誉 * @date 2021/7/28 15:14 */ - public function getReturnCode() + public function getReturnCode(): int { return $this->returnCode; } diff --git a/server/app/common/service/pay/WeChatPayService.php b/server/app/common/service/pay/WeChatPayService.php index d0bc14a7d4f3bb95c46fd5389dc040daa2ad8a8e..5c6825e16f08dad4df77ce8df24ca57092d9bc3c 100644 --- a/server/app/common/service/pay/WeChatPayService.php +++ b/server/app/common/service/pay/WeChatPayService.php @@ -22,8 +22,16 @@ use app\common\logic\PayNotifyLogic; use app\common\model\recharge\RechargeOrder; use app\common\model\user\UserAuth; use app\common\service\wechat\WeChatConfigService; +use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; +use EasyWeChat\Kernel\Exceptions\InvalidConfigException; +use EasyWeChat\Kernel\Exceptions\RuntimeException; use EasyWeChat\Pay\Application; use EasyWeChat\Pay\Message; +use Exception; +use Psr\Http\Message\ResponseInterface; +use ReflectionException; +use think\Model; +use Throwable; /** @@ -35,30 +43,30 @@ class WeChatPayService extends BasePayService { /** * 授权信息 - * @var UserAuth|array|\think\Model + * @var UserAuth|array|Model */ - protected $auth; + protected mixed $auth; /** * 微信配置 * @var */ - protected $config; + protected array $config; /** * easyWeChat实例 * @var */ - protected $app; + protected Application $app; /** * 当前使用客户端 * @var */ - protected $terminal; + protected int $terminal; /** @@ -85,7 +93,7 @@ class WeChatPayService extends BasePayService * @author 段誉 * @date 2021/8/4 15:05 */ - public function pay($from, $order) + public function pay($from, $order): false|array|string { try { switch ($this->terminal) { @@ -111,14 +119,14 @@ class WeChatPayService extends BasePayService $result = $this->nativePay($from, $order, $config['app_id']); break; default: - throw new \Exception('支付方式错误'); + throw new Exception('支付方式错误'); } return [ 'config' => $result, 'pay_way' => PayEnum::WECHAT_PAY ]; - } catch (\Exception $e) { + } catch (Exception $e) { $this->setError($e->getMessage()); return false; } @@ -131,12 +139,12 @@ class WeChatPayService extends BasePayService * @param $order * @param $appId * @return mixed - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 12:12 */ - public function jsapiPay($from, $order, $appId) + public function jsapiPay($from, $order, $appId): mixed { $response = $this->app->getClient()->postJson("v3/pay/transactions/jsapi", [ "appid" => $appId, @@ -165,12 +173,12 @@ class WeChatPayService extends BasePayService * @param $order * @param $appId * @return mixed - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 12:12 */ - public function nativePay($from, $order, $appId) + public function nativePay($from, $order, $appId): mixed { $response = $this->app->getClient()->postJson('v3/pay/transactions/native', [ 'appid' => $appId, @@ -195,12 +203,12 @@ class WeChatPayService extends BasePayService * @param $order * @param $appId * @return mixed - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 12:12 */ - public function appPay($from, $order, $appId) + public function appPay($from, $order, $appId): mixed { $response = $this->app->getClient()->postJson('v3/pay/transactions/app', [ 'appid' => $appId, @@ -226,12 +234,12 @@ class WeChatPayService extends BasePayService * @param $appId * @param $redirectUrl * @return mixed - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 12:13 */ - public function mwebPay($from, $order, $appId) + public function mwebPay($from, $order, $appId): mixed { $response = $this->app->getClient()->postJson('v3/pay/transactions/h5', [ 'appid' => $appId, @@ -266,12 +274,12 @@ class WeChatPayService extends BasePayService * @notes 退款 * @param array $refundData * @return mixed - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 16:53 */ - public function refund(array $refundData) + public function refund(array $refundData): mixed { $response = $this->app->getClient()->postJson('v3/refund/domestic/refunds', [ 'transaction_id' => $refundData['transaction_id'], @@ -291,8 +299,8 @@ class WeChatPayService extends BasePayService /** * @notes 查询退款 * @param $refundSn - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/3/1 11:16 */ @@ -310,7 +318,7 @@ class WeChatPayService extends BasePayService * @author 段誉 * @date 2023/2/27 17:54 */ - public function payDesc($from) + public function payDesc($from): string { $desc = [ 'order' => '商品', @@ -323,14 +331,14 @@ class WeChatPayService extends BasePayService /** * @notes 捕获错误 * @param $result - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2023/2/28 12:09 */ - public function checkResultFail($result) + public function checkResultFail($result): void { if (!empty($result['code']) || !empty($result['message'])) { - throw new \Exception('微信:'. $result['code'] . '-' . $result['message']); + throw new Exception('微信:'. $result['code'] . '-' . $result['message']); } } @@ -340,12 +348,12 @@ class WeChatPayService extends BasePayService * @param $prepayId * @param $appId * @return mixed[] - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidConfigException + * @throws InvalidArgumentException + * @throws InvalidConfigException * @author 段誉 * @date 2023/2/28 17:38 */ - public function getPrepayConfig($prepayId, $appId) + public function getPrepayConfig($prepayId, $appId): array { return $this->app->getUtils()->buildBridgeConfig($prepayId, $appId); } @@ -353,15 +361,15 @@ class WeChatPayService extends BasePayService /** * @notes 支付回调 - * @return \Psr\Http\Message\ResponseInterface - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \EasyWeChat\Kernel\Exceptions\RuntimeException - * @throws \ReflectionException - * @throws \Throwable + * @return ResponseInterface + * @throws InvalidArgumentException + * @throws RuntimeException + * @throws ReflectionException + * @throws Throwable * @author 段誉 * @date 2023/2/28 14:20 */ - public function notify() + public function notify(): ResponseInterface { $server = $this->app->getServer(); // 支付通知 diff --git a/server/app/common/service/sms/SmsDriver.php b/server/app/common/service/sms/SmsDriver.php index be6bfafebbf053a4611b7f4d80c02273d3c3fc1d..791355d55e0de1e8dbfeef59fd2bfb4b2e4d7e63 100644 --- a/server/app/common/service/sms/SmsDriver.php +++ b/server/app/common/service/sms/SmsDriver.php @@ -35,6 +35,7 @@ use app\common\enum\YesNoEnum; use app\common\model\Notice; use app\common\model\notice\SmsLog; use app\common\service\ConfigService; +use Exception; /** * 短信驱动 @@ -47,19 +48,19 @@ class SmsDriver * 错误信息 * @var */ - protected $error = null; + protected string|null $error = null; /** * 默认短信引擎 * @var */ - protected $defaultEngine; + protected mixed $defaultEngine; /** * 短信引擎 * @var */ - protected $engine; + protected mixed $engine; /** * 架构方法 @@ -77,31 +78,31 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function initialize() + public function initialize(): bool { try { $defaultEngine = ConfigService::get('sms', 'engine', false); if($defaultEngine === false) { - throw new \Exception('请开启短信配置'); + throw new Exception('请开启短信配置'); } $this->defaultEngine = $defaultEngine; $classSpace = __NAMESPACE__ . '\\engine\\' . ucfirst(strtolower($defaultEngine)) . 'Sms'; if (!class_exists($classSpace)) { - throw new \Exception('没有相应的短信驱动类'); + throw new Exception('没有相应的短信驱动类'); } $engineConfig = ConfigService::get('sms', strtolower($defaultEngine), false); if($engineConfig === false) { - throw new \Exception($defaultEngine . '未配置'); + throw new Exception($defaultEngine . '未配置'); } if ($engineConfig['status'] != 1) { - throw new \Exception('短信服务未开启'); + throw new Exception('短信服务未开启'); } $this->engine = new $classSpace($engineConfig); if(!is_null($this->engine->getError())) { - throw new \Exception($this->engine->getError()); + throw new Exception($this->engine->getError()); } return true; - } catch (\Exception $e) { + } catch (Exception $e) { $this->error = $e->getMessage(); return false; } @@ -114,7 +115,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -128,7 +129,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function send($mobile, $data) + public function send($mobile, $data): mixed { try { // 发送频率限制 @@ -140,10 +141,10 @@ class SmsDriver ->setTemplateParams($data['params']) ->send(); if(false === $result) { - throw new \Exception($this->engine->getError()); + throw new Exception($this->engine->getError()); } return $result; - } catch(\Exception $e) { + } catch(Exception $e) { $this->error = $e->getMessage(); return false; } @@ -153,11 +154,11 @@ class SmsDriver /** * @notes 发送频率限制 * @param $mobile - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/15 16:29 */ - public function sendLimit($mobile) + public function sendLimit($mobile): void { $smsLog = SmsLog::where([ ['mobile', '=', $mobile], @@ -168,7 +169,7 @@ class SmsDriver ->findOrEmpty() ->toArray(); if(!empty($smsLog) && ($smsLog['send_time'] > time() - 60)) { - throw new \Exception('同一手机号1分钟只能发送1条短信'); + throw new Exception('同一手机号1分钟只能发送1条短信'); } } @@ -181,7 +182,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function verify($mobile, $code, $sceneId = 0) + public function verify($mobile, $code, $sceneId = 0): bool { $where = [ ['mobile', '=', $mobile], diff --git a/server/app/common/service/sms/SmsMessageService.php b/server/app/common/service/sms/SmsMessageService.php index 489cb913c703da53c166b0531d97de40aeec6095..76a436c1418c48b9e69f75a54a9dd09a2f5f076b 100644 --- a/server/app/common/service/sms/SmsMessageService.php +++ b/server/app/common/service/sms/SmsMessageService.php @@ -35,6 +35,8 @@ use app\common\logic\NoticeLogic; use app\common\model\notice\NoticeSetting; use app\common\model\notice\SmsLog; use app\common\service\ConfigService; +use Exception; +use think\Model; /** * 短信服务 @@ -43,10 +45,10 @@ use app\common\service\ConfigService; */ class SmsMessageService { - protected $notice; - protected $smsLog; + protected mixed $notice; + protected mixed $smsLog; - public function send($params) + public function send($params): true { try { // 通知设置 @@ -59,7 +61,7 @@ class SmsMessageService // 发送短信 $smsDriver = new SmsDriver(); if(!is_null($smsDriver->getError())) { - throw new \Exception($smsDriver->getError()); + throw new Exception($smsDriver->getError()); } $result = $smsDriver->send($params['params']['mobile'], [ @@ -69,13 +71,13 @@ class SmsMessageService if ($result === false) { // 发送失败更新短信记录 $this->updateSmsLog($this->smsLog['id'], SmsEnum::SEND_FAIL, $smsDriver->getError()); - throw new \Exception($smsDriver->getError()); + throw new Exception($smsDriver->getError()); } // 发送成功更新短信记录 $this->updateSmsLog($this->smsLog['id'], SmsEnum::SEND_SUCCESS, $result); return true; - } catch (\Exception $e) { - throw new \Exception($e->getMessage()); + } catch (Exception $e) { + throw new Exception($e->getMessage()); } } @@ -88,7 +90,7 @@ class SmsMessageService * @author 段誉 * @date 2022/9/15 16:24 */ - public function contentFormat($noticeSetting, $params) + public function contentFormat($noticeSetting, $params): mixed { $content = $noticeSetting['sms_notice']['content']; foreach($params['params'] as $k => $v) { @@ -103,11 +105,11 @@ class SmsMessageService * @notes 添加短信记录 * @param $params * @param $content - * @return SmsLog|\think\Model + * @return SmsLog|Model * @author 段誉 * @date 2022/9/15 16:24 */ - public function addSmsLog($params, $content) + public function addSmsLog($params, $content): SmsLog|Model { $data = [ 'scene_id' => $params['scene_id'], @@ -129,7 +131,7 @@ class SmsMessageService * @author 段誉 * @date 2022/9/15 16:25 */ - public function setSmsParams($noticeSetting, $params) + public function setSmsParams($noticeSetting, $params): mixed { $defaultEngine = ConfigService::get('sms', 'engine', false); // 阿里云 且是 验证码类型 @@ -184,7 +186,7 @@ class SmsMessageService * @author 段誉 * @date 2022/9/15 16:25 */ - public function updateSmsLog($id, $status, $result) + public function updateSmsLog($id, $status, $result): void { SmsLog::update([ 'id' => $id, diff --git a/server/app/common/service/sms/engine/AliSms.php b/server/app/common/service/sms/engine/AliSms.php index c9d48b8e95b85228b795568b716ea0d88c75db8f..667c346a3c739079890465eecab997cf56a82a23 100644 --- a/server/app/common/service/sms/engine/AliSms.php +++ b/server/app/common/service/sms/engine/AliSms.php @@ -14,6 +14,7 @@ namespace app\common\service\sms\engine; use AlibabaCloud\Client\AlibabaCloud; +use Exception; /** * 阿里云短信 @@ -22,11 +23,11 @@ use AlibabaCloud\Client\AlibabaCloud; */ class AliSms { - protected $error = null; - protected $config; - protected $mobile; - protected $templateId; - protected $templateParams; + protected string|null $error = null; + protected mixed $config; + protected string|null $mobile; + protected string|null $templateId; + protected mixed $templateParams; public function __construct($config) { @@ -40,12 +41,12 @@ class AliSms /** * @notes 设置手机号 - * @param $mobile + * @param int|string $mobile * @return $this * @author 段誉 * @date 2022/9/15 16:28 */ - public function setMobile($mobile) + public function setMobile(int|string$mobile): static { $this->mobile = $mobile; return $this; @@ -59,7 +60,7 @@ class AliSms * @author 段誉 * @date 2022/9/15 16:28 */ - public function setTemplateId($templateId) + public function setTemplateId($templateId): static { $this->templateId = $templateId; return $this; @@ -73,7 +74,7 @@ class AliSms * @author 段誉 * @date 2022/9/15 16:28 */ - public function setTemplateParams($templateParams) + public function setTemplateParams($templateParams): static { $this->templateParams = json_encode($templateParams, JSON_UNESCAPED_UNICODE); return $this; @@ -86,7 +87,7 @@ class AliSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -98,7 +99,7 @@ class AliSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function send() + public function send(): false|array { try { AlibabaCloud::accessKeyClient($this->config['app_key'], $this->config['secret_key']) @@ -126,8 +127,8 @@ class AliSms return $res; } $message = $res['Message'] ?? $res; - throw new \Exception('阿里云短信错误:' . $message); - } catch(\Exception $e) { + throw new Exception('阿里云短信错误:' . $message); + } catch(Exception $e) { $this->error = $e->getMessage(); return false; } diff --git a/server/app/common/service/sms/engine/TencentSms.php b/server/app/common/service/sms/engine/TencentSms.php index ae238a2cb9ac03c1c864dd5762a3cfa00897629d..e18bbbc664862efc603387fcb3bc007232d6097d 100644 --- a/server/app/common/service/sms/engine/TencentSms.php +++ b/server/app/common/service/sms/engine/TencentSms.php @@ -13,6 +13,7 @@ // +---------------------------------------------------------------------- namespace app\common\service\sms\engine; +use Exception; use TencentCloud\Sms\V20190711\SmsClient; use TencentCloud\Sms\V20190711\Models\SendSmsRequest; use TencentCloud\Common\Exception\TencentCloudSDKException; @@ -27,12 +28,11 @@ use TencentCloud\Common\Profile\HttpProfile; */ class TencentSms { - protected $error = null; - protected $config; - protected $mobile; - protected $templateId; - protected $templateParams; - + protected string|null $error = null; + protected mixed $config; + protected string|null $mobile; + protected string|null $templateId; + protected mixed $templateParams; public function __construct($config) { if(empty($config)) { @@ -45,12 +45,12 @@ class TencentSms /** * @notes 设置手机号 - * @param $mobile + * @param int|string $mobile * @return $this * @author 段誉 * @date 2022/9/15 16:26 */ - public function setMobile($mobile) + public function setMobile(int|string $mobile): static { $this->mobile = $mobile; return $this; @@ -64,7 +64,7 @@ class TencentSms * @author 段誉 * @date 2022/9/15 16:26 */ - public function setTemplateId($templateId) + public function setTemplateId($templateId): static { $this->templateId = $templateId; return $this; @@ -78,7 +78,7 @@ class TencentSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function setTemplateParams($templateParams) + public function setTemplateParams($templateParams): static { $this->templateParams = $templateParams; return $this; @@ -91,7 +91,7 @@ class TencentSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -103,7 +103,7 @@ class TencentSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function send() + public function send(): mixed { try { $cred = new Credential($this->config['secret_id'], $this->config['secret_key']); @@ -128,9 +128,9 @@ class TencentSms return $resp; } else { $message = $res['SendStatusSet'][0]['Message'] ?? json_encode($resp); - throw new \Exception('腾讯云短信错误:' . $message); + throw new Exception('腾讯云短信错误:' . $message); } - } catch(\Exception $e) { + } catch(Exception $e) { $this->error = $e->getMessage(); return false; } diff --git a/server/app/common/service/storage/Driver.php b/server/app/common/service/storage/Driver.php index ce7fac6676f2b895b3af0f931c0e984144855ba3..6a4a4d290ba4e7ec9deb42a37a39bc01063ede63 100644 --- a/server/app/common/service/storage/Driver.php +++ b/server/app/common/service/storage/Driver.php @@ -11,17 +11,17 @@ use think\Exception; */ class Driver { - private $config; // upload 配置 - private $engine; // 当前存储引擎类 + private mixed $config; // upload 配置 + private mixed $engine; // 当前存储引擎类 /** * 构造方法 * Driver constructor. * @param $config - * @param null|string $storage 指定存储方式,如不指定则为系统默认 + * @param string|null $storage 指定存储方式,如不指定则为系统默认 * @throws Exception */ - public function __construct($config, $storage = null) + public function __construct($config, string $storage = null) { $this->config = $config; $this->engine = $this->getEngineClass($storage); @@ -34,7 +34,8 @@ class Driver * @param $size * @return array */ - public function getUploadToken($name,$src,$size){ + public function getUploadToken($name,$src,$size): array + { return $this->engine->getUploadToken($name,$src,$size); } /** @@ -42,7 +43,7 @@ class Driver * @param string $name * @return mixed */ - public function setUploadFile($name = 'iFile') + public function setUploadFile(string $name = 'iFile'): mixed { return $this->engine->setUploadFile($name); } @@ -52,17 +53,17 @@ class Driver * @param string $filePath * @return mixed */ - public function setUploadFileByReal($filePath) + public function setUploadFileByReal(string $filePath): mixed { return $this->engine->setUploadFileByReal($filePath); } /** * 执行文件上传 - * @param $save_dir (保存路径) + * @param string $save_dir 保存路径 * @return mixed */ - public function upload($save_dir) + public function upload(string $save_dir): mixed { return $this->engine->upload($save_dir); } @@ -74,7 +75,8 @@ class Driver * @author 张无忌(2021/3/2 14:16) * @return mixed */ - public function fetch($url, $key) { + public function fetch($url, $key): mixed + { return $this->engine->fetch($url, $key); } @@ -83,7 +85,7 @@ class Driver * @param $fileName * @return mixed */ - public function delete($fileName) + public function delete($fileName): mixed { return $this->engine->delete($fileName); } @@ -92,7 +94,7 @@ class Driver * 获取错误信息 * @return mixed */ - public function getError() + public function getError(): mixed { return $this->engine->getError(); } @@ -101,7 +103,7 @@ class Driver * 获取文件路径 * @return mixed */ - public function getFileName() + public function getFileName(): mixed { return $this->engine->getFileName(); } @@ -110,18 +112,18 @@ class Driver * 返回文件信息 * @return mixed */ - public function getFileInfo() + public function getFileInfo(): mixed { return $this->engine->getFileInfo(); } /** * 获取当前的存储引擎 - * @param null|string $storage 指定存储方式,如不指定则为系统默认 + * @param string|null $storage 指定存储方式,如不指定则为系统默认 * @return mixed * @throws Exception */ - private function getEngineClass($storage = null) + private function getEngineClass(string|null $storage = null): mixed { $engineName = is_null($storage) ? $this->config['default'] : $storage; $classSpace = __NAMESPACE__ . '\\engine\\' . ucfirst($engineName); diff --git a/server/app/common/service/storage/engine/Aliyun.php b/server/app/common/service/storage/engine/Aliyun.php index 98728fc4d99b8bd3dc4b2145f3dd950aa610029b..97507b31ad0e4536f9d7ac8f4cd0b4ef4ee25352 100644 --- a/server/app/common/service/storage/engine/Aliyun.php +++ b/server/app/common/service/storage/engine/Aliyun.php @@ -13,7 +13,7 @@ use OSS\Core\OssException; */ class Aliyun extends Server { - private $config; + private mixed $config; /** * 构造方法 @@ -28,10 +28,10 @@ class Aliyun extends Server /** * 执行上传 - * @param $save_dir (保存路径) - * @return bool|mixed + * @param string $save_dir 保存路径 + * @return bool */ - public function upload($save_dir) + public function upload(string $save_dir): bool { try { $ossClient = new OssClient( @@ -55,10 +55,10 @@ class Aliyun extends Server * Notes: 抓取远程资源 * @param $url * @param null $key - * @return mixed|void + * @return bool * @author 张无忌(2021/3/2 14:36) */ - public function fetch($url, $key = null) + public function fetch($url, $key = null): bool { try { $ossClient = new OssClient( @@ -84,9 +84,9 @@ class Aliyun extends Server /** * 删除文件 * @param $fileName - * @return bool|mixed + * @return bool */ - public function delete($fileName) + public function delete($fileName): bool { try { $ossClient = new OssClient( @@ -107,12 +107,12 @@ class Aliyun extends Server * 返回文件路径 * @return mixed */ - public function getFileName() + public function getFileName(): string { return $this->fileName; } - public function getUploadToken($name,$src,$size) + public function getUploadToken($name,$src,$size): array|false { try { $ossClient = new OssClient( diff --git a/server/app/common/service/storage/engine/Local.php b/server/app/common/service/storage/engine/Local.php index 25d08cd6047550cb7201f9ec0582b5eafcc6f961..28c7b4af4f8a6998fb964f1b9c15c0bb810b3d9f 100644 --- a/server/app/common/service/storage/engine/Local.php +++ b/server/app/common/service/storage/engine/Local.php @@ -18,10 +18,10 @@ class Local extends Server /** * 上传 - * @param $save_dir (保存路径) + * @param $save_dir string * @return bool */ - public function upload($save_dir) + public function upload(string $save_dir): bool { // 验证文件并上传 $info = $this->file->move($save_dir.'/'.$this->fileName); @@ -32,14 +32,17 @@ class Local extends Server return true; } - public function fetch($url, $key=null) {} + public function fetch($url, $key=null): bool + { + return true; + } /** * 删除文件 * @param $fileName - * @return bool|mixed + * @return bool */ - public function delete($fileName) + public function delete($fileName): bool { $check = strpos($fileName, '/'); if ($check !== false && $check == 0) { @@ -52,15 +55,15 @@ class Local extends Server /** * 返回文件路径 - * @return mixed + * @return string */ - public function getFileName() + public function getFileName(): string { return $this->fileName; } - public function getUploadToken($name,$src,$size) + public function getUploadToken($name,$src,$size): array { // TODO: Implement getUploadToken() method. $params = new ArrayObject(); diff --git a/server/app/common/service/storage/engine/Qcloud.php b/server/app/common/service/storage/engine/Qcloud.php index 252fea731abf13857c7936bd1d15d91fa0aefc5f..89e4f8cc68e12a0cee8224505ccf26c7bc7aecc2 100644 --- a/server/app/common/service/storage/engine/Qcloud.php +++ b/server/app/common/service/storage/engine/Qcloud.php @@ -13,8 +13,8 @@ use Qcloud\Cos\Client; */ class Qcloud extends Server { - private $config; - private $cosClient; + private mixed $config; + private mixed $cosClient; /** * 构造方法 @@ -32,7 +32,7 @@ class Qcloud extends Server /** * 创建COS控制类 */ - private function createCosClient() + private function createCosClient(): void { $this->cosClient = new Client([ 'region' => $this->config['region'], @@ -45,10 +45,10 @@ class Qcloud extends Server /** * 执行上传 - * @param $save_dir (保存路径) - * @return bool|mixed + * @param $save_dir string + * @return bool */ - public function upload($save_dir) + public function upload(string $save_dir): bool { // 上传文件 // putObject(上传接口,最大支持上传5G文件) @@ -69,10 +69,11 @@ class Qcloud extends Server * notes: 抓取远程资源(最大支持上传5G文件) * @param $url * @param null $key - * @author 张无忌(2021/3/2 14:36) - * @return mixed|void + * @return bool + *@author 张无忌(2021/3/2 14:36) */ - public function fetch($url, $key=null) { + public function fetch($url, $key=null): bool + { try { $this->cosClient->putObject([ 'Bucket' => $this->config['bucket'], @@ -89,9 +90,9 @@ class Qcloud extends Server /** * 删除文件 * @param $fileName - * @return bool|mixed + * @return bool */ - public function delete($fileName) + public function delete($fileName): bool { try { $this->cosClient->deleteObject(array( @@ -109,12 +110,12 @@ class Qcloud extends Server * 返回文件路径 * @return mixed */ - public function getFileName() + public function getFileName(): string { return $this->fileName; } - public function getUploadToken($name,$src,$size) + public function getUploadToken($name,$src,$size): array { // TODO: Implement getUploadToken() method. $params = new ArrayObject(); diff --git a/server/app/common/service/storage/engine/Qiniu.php b/server/app/common/service/storage/engine/Qiniu.php index 0611217a893bc16632d9d84b12810d8958e92a1e..6bef30a0c2aa15caa56aec7e5c6ffb1d4c3d1e42 100644 --- a/server/app/common/service/storage/engine/Qiniu.php +++ b/server/app/common/service/storage/engine/Qiniu.php @@ -15,7 +15,7 @@ use Qiniu\Storage\BucketManager; */ class Qiniu extends Server { - private $config; + private mixed $config; /** * 构造方法 @@ -30,12 +30,12 @@ class Qiniu extends Server /** * @notes 执行上传 - * @param $save_dir - * @return bool|mixed + * @param string $save_dir + * @return bool * @author 张无忌 * @date 2021/7/27 16:02 */ - public function upload($save_dir) + public function upload(string $save_dir): bool { // 要上传图片的本地路径 $realPath = $this->getRealPath(); @@ -69,11 +69,11 @@ class Qiniu extends Server * @notes 抓取远程资源 * @param $url * @param null $key - * @return bool|mixed + * @return bool * @author 张无忌 * @date 2021/7/27 16:02 */ - public function fetch($url, $key=null) + public function fetch($url, $key=null): bool { try { if (substr($url, 0, 1) !== '/' || strstr($url, 'http://') || strstr($url, 'https://')) { @@ -102,11 +102,11 @@ class Qiniu extends Server /** * @notes 删除文件 * @param $fileName - * @return bool|mixed + * @return bool * @author 张无忌 * @date 2021/7/27 16:02 */ - public function delete($fileName) + public function delete($fileName): bool { // 构建鉴权对象 $auth = new Auth($this->config['access_key'], $this->config['secret_key']); @@ -130,13 +130,13 @@ class Qiniu extends Server * 返回文件路径 * @return mixed */ - public function getFileName() + public function getFileName(): string { return $this->fileName; } - public function getUploadToken($name,$src,$size) + public function getUploadToken($name,$src,$size): array { $dummyAuth = new Auth($this->config['access_key'], $this->config['secret_key']); //size 单位byte diff --git a/server/app/common/service/storage/engine/Server.php b/server/app/common/service/storage/engine/Server.php index 9f2a872f94db42f0f8666c5b881bd1a60b72f6f2..2bf811dd5659175eff275918c69a45ae9b48afc5 100644 --- a/server/app/common/service/storage/engine/Server.php +++ b/server/app/common/service/storage/engine/Server.php @@ -12,13 +12,13 @@ use Tinywan\Storage\Storage; */ abstract class Server { - protected $file; - protected $error; - protected $fileName; - protected $fileInfo; + protected mixed $file; + protected string|null $error; + protected string $fileName; + protected mixed $fileInfo; // 是否为内部上传 - protected $isInternal = false; + protected bool $isInternal = false; /** * 构造函数 @@ -33,7 +33,7 @@ abstract class Server * @param string $name * @throws Exception */ - public function setUploadFile($name) + public function setUploadFile(string $name): void { // 接收上传的文件 $this->file = request()->file($name); @@ -68,7 +68,7 @@ abstract class Server * 设置上传的文件信息 * @param string $filePath */ - public function setUploadFileByReal($filePath) + public function setUploadFileByReal(string $filePath): void { // 设置为系统内部上传 $this->isInternal = true; @@ -88,41 +88,41 @@ abstract class Server * @param $url * @param $key * @author 张无忌(2021/3/2 14:15) - * @return mixed + * @return bool */ - abstract protected function fetch($url, $key); + abstract protected function fetch($url, $key): bool; /** * 文件上传 - * @param $save_dir (保存路径) + * @param string $save_dir (保存路径) * @return mixed */ - abstract protected function upload($save_dir); + abstract protected function upload(string $save_dir): bool; /** * 文件删除 * @param $fileName * @return mixed */ - abstract protected function delete($fileName); + abstract protected function delete($fileName): bool; /** * 返回上传后文件路径 - * @return mixed + * @return string */ - abstract public function getFileName(); + abstract public function getFileName(): string; /** * 构建文件上传凭证 * @return mixed */ - abstract public function getUploadToken($name,$src,$size); + abstract public function getUploadToken(string $name,string $src,int|string $size): mixed; /** * 返回文件信息 * @return mixed */ - public function getFileInfo() + public function getFileInfo(): mixed { return $this->fileInfo; } @@ -134,9 +134,9 @@ abstract class Server /** * 返回错误信息 - * @return mixed + * @return string|null */ - public function getError() + public function getError(): ?string { return $this->error; } @@ -144,7 +144,7 @@ abstract class Server /** * 生成保存文件名 */ - private function buildSaveName() + private function buildSaveName(): string { // 要上传图片的本地路径 $realPath = $this->getRealPath(); diff --git a/server/app/common/service/wechat/WeChatConfigService.php b/server/app/common/service/wechat/WeChatConfigService.php index 9a0a344a7abd9fcc97273e3ac8d255d6dfaae6f4..82377660fefbfa97e4b214f421f2b6320fc4edc3 100644 --- a/server/app/common/service/wechat/WeChatConfigService.php +++ b/server/app/common/service/wechat/WeChatConfigService.php @@ -32,7 +32,7 @@ class WeChatConfigService * @author 段誉 * @date 2022/9/6 19:49 */ - public static function getMnpConfig() + public static function getMnpConfig(): array { return [ 'app_id' => ConfigService::get('mnp_setting', 'app_id'), @@ -52,7 +52,7 @@ class WeChatConfigService * @author 段誉 * @date 2022/9/6 19:49 */ - public static function getOaConfig() + public static function getOaConfig(): array { return [ 'app_id' => ConfigService::get('oa_setting', 'app_id'), @@ -73,7 +73,7 @@ class WeChatConfigService * @author 段誉 * @date 2022/10/20 15:51 */ - public static function getOpConfig() + public static function getOpConfig(): array { return [ 'app_id' => ConfigService::get('open_platform', 'app_id'), @@ -94,7 +94,7 @@ class WeChatConfigService * @author 段誉 * @date 2023/2/27 15:45 */ - public static function getPayConfigByTerminal($terminal) + public static function getPayConfigByTerminal($terminal): array { switch ($terminal) { case UserTerminalEnum::WECHAT_MMP: @@ -154,7 +154,7 @@ class WeChatConfigService * @author 段誉 * @date 2023/2/27 15:48 */ - public static function setCert($path, $cert) + public static function setCert($path, $cert): void { $fopenPath = fopen($path, 'w'); fwrite($fopenPath, $cert); diff --git a/server/app/common/service/wechat/WeChatMnpService.php b/server/app/common/service/wechat/WeChatMnpService.php index 38da47b0ecb815bac28a6d8a32e960286cfe7f99..95661f9854d79b9dfb55159d1c69d2b869139932 100644 --- a/server/app/common/service/wechat/WeChatMnpService.php +++ b/server/app/common/service/wechat/WeChatMnpService.php @@ -15,7 +15,16 @@ namespace app\common\service\wechat; use EasyWeChat\Kernel\Exceptions\Exception; +use EasyWeChat\Kernel\Exceptions\HttpException; +use EasyWeChat\Kernel\Exceptions\InvalidArgumentException; +use EasyWeChat\Kernel\HttpClient\Response; use EasyWeChat\MiniApp\Application; +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; /** @@ -26,9 +35,9 @@ use EasyWeChat\MiniApp\Application; class WeChatMnpService { - protected $app; + protected Application $app; - protected $config; + protected array $config; public function __construct() { @@ -44,7 +53,7 @@ class WeChatMnpService * @author 段誉 * @date 2023/2/27 12:03 */ - protected function getConfig() + protected function getConfig(): array { $config = WeChatConfigService::getMnpConfig(); if (empty($config['app_id']) || empty($config['secret'])) { @@ -59,17 +68,17 @@ class WeChatMnpService * @param string $code * @return array * @throws Exception - * @throws \EasyWeChat\Kernel\Exceptions\HttpException - * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws HttpException + * @throws InvalidArgumentException + * @throws ClientExceptionInterface + * @throws DecodingExceptionInterface + * @throws RedirectionExceptionInterface + * @throws ServerExceptionInterface + * @throws TransportExceptionInterface * @author 段誉 * @date 2023/2/27 11:03 */ - public function getMnpResByCode(string $code) + public function getMnpResByCode(string $code): array { $utils = $this->app->getUtils(); $response = $utils->codeToSession($code); @@ -85,12 +94,12 @@ class WeChatMnpService /** * @notes 获取手机号 * @param string $code - * @return \EasyWeChat\Kernel\HttpClient\Response|\Symfony\Contracts\HttpClient\ResponseInterface - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @return Response|ResponseInterface + * @throws TransportExceptionInterface * @author 段誉 * @date 2023/2/27 11:46 */ - public function getUserPhoneNumber(string $code) + public function getUserPhoneNumber(string $code): ResponseInterface|Response { return $this->app->getClient()->postJson('wxa/business/getuserphonenumber', [ 'code' => $code, diff --git a/server/app/common/service/wechat/WeChatOaService.php b/server/app/common/service/wechat/WeChatOaService.php index e277d4fb12604c8a0051cbc5fd9f6187d44ba46e..0386231edc72c05c92632965ccebab98a6754df6 100644 --- a/server/app/common/service/wechat/WeChatOaService.php +++ b/server/app/common/service/wechat/WeChatOaService.php @@ -15,7 +15,19 @@ namespace app\common\service\wechat; use EasyWeChat\Kernel\Exceptions\Exception; +use EasyWeChat\Kernel\Exceptions\HttpException; +use EasyWeChat\Kernel\HttpClient\Response; use EasyWeChat\OfficialAccount\Application; +use EasyWeChat\OfficialAccount\Server; +use Psr\SimpleCache\InvalidArgumentException; +use ReflectionException; +use Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface; +use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface; +use Symfony\Contracts\HttpClient\ResponseInterface; +use Throwable; /** @@ -26,9 +38,9 @@ use EasyWeChat\OfficialAccount\Application; class WeChatOaService { - protected $app; + protected Application $app; - protected $config; + protected array $config; public function __construct() @@ -40,14 +52,14 @@ class WeChatOaService /** * @notes easywechat服务端 - * @return \EasyWeChat\Kernel\Contracts\Server|\EasyWeChat\OfficialAccount\Server + * @return \EasyWeChat\Kernel\Contracts\Server|Server * @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException - * @throws \ReflectionException - * @throws \Throwable + * @throws ReflectionException + * @throws Throwable * @author 段誉 * @date 2023/2/27 14:22 */ - public function getServer() + public function getServer(): Server|\EasyWeChat\Kernel\Contracts\Server { return $this->app->getServer(); } @@ -60,7 +72,7 @@ class WeChatOaService * @author 段誉 * @date 2023/2/27 12:03 */ - protected function getConfig() + protected function getConfig(): array { $config = WeChatConfigService::getOaConfig(); if (empty($config['app_id']) || empty($config['secret'])) { @@ -79,7 +91,7 @@ class WeChatOaService * @author 段誉 * @date 2023/2/27 11:04 */ - public function getOaResByCode(string $code) + public function getOaResByCode(string $code): mixed { $response = $this->app->getOAuth() ->scopes(['snsapi_userinfo']) @@ -102,7 +114,7 @@ class WeChatOaService * @author 段誉 * @date 2023/2/27 10:35 */ - public function getCodeUrl(string $url) + public function getCodeUrl(string $url): mixed { return $this->app->getOAuth() ->scopes(['snsapi_userinfo']) @@ -114,12 +126,12 @@ class WeChatOaService * @notes 创建公众号菜单 * @param array $buttons * @param array $matchRule - * @return \EasyWeChat\Kernel\HttpClient\Response|\Symfony\Contracts\HttpClient\ResponseInterface - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @return Response|ResponseInterface + * @throws TransportExceptionInterface * @author 段誉 * @date 2023/2/27 12:07 */ - public function createMenu(array $buttons, array $matchRule = []) + public function createMenu(array $buttons, array $matchRule = []): ResponseInterface|Response { if (!empty($matchRule)) { return $this->app->getClient()->postJson('cgi-bin/menu/addconditional', [ @@ -139,17 +151,17 @@ class WeChatOaService * @param array $openTagList * @param false $debug * @return mixed[] - * @throws \EasyWeChat\Kernel\Exceptions\HttpException - * @throws \Psr\SimpleCache\InvalidArgumentException - * @throws \Symfony\Contracts\HttpClient\Exception\ClientExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\DecodingExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\RedirectionExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\ServerExceptionInterface - * @throws \Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface + * @throws HttpException + * @throws InvalidArgumentException + * @throws ClientExceptionInterface + * @throws DecodingExceptionInterface + * @throws RedirectionExceptionInterface + * @throws ServerExceptionInterface + * @throws TransportExceptionInterface * @author 段誉 * @date 2023/3/1 11:46 */ - public function getJsConfig($url, $jsApiList, $openTagList = [], $debug = false) + public function getJsConfig($url, $jsApiList, $openTagList = [], $debug = false): array { return $this->app->getUtils()->buildJsSdkConfig($url, $jsApiList, $openTagList, $debug); } diff --git a/server/app/common/service/wechat/WeChatRequestService.php b/server/app/common/service/wechat/WeChatRequestService.php index 317b111ee60a81521a5861544d6884aa8cb519a7..eecd72e1beae4e4448ebd7a8b280fe28e2e07d16 100644 --- a/server/app/common/service/wechat/WeChatRequestService.php +++ b/server/app/common/service/wechat/WeChatRequestService.php @@ -35,7 +35,7 @@ class WeChatRequestService extends BaseLogic * @author 段誉 * @date 2022/10/20 18:20 */ - public static function getScanCodeUrl($appId, $redirectUri, $state) + public static function getScanCodeUrl($appId, $redirectUri, $state): string { $url = 'https://open.weixin.qq.com/connect/qrconnect?'; $url .= 'appid=' . $appId . '&redirect_uri=' . $redirectUri . '&response_type=code&scope=snsapi_login'; @@ -51,7 +51,7 @@ class WeChatRequestService extends BaseLogic * @author 段誉 * @date 2022/10/21 10:16 */ - public static function getUserAuthByCode($code) + public static function getUserAuthByCode($code): mixed { $config = WeChatConfigService::getOpConfig(); $url = 'https://api.weixin.qq.com/sns/oauth2/access_token'; @@ -70,7 +70,7 @@ class WeChatRequestService extends BaseLogic * @author 段誉 * @date 2022/10/21 10:21 */ - public static function getUserInfoByAuth($accessToken, $openId) + public static function getUserInfoByAuth($accessToken, $openId): mixed { $url = 'https://api.weixin.qq.com/sns/userinfo'; $url .= '?access_token=' . $accessToken . '&openid=' . $openId; diff --git a/server/app/common/validate/BaseValidate.php b/server/app/common/validate/BaseValidate.php index 8ac4387d0c4482c8dd19ab4dca8239acad5f150f..bc3f84edb2dd798c5ff073f73181bb02d669c34d 100644 --- a/server/app/common/validate/BaseValidate.php +++ b/server/app/common/validate/BaseValidate.php @@ -21,14 +21,14 @@ use taoser\Validate; class BaseValidate extends Validate { - public $method = 'GET'; + public string $method = 'GET'; /** * @notes 设置请求方式 * @author 令狐冲 * @date 2021/12/27 14:13 */ - public function post() + public function post(): static { if (!request()->method() == 'POST') { JsonService::throw('请求方式错误,请使用post请求方式'); @@ -42,7 +42,7 @@ class BaseValidate extends Validate * @author 令狐冲 * @date 2021/12/27 14:13 */ - public function get() + public function get(): static { if (!request()->method() == 'GET') { JsonService::throw('请求方式错误,请使用get请求方式'); diff --git a/server/app/common/validate/ListsValidate.php b/server/app/common/validate/ListsValidate.php index db7989f94c90bb7150f6becbb21d08d0374ddf35..590cf0a74af0ae49f717efd8c7868f484a9b91a7 100644 --- a/server/app/common/validate/ListsValidate.php +++ b/server/app/common/validate/ListsValidate.php @@ -49,11 +49,11 @@ class ListsValidate extends BaseValidate * @param $value * @param $rule * @param $data - * @return bool + * @return bool|string * @author 令狐冲 * @date 2021/7/30 15:13 */ - public function pageSizeMax($value, $rule, $data) + public function pageSizeMax($value, $rule, $data): bool|string { $pageSizeMax = Config::get('project.lists.page_size_max'); if ($pageSizeMax < $value) { diff --git a/server/app/crontab/Task.php b/server/app/crontab/Task.php index 4d4d56e7432bf69d23af8cd9c590c3ee5a7c3278..f37c7af1626bc4289998fec1c41880c0eeadf3ca 100644 --- a/server/app/crontab/Task.php +++ b/server/app/crontab/Task.php @@ -2,6 +2,7 @@ namespace app\crontab; +use app\common\model\OperationLog; use Workerman\Crontab\Crontab; class Task @@ -41,7 +42,7 @@ class Task // 每天的2点30执行,注意这里省略了秒位 new Crontab('30 2 * * *', function(){ //todo 删除日志表日志 - \app\common\model\OperationLog::destroy(function ($query) { + OperationLog::destroy(function ($query) { $query->where('create_time','<',strtotime("-15 day")); },true); }); diff --git a/server/app/functions.php b/server/app/functions.php index 3bdba92d5921278d01ed6b86279676ba4c180a97..df00dfadfc0742dba6790f6071fe50f1011ecd3b 100644 --- a/server/app/functions.php +++ b/server/app/functions.php @@ -5,7 +5,10 @@ use app\common\service\FileService; use support\Container; +use support\Response; use think\facade\Cache; +use Webman\Exception\NotFoundException; +use Workerman\Http\Client; use Workerman\Protocols\Http\Chunk; if (!function_exists('download')) { @@ -27,7 +30,7 @@ if(!function_exists('substr_symbol_behind')){ * @author 乔峰 * @date 2021/12/28 18:24 */ - function substr_symbol_behind($str, $symbol = '.') : string + function substr_symbol_behind($str, string $symbol = '.') : string { $result = strripos($str, $symbol); if ($result === false) { @@ -44,7 +47,7 @@ if (!function_exists('root_path')) { * @param string $path * @return string */ - function root_path($path = '') + function root_path(string $path = '') { return base_path() . DIRECTORY_SEPARATOR; } @@ -55,10 +58,9 @@ if (!function_exists('generate_path')) { /** * 获取项目根目录 * - * @param string $path * @return string */ - function generate_path() + function generate_path(): string { return root_path() . 'app/'; } @@ -68,13 +70,14 @@ if (!function_exists('generate_path')) { if (!function_exists('cache')) { /** * 缓存管理 - * @param string $name 缓存名称 - * @param mixed $value 缓存值 - * @param mixed $options 缓存参数 - * @param string $tag 缓存标签 + * @param string|null $name 缓存名称 + * @param mixed $value 缓存值 + * @param mixed|null $options 缓存参数 + * @param null $tag 缓存标签 * @return mixed + * @throws \Psr\SimpleCache\InvalidArgumentException */ - function cache(string $name = null, $value = '', $options = null, $tag = null) + function cache(string $name = null, mixed $value = '', mixed $options = null, $tag = null): mixed { if (is_null($name)) { return Cache::getFacadeClass(); @@ -82,7 +85,7 @@ if (!function_exists('cache')) { if ('' === $value) { // 获取缓存 - return 0 === strpos($name, '?') ? Cache::has(substr($name, 1)) : Cache::get($name); + return str_starts_with($name, '?') ? Cache::has(substr($name, 1)) : Cache::get($name); } elseif (is_null($value)) { // 删除缓存 return Cache::delete($name); @@ -112,7 +115,7 @@ if (!function_exists('make')) { if ($isObj&&!$newInstance){ try{ return Container::get($abstract); - }catch (\Webman\Exception\NotFoundException $e){ + }catch (NotFoundException $e){ return null; } } @@ -157,7 +160,7 @@ if (!function_exists('url')) { * @param bool|string $domain 域名 * @return string */ - function url(string $url = '', array $vars = [], $suffix = true, $domain = false): string + function url(string $url = '', array $vars = [], bool|string $suffix = true, bool|string $domain = false): string { $url = $suffix?$url.'.'.$suffix:$url; $host = getAgreementHost(); @@ -267,7 +270,7 @@ if (!function_exists('compare_php')) { */ function compare_php(string $version): bool { - return version_compare(PHP_VERSION, $version) >= 0 ? true : false; + return version_compare(PHP_VERSION, $version) >= 0; } } if (!function_exists('check_dir_write')) { @@ -312,15 +315,13 @@ if (!function_exists('linear_to_tree')) { * {"id":2,"pid":0,"name":"b","level":1},{"id":4,"pid":2,"name":"d","level":2},{"id":5,"pid":4,"name":"e","level":3}, * {"id":6,"pid":5,"name":"f","level":4}] * @param array $data 线性结构数组 - * @param string $symbol 名称前面加符号 - * @param string $name 名称 + * @param string $sub_key_name * @param string $id_name 数组id名 * @param string $parent_id_name 数组祖先id名 - * @param int $level 此值请勿给参数 * @param int $parent_id 此值请勿给参数 * @return array */ - function linear_to_tree($data, $sub_key_name = 'sub', $id_name = 'id', $parent_id_name = 'pid', $parent_id = 0) + function linear_to_tree(array $data, string $sub_key_name = 'sub', string $id_name = 'id', string $parent_id_name = 'pid', int $parent_id = 0): array { $tree = []; foreach ($data as $row) { @@ -339,7 +340,7 @@ if (!function_exists('linear_to_tree')) { if (!function_exists('createDir')) { - function createDir($path) + function createDir($path): bool { if (is_dir($path)) { return true; @@ -377,7 +378,7 @@ if (!function_exists('generate_sn')) { /** * @notes 生成编码 * @param $table - * @param $field + * @param string $field * @param string $prefix * @param int $randSuffixLength * @param array $pool @@ -385,7 +386,7 @@ if (!function_exists('generate_sn')) { * @author 段誉 * @date 2023/2/23 11:35 */ - function generate_sn($table, $field, $prefix = '', $randSuffixLength = 4, $pool = []) : string + function generate_sn($table, string $field, string $prefix = '', int $randSuffixLength = 4, array $pool = []) : string { $suffix = ''; for ($i = 0; $i < $randSuffixLength; $i++) { @@ -407,11 +408,11 @@ if (!function_exists('get_file_domain')) { /** * @notes 设置内容图片域名 * @param $content - * @return array|string|string[]|null + * @return array|string * @author 段誉 * @date 2022/9/26 10:43 */ - function get_file_domain($content) + function get_file_domain($content): array|string { $preg = '/()/is'; $fileUrl = FileService::getFileUrl(); @@ -428,7 +429,7 @@ if (!function_exists('clear_file_domain')) { * @author 段誉 * @date 2022/9/26 10:43 */ - function clear_file_domain($content) + function clear_file_domain($content): array|string { $fileUrl = FileService::getFileUrl(); return str_replace($fileUrl, '/', $content); @@ -447,7 +448,7 @@ if (!function_exists('download_file')) { * @author 段誉 * @date 2022/9/16 9:53 */ - function download_file($url, $saveDir, $fileName) + function download_file($url, $saveDir, $fileName): string { if (!file_exists($saveDir)) { mkdir($saveDir, 0775, true); @@ -488,8 +489,12 @@ if (!function_exists('formatDateStrToTime')){ /** * 时间格式化 时间字符串 按照指定格式解析返回时间戳 */ - function formatDateStrToTime($dateStr,$format){ + function formatDateStrToTime($dateStr,$format): int|false + { $date = DateTime::createFromFormat($format,$dateStr); + if (!$date){ + return false; + } return $date->getTimestamp(); } } @@ -497,7 +502,8 @@ if (!function_exists('findChildren')){ /** * 查找树表中 本身+子项+子子项。。。得数组 */ - function findChildren($data, $targetId,&$list,$childrenKey = 'children',$idKey='id',$pidKey='pid') { + function findChildren($data, $targetId,&$list,$childrenKey = 'children',$idKey='id',$pidKey='pid'): void + { foreach ($data as $item) { if ($item[$idKey] == $targetId){ $insertData = []; @@ -531,12 +537,13 @@ if (!function_exists('getAgreementHost')){ * 如果是后台有单独域名部署那么直接从 host 请求头上拿域名 * @return array|string|null */ - function getAgreementHost() { + function getAgreementHost(): array|string|null + { //兼容脚本环境使用 if (!request()){ return getenv('SERVER_LISTEN','http://127.0.0.1'); } - if(!strstr(request()->host(), 'http://') && !strstr(request()->host(), 'https://')){ + if(!str_contains(request()->host(), 'http://') && !str_contains(request()->host(), 'https://')){ return request()->header('Scheme','http')."://".request()->host(); } return request()->host(); @@ -685,10 +692,10 @@ if (!function_exists('requestGetAsync')) { * @param bool $is_auto_end * @param bool $result_json_format * @param array $addHeaders - * @return \support\Response|true + * @return Response|true * @throws Throwable */ - function requestGetAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): \support\Response|true + function requestGetAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): Response|true { $params = $data; if (is_array($data)) { @@ -701,7 +708,7 @@ if (!function_exists('requestGetAsync')) { $header = explode(': ', $val); $headers[$header[0]] = $header[1]; } - $http = new \Workerman\Http\Client([ + $http = new Client([ 'headers' => $headers, 'timeout'=>60 ]); @@ -745,10 +752,10 @@ if (!function_exists('requestJsonPostAsync')) { * @param bool $is_auto_end * @param bool $result_json_format * @param array $addHeaders - * @return \support\Response|true + * @return Response|true * @throws Throwable */ - function requestJsonPostAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): \support\Response|true + function requestJsonPostAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): Response|true { $data_json = $data?:''; if (is_array($data)){ @@ -764,7 +771,7 @@ if (!function_exists('requestJsonPostAsync')) { $header = explode(': ', $val); $headers[$header[0]] = $header[1]; } - $http = new \Workerman\Http\Client([ + $http = new Client([ 'headers' => $headers, ]); $isEnd = false; @@ -807,10 +814,10 @@ if (!function_exists('requestFormPostAsync')) { * @param bool $is_auto_end * @param bool $result_json_format * @param array $addHeaders - * @return \support\Response|true + * @return Response|true * @throws Throwable */ - function requestFormPostAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): \support\Response|true + function requestFormPostAsync(string $url, mixed $data, callable|null $success_call, callable|null $error_call,bool $is_auto_end = true, bool $result_json_format = true, array $addHeaders = []): Response|true { $data_json = $data?:''; if (is_array($data)){ @@ -825,7 +832,7 @@ if (!function_exists('requestFormPostAsync')) { $header = explode(': ', $val); $headers[$header[0]] = $header[1]; } - $http = new \Workerman\Http\Client([ + $http = new Client([ 'headers' => $headers, ]); $isEnd = false; diff --git a/server/app/queue/redis/ImportXlsxClient.php b/server/app/queue/redis/ImportXlsxClient.php index cd1dfa85ec5962cd7d189782ca7d2627b6a05aea..2f7c2f6576885491ce923e70800b5d55f3c02b4d 100644 --- a/server/app/queue/redis/ImportXlsxClient.php +++ b/server/app/queue/redis/ImportXlsxClient.php @@ -3,11 +3,13 @@ namespace app\queue\redis; use app\queue\send\SendQueue; +use Exception; use PhpOffice\PhpSpreadsheet\IOFactory; use PhpOffice\PhpSpreadsheet\Reader\Csv; use PhpOffice\PhpSpreadsheet\Reader\Xls; use PhpOffice\PhpSpreadsheet\Reader\Xlsx; use PhpOffice\PhpSpreadsheet\Spreadsheet; +use Throwable; use Webman\RedisQueue\Consumer; /** @@ -225,7 +227,7 @@ class ImportXlsxClient implements Consumer //更新插入数量 $this->handlerEndCallback($handlerNumber,$saveOkNumber,$data); print("----执行结束----\r\n"); - }catch (\Exception $e){ + }catch (Exception $e){ print("----执行错误----\r\n"); } } @@ -279,7 +281,7 @@ class ImportXlsxClient implements Consumer 'error' => '错误信息' // 错误信息 ] */ - public function onConsumeFailure(\Throwable $e, $package): void + public function onConsumeFailure(Throwable $e, $package): void { echo "consume failure\n"; echo $e->getMessage() . "\n"; diff --git a/server/app/queue/redis/LogClient.php b/server/app/queue/redis/LogClient.php index a38144da3cacf3ffc0b5f714ddddfbfd73d4c6be..5ab2d91eaa47bd06275e3b9dbbd556fbdef64631 100644 --- a/server/app/queue/redis/LogClient.php +++ b/server/app/queue/redis/LogClient.php @@ -3,6 +3,7 @@ namespace app\queue\redis; use app\queue\send\SendQueue; +use Throwable; use Webman\RedisQueue\Consumer; class LogClient implements Consumer @@ -41,7 +42,7 @@ class LogClient implements Consumer 'error' => '错误信息' // 错误信息 ] */ - public function onConsumeFailure(\Throwable $e, $package): void + public function onConsumeFailure(Throwable $e, $package): void { echo "consume failure\n"; echo $e->getMessage() . "\n"; diff --git a/server/sql/like.sql b/server/sql/like.sql index e96174dec7b5213270350b52fc34633d448b32dd..74d6fcd316af247cecb6ebfb4e2251d6638fdf5a 100644 --- a/server/sql/like.sql +++ b/server/sql/like.sql @@ -644,7 +644,7 @@ CREATE TABLE `la_system_menu` ( -- Records of la_system_menu -- ---------------------------- BEGIN; -INSERT INTO `la_system_menu` VALUES (4, 0, 'M', '权限管理', 'el-icon-Lock', 400, '', 'permission', '', '', '', 0, 1, 0, 1656664556, 1664354975), (5, 0, 'C', '工作台', 'el-icon-Monitor', 1000, 'workbench/index', 'workbench', 'workbench/index', '', '', 0, 1, 0, 1656664793, 1664354981), (6, 4, 'C', '菜单', 'el-icon-Operation', 1, 'auth.menu/lists', 'menu', 'permission/menu/index', '', '', 1, 1, 0, 1656664960, 1658989504), (7, 4, 'C', '管理员', 'local-icon-shouyiren', 1, 'auth.admin/lists', 'admin', 'permission/admin/index', '', '', 0, 1, 0, 1656901567, 1664355515), (8, 4, 'C', '角色', 'el-icon-Female', 1, 'auth.role/lists', 'role', 'permission/role/index', '', '', 0, 1, 0, 1656901660, 1664355612), (12, 8, 'A', '新增', '', 1, 'auth.role/add', '', '', '', '', 0, 1, 0, 1657001790, 1663750625), (14, 8, 'A', '编辑', '', 1, 'auth.role/edit', '', '', '', '', 0, 1, 0, 1657001924, 1663750631), (15, 8, 'A', '删除', '', 1, 'auth.role/delete', '', '', '', '', 0, 1, 0, 1657001982, 1663750637), (16, 6, 'A', '新增', '', 1, 'auth.menu/add', '', '', '', '', 0, 1, 0, 1657072523, 1663750565), (17, 6, 'A', '编辑', '', 1, 'auth.menu/edit', '', '', '', '', 0, 1, 0, 1657073955, 1663750570), (18, 6, 'A', '删除', '', 1, 'auth.menu/delete', '', '', '', '', 0, 1, 0, 1657073987, 1663750578), (19, 7, 'A', '新增', '', 1, 'auth.admin/add', '', '', '', '', 0, 1, 0, 1657074035, 1663750596), (20, 7, 'A', '编辑', '', 1, 'auth.admin/edit', '', '', '', '', 0, 1, 0, 1657074071, 1663750603), (21, 7, 'A', '删除', '', 1, 'auth.admin/delete', '', '', '', '', 0, 1, 0, 1657074108, 1663750609), (23, 0, 'M', '开发工具', 'el-icon-EditPen', 100, '', 'dev_tools', '', '', '', 0, 1, 0, 1657097744, 1664355057), (24, 23, 'C', '代码生成器', 'el-icon-DocumentAdd', 1, 'tools.generator/generateTable', 'code', 'dev_tools/code/index', '', '', 0, 1, 0, 1657098110, 1658989423), (25, 0, 'M', '组织管理', 'el-icon-OfficeBuilding', 500, '', 'organization', '', '', '', 0, 1, 0, 1657099914, 1664354956), (26, 25, 'C', '部门管理', 'el-icon-Coordinate', 1, 'dept.dept/lists', 'department', 'organization/department/index', '', '', 1, 1, 0, 1657099989, 1664353662), (27, 25, 'C', '岗位管理', 'el-icon-PriceTag', 1, 'dept.jobs/lists', 'post', 'organization/post/index', '', '', 0, 1, 0, 1657100044, 1658989726), (28, 0, 'M', '系统设置', 'el-icon-Setting', 200, '', 'setting', '', '', '', 0, 1, 0, 1657100164, 1664355035), (29, 28, 'M', '网站设置', 'el-icon-Basketball', 1, '', 'website', '', '', '', 0, 1, 0, 1657100230, 1658989861), (30, 29, 'C', '网站信息', '', 1, 'setting.web.web_setting/getWebsite', 'information', 'setting/website/information', '', '', 0, 1, 0, 1657100306, 1657164412), (31, 29, 'C', '网站备案', '', 1, 'setting.web.web_setting/getCopyright', 'filing', 'setting/website/filing', '', '', 0, 1, 0, 1657100434, 1657164723), (32, 29, 'C', '政策协议', '', 1, 'setting.web.web_setting/getAgreement', 'protocol', 'setting/website/protocol', '', '', 0, 1, 0, 1657100571, 1657164770), (33, 28, 'C', '存储设置', 'el-icon-FolderOpened', 1, 'setting.storage/lists', 'storage', 'setting/storage/index', '', '', 0, 1, 0, 1657160959, 1658989894), (34, 23, 'C', '字典管理', 'el-icon-Box', 1, 'setting.dict.dict_type/lists', 'dict', 'setting/dict/type/index', '', '', 0, 1, 0, 1657161211, 1663225935), (35, 28, 'M', '系统维护', 'el-icon-SetUp', 1, '', 'system', '', '', '', 0, 1, 0, 1657161569, 1658989938), (36, 35, 'C', '系统日志', '', 1, 'setting.system.log/lists', 'journal', 'setting/system/journal', '', '', 0, 1, 0, 1657161696, 1657165722), (37, 35, 'C', '系统缓存', '', 1, '', 'cache', 'setting/system/cache', '', '', 0, 1, 0, 1657161896, 1657173767), (38, 35, 'C', '系统环境', '', 1, 'setting.system.system/info', 'environment', 'setting/system/environment', '', '', 0, 1, 0, 1657162000, 1657173794), (39, 24, 'A', '导入数据表', '', 1, 'tools.generator/selectTable', '', '', '', '', 0, 1, 0, 1657162736, 1657162736), (40, 24, 'A', '代码生成', '', 1, 'tools.generator/generate', '', '', '', '', 0, 1, 0, 1657162806, 1657162806), (41, 23, 'C', '编辑数据表', '', 1, 'tools.generator/edit', 'code/edit', 'dev_tools/code/edit', '/dev_tools/code', '', 1, 0, 0, 1657162866, 1663748668), (42, 24, 'A', '同步表结构', '', 1, 'tools.generator/syncColumn', '', '', '', '', 0, 1, 0, 1657162934, 1657162934), (43, 24, 'A', '删除数据表', '', 1, 'tools.generator/delete', '', '', '', '', 0, 1, 0, 1657163015, 1657163015), (44, 24, 'A', '预览代码', '', 1, 'tools.generator/preview', '', '', '', '', 0, 1, 0, 1657163263, 1657163263), (45, 26, 'A', '新增', '', 1, 'dept.dept/add', '', '', '', '', 0, 1, 0, 1657163548, 1663750492), (46, 26, 'A', '编辑', '', 1, 'dept.dept/edit', '', '', '', '', 0, 1, 0, 1657163599, 1663750498), (47, 26, 'A', '删除', '', 1, 'dept.dept/delete', '', '', '', '', 0, 1, 0, 1657163687, 1663750504), (48, 27, 'A', '新增', '', 1, 'dept.jobs/add', '', '', '', '', 0, 1, 0, 1657163778, 1663750524), (49, 27, 'A', '编辑', '', 1, 'dept.jobs/edit', '', '', '', '', 0, 1, 0, 1657163800, 1663750530), (50, 27, 'A', '删除', '', 1, 'dept.jobs/delete', '', '', '', '', 0, 1, 0, 1657163820, 1663750535), (51, 30, 'A', '保存', '', 1, 'setting.web.web_setting/setWebsite', '', '', '', '', 0, 1, 0, 1657164469, 1663750649), (52, 31, 'A', '保存', '', 1, 'setting.web.web_setting/setCopyright', '', '', '', '', 0, 1, 0, 1657164692, 1663750657), (53, 32, 'A', '保存', '', 1, 'setting.web.web_setting/setAgreement', '', '', '', '', 0, 1, 0, 1657164824, 1663750665), (54, 33, 'A', '设置', '', 1, 'setting.storage/setup', '', '', '', '', 0, 1, 0, 1657165303, 1663750673), (55, 34, 'A', '新增', '', 1, 'setting.dict.dict_type/add', '', '', '', '', 0, 1, 0, 1657166966, 1663750783), (56, 34, 'A', '编辑', '', 1, 'setting.dict.dict_type/edit', '', '', '', '', 0, 1, 0, 1657166997, 1663750789), (57, 34, 'A', '删除', '', 1, 'setting.dict.dict_type/delete', '', '', '', '', 0, 1, 0, 1657167038, 1663750796), (58, 62, 'A', '新增', '', 1, 'setting.dict.dict_data/add', '', '', '', '', 0, 1, 0, 1657167317, 1663750758), (59, 62, 'A', '编辑', '', 1, 'setting.dict.dict_data/edit', '', '', '', '', 0, 1, 0, 1657167371, 1663750751), (60, 62, 'A', '删除', '', 1, 'setting.dict.dict_data/delete', '', '', '', '', 0, 1, 0, 1657167397, 1663750768), (61, 37, 'A', '清除系统缓存', '', 1, 'setting.system.cache/clear', '', '', '', '', 0, 1, 0, 1657173837, 1657173939), (62, 23, 'C', '字典数据管理', '', 1, 'setting.dict.dict_data/lists', 'dict/data', 'setting/dict/data/index', '/dev_tools/dict', '', 1, 0, 0, 1657174351, 1663745617), (63, 0, 'M', '素材管理', 'el-icon-Picture', 300, '', 'material', '', '', '', 0, 1, 0, 1657507133, 1664355047), (64, 63, 'C', '素材中心', 'el-icon-PictureRounded', 0, '', 'index', 'material/index', '', '', 0, 1, 0, 1657507296, 1664355653), (66, 26, 'A', '详情', '', 0, 'dept.dept/detail', '', '', '', '', 0, 1, 0, 1663725459, 1663750516), (67, 27, 'A', '详情', '', 0, 'dept.jobs/detail', '', '', '', '', 0, 1, 0, 1663725514, 1663750559), (68, 6, 'A', '详情', '', 0, 'auth.menu/detail', '', '', '', '', 0, 1, 0, 1663725564, 1663750584), (69, 7, 'A', '详情', '', 0, 'auth.admin/detail', '', '', '', '', 0, 1, 0, 1663725623, 1663750615), (70, 0, 'M', '文章资讯', 'el-icon-ChatLineSquare', 900, '', 'article', '', '', '', 0, 1, 0, 1663749965, 1664354597), (71, 70, 'C', '文章管理', 'el-icon-ChatDotSquare', 0, 'article.article/lists', 'lists', 'article/lists/index', '', '', 0, 1, 0, 1663750101, 1664354615), (72, 70, 'C', '文章添加/编辑', '', 0, 'article.article/add:edit', 'lists/edit', 'article/lists/edit', '/article/lists', '', 0, 0, 0, 1663750153, 1664356275), (73, 70, 'C', '文章栏目', 'el-icon-CollectionTag', 0, 'article.articleCate/lists', 'column', 'article/column/index', '', '', 1, 1, 0, 1663750287, 1664354678), (74, 71, 'A', '新增', '', 0, 'article.article/add', '', '', '', '', 0, 1, 0, 1663750335, 1663750335), (75, 71, 'A', '详情', '', 0, 'article.article/detail', '', '', '', '', 0, 1, 0, 1663750354, 1663750383), (76, 71, 'A', '删除', '', 0, 'article.article/delete', '', '', '', '', 0, 1, 0, 1663750413, 1663750413), (77, 71, 'A', '修改状态', '', 0, 'article.article/updateStatus', '', '', '', '', 0, 1, 0, 1663750442, 1663750442), (78, 73, 'A', '添加', '', 0, 'article.articleCate/add', '', '', '', '', 0, 1, 0, 1663750483, 1663750483), (79, 73, 'A', '删除', '', 0, 'article.articleCate/delete', '', '', '', '', 0, 1, 0, 1663750895, 1663750895), (80, 73, 'A', '详情', '', 0, 'article.articleCate/detail', '', '', '', '', 0, 1, 0, 1663750913, 1663750913), (81, 73, 'A', '修改状态', '', 0, 'article.articleCate/updateStatus', '', '', '', '', 0, 1, 0, 1663750936, 1663750936), (82, 0, 'M', '渠道设置', 'el-icon-Message', 600, '', 'channel', '', '', '', 0, 1, 0, 1663754084, 1664354919), (83, 82, 'C', 'h5设置', 'el-icon-Cellphone', 0, 'channel.web_page_setting/getConfig', 'h5', 'channel/h5', '', '', 0, 1, 0, 1663754158, 1663754158), (84, 83, 'A', '保存', '', 0, 'channel.web_page_setting/setConfig', '', '', '', '', 0, 1, 0, 1663754259, 1663754259), (85, 82, 'M', '微信公众号', 'local-icon-dingdan', 0, '', 'wx_oa', '', '', '', 0, 1, 0, 1663755470, 1664355356), (86, 85, 'C', '公众号配置', '', 0, 'channel.official_account_setting/getConfig', 'config', 'channel/wx_oa/config', '', '', 0, 1, 0, 1663755663, 1664355450), (87, 85, 'C', '菜单管理', '', 0, 'channel.official_account_menu/detail', 'menu', 'channel/wx_oa/menu', '', '', 0, 1, 0, 1663755767, 1664355456), (88, 86, 'A', '保存', '', 0, 'channel.official_account_setting/setConfig', '', '', '', '', 0, 1, 0, 1663755799, 1663755799), (89, 86, 'A', '保存并发布', '', 0, 'channel.official_account_menu/save', '', '', '', '', 0, 1, 0, 1663756490, 1663756490), (90, 85, 'C', '关注回复', '', 0, 'channel.official_account_reply/lists', 'follow', 'channel/wx_oa/reply/follow_reply', '', '', 0, 1, 0, 1663818358, 1663818366), (91, 85, 'C', '关键字回复', '', 0, '', 'keyword', 'channel/wx_oa/reply/keyword_reply', '', '', 0, 1, 0, 1663818445, 1663818445), (93, 85, 'C', '默认回复', '', 0, '', 'default', 'channel/wx_oa/reply/default_reply', '', '', 0, 1, 0, 1663818580, 1663818580), (94, 82, 'C', '微信小程序', 'local-icon-weixin', 0, 'channel.mnp_settings/getConfig', 'weapp', 'channel/weapp', '', '', 0, 1, 0, 1663831396, 1664355388), (95, 94, 'A', '保存', '', 0, 'channel.mnp_settings/setConfig', '', '', '', '', 0, 1, 0, 1663831436, 1663831436), (96, 0, 'M', '装修管理', 'el-icon-Brush', 700, '', 'decoration', '', '', '', 0, 1, 0, 1663834825, 1664354863), (97, 96, 'C', '页面装修', 'el-icon-CopyDocument', 0, 'decorate.page/detail', 'pages', 'decoration/pages/index', '', '', 0, 1, 0, 1663834879, 1664355183), (98, 97, 'A', '保存', '', 0, 'decorate.page/save', '', '', '', '', 0, 1, 0, 1663834956, 1663834956), (99, 96, 'C', '底部导航', 'el-icon-Position', 0, 'decorate.tabbar/detail', 'tabbar', 'decoration/tabbar', '', '', 0, 1, 0, 1663835004, 1664355253), (100, 99, 'A', '保存', '', 0, 'decorate.tabbar/save', '', '', '', '', 0, 1, 0, 1663835018, 1663835018), (101, 158, 'M', '消息管理', 'el-icon-ChatDotRound', 0, '', 'message', '', '', '', 0, 1, 0, 1663838602, 1677143459), (102, 101, 'C', '通知设置', '', 0, 'notice.notice/settingLists', 'notice', 'message/notice/index', '', '', 0, 1, 0, 1663839195, 1663839195), (103, 102, 'A', '详情', '', 0, 'notice.notice/detail', '', '', '', '', 0, 1, 0, 1663839537, 1663839537), (104, 101, 'C', '通知设置编辑', '', 0, 'notice.notice/set', 'notice/edit', 'message/notice/edit', '/message/notice', '', 0, 0, 0, 1663839873, 1663898477), (105, 71, 'A', '编辑', '', 0, 'article.article/edit', '', '', '', '', 0, 1, 0, 1663840043, 1663840053), (106, 71, 'A', '详情', '', 0, 'article.article/detail', '', '', '', '', 0, 1, 0, 1663840284, 1663840494), (107, 101, 'C', '短信设置', '', 0, 'notice.sms_config/getConfig', 'short_letter', 'message/short_letter/index', '', '', 0, 1, 0, 1663898591, 1664355708), (108, 107, 'A', '设置', '', 0, 'notice.sms_config/setConfig', '', '', '', '', 0, 1, 0, 1663898644, 1663898644), (109, 107, 'A', '详情', '', 0, 'notice.sms_config/detail', '', '', '', '', 0, 1, 0, 1663898661, 1663898661), (110, 28, 'C', '热门搜索', 'el-icon-Search', 0, 'setting.hot_search/getConfig', 'search', 'setting/search/index', '', '', 0, 1, 0, 1663901821, 1664355779), (111, 110, 'A', '保存', '', 0, 'setting.hot_search/setConfig', '', '', '', '', 0, 1, 0, 1663901856, 1663901856), (112, 28, 'M', '用户设置', 'local-icon-keziyuyue', 0, '', 'user', '', '', '', 0, 1, 0, 1663903302, 1664355695), (113, 112, 'C', '用户设置', '', 0, 'setting.user.user/getConfig', 'setup', 'setting/user/setup', '', '', 0, 1, 0, 1663903506, 1663903506), (114, 113, 'A', '保存', '', 0, 'setting.user.user/setConfig', '', '', '', '', 0, 1, 0, 1663903522, 1663903522), (115, 112, 'C', '登录注册', '', 0, 'setting.user.user/getRegisterConfig', 'login_register', 'setting/user/login_register', '', '', 0, 1, 0, 1663903832, 1663903832), (116, 115, 'A', '保存', '', 0, 'setting.user.user/setRegisterConfig', '', '', '', '', 0, 1, 0, 1663903852, 1663903852), (117, 0, 'M', '用户管理', 'el-icon-User', 800, '', 'consumer', '', '', '', 0, 1, 0, 1663904351, 1664354732), (118, 117, 'C', '用户列表', 'local-icon-user_guanli', 0, 'user.user/lists', 'lists', 'consumer/lists/index', '', '', 0, 1, 0, 1663904392, 1664355092), (119, 117, 'C', '用户详情', '', 0, 'user.user/detail', 'lists/detail', 'consumer/lists/detail', '/consumer/lists', '', 0, 0, 0, 1663904470, 1663928109), (120, 119, 'A', '编辑', '', 0, 'user.user/edit', '', '', '', '', 0, 1, 0, 1663904499, 1663904499), (140, 82, 'C', '微信开发平台', 'local-icon-notice_buyer', 0, 'channel.open_setting/getConfig', 'open_setting', 'channel/open_setting', '', '', 0, 1, 0, 1666085713, 1666085713), (141, 140, 'A', '保存', '', 0, 'channel.open_setting/setConfig', '', '', '', '', 0, 1, 0, 1666085751, 1666085776), (142, 96, 'C', 'PC端', 'el-icon-Monitor', 0, '', 'pc', 'decoration/pc', '', '', 0, 1, 0, 1668423284, 1668423284), (143, 35, 'C', '定时任务', '', 0, 'crontab.crontab/lists', 'scheduled_task', 'setting/system/scheduled_task/index', '', '', 0, 1, 0, 1669357509, 1669357711), (144, 35, 'C', '定时任务添加/编辑', '', 0, 'crontab.crontab/add:edit', 'scheduled_task/edit', 'setting/system/scheduled_task/edit', '/setting/system/scheduled_task', '', 0, 0, 0, 1669357670, 1669357765), (145, 143, 'A', '添加', '', 0, 'crontab.crontab/add', '', '', '', '', 0, 1, 0, 1669358282, 1669358282), (146, 143, 'A', '编辑', '', 0, 'crontab.crontab/edit', '', '', '', '', 0, 1, 0, 1669358303, 1669358303), (147, 143, 'A', '删除', '', 0, 'crontab.crontab/delete', '', '', '', '', 0, 1, 0, 1669358334, 1669358334), (148, 0, 'M', '模板示例', 'el-icon-SetUp', 0, '', 'template', '', '', '', 0, 1, 0, 1670206819, 1677842041), (149, 148, 'M', '组件示例', 'el-icon-Coin', 0, '', 'component', '', '', '', 0, 1, 0, 1670207182, 1670207244), (150, 149, 'C', '富文本', '', 0, '', 'rich_text', 'template/component/rich_text', '', '', 0, 1, 0, 1670207751, 1670207751), (151, 149, 'C', '上传文件', '', 0, '', 'upload', 'template/component/upload', '', '', 0, 1, 0, 1670208925, 1670208925), (152, 149, 'C', '图标', '', 0, '', 'icon', 'template/component/icon', '', '', 0, 1, 0, 1670230069, 1670230069), (153, 149, 'C', '文件选择器', '', 0, '', 'file', 'template/component/file', '', '', 0, 1, 0, 1670232129, 1670232129), (154, 149, 'C', '链接选择器', '', 0, '', 'link', 'template/component/link', '', '', 0, 1, 0, 1670292636, 1670292636), (155, 149, 'C', '超出自动打点', '', 0, '', 'overflow', 'template/component/overflow', '', '', 0, 1, 0, 1670292883, 1670292883), (156, 149, 'C', '悬浮input', '', 0, '', 'popover_input', 'template/component/popover_input', '', '', 0, 1, 0, 1670293336, 1670293336), (157, 119, 'A', '余额调整', '', 0, 'user.user/adjustMoney', '', '', '', '', 0, 1, 0, 1677143088, 1677143088), (158, 0, 'M', '应用管理', 'el-icon-Postcard', 750, '', 'app', '', '', '', 0, 1, 0, 1677143430, 1677842080), (159, 158, 'C', '用户充值', 'local-icon-fukuan', 0, 'recharge.recharge/getConfig', 'recharge', 'app/recharge/index', '', '', 0, 1, 0, 1677144284, 1677144316), (160, 159, 'A', '保存', '', 0, 'recharge.recharge/setConfig', '', '', '', '', 0, 1, 0, 1677145012, 1677145012), (161, 28, 'M', '支付设置', 'local-icon-set_pay', 0, '', 'pay', '', '', '', 0, 1, 0, 1677148075, 1677148075), (162, 161, 'C', '支付方式', '', 0, 'setting.pay.pay_way/getPayWay', 'method', 'setting/pay/method/index', '', '', 0, 1, 0, 1677148207, 1677148207), (163, 161, 'C', '支付配置', '', 0, 'setting.pay.pay_config/lists', 'config', 'setting/pay/config/index', '', '', 0, 1, 0, 1677148260, 1677148374), (164, 162, 'A', '设置支付方式', '', 0, 'setting.pay.pay_way/setPayWay', '', '', '', '', 0, 1, 0, 1677219624, 1677219624), (165, 163, 'A', '配置', '', 0, 'setting.pay.pay_config/setConfig', '', '', '', '', 0, 1, 0, 1677219655, 1677219655), (166, 0, 'M', '财务管理', 'local-icon-user_gaikuang', 650, '', 'finance', '', '', '', 0, 1, 0, 1677552269, 1677842158), (167, 166, 'C', '充值记录', 'el-icon-Wallet', 0, 'recharge.recharge/lists', 'recharge_record', 'finance/recharge_record', '', '', 0, 1, 0, 1677552757, 1677552777), (168, 166, 'C', '余额明细', 'local-icon-qianbao', 0, 'finance.account_log/lists', 'balance_details', 'finance/balance_details', '', '', 0, 1, 0, 1677552976, 1677553003), (169, 167, 'A', '退款', '', 0, 'recharge.recharge/refund', '', '', '', '', 0, 1, 0, 1677809715, 1677809715), (170, 166, 'C', '退款记录', 'local-icon-heshoujilu', 0, 'finance.refund/record', 'refund_record', 'finance/refund_record', '', '', 0, 1, 0, 1677811271, 1677811271), (171, 170, 'A', '重新退款', '', 0, 'recharge.recharge/refundAgain', '', '', '', '', 0, 1, 0, 1677811295, 1677811295), (172, 170, 'A', '退款日志', '', 0, 'finance.refund/log', '', '', '', '', 0, 1, 0, 1677811361, 1677811361); +INSERT INTO `la_system_menu` VALUES (4, 0, 'M', '权限管理', 'el-icon-Lock', 400, '', 'permission', '', '', '', 0, 1, 0, 1656664556, 1664354975), (5, 0, 'C', '工作台', 'el-icon-Monitor', 1000, 'workbench/index', 'workbench', 'workbench/index', '', '', 0, 1, 0, 1656664793, 1664354981), (6, 4, 'C', '菜单', 'el-icon-Operation', 1, 'auth.menu/lists', 'menu', 'permission/menu/index', '', '', 1, 1, 0, 1656664960, 1658989504), (7, 4, 'C', '管理员', 'local-icon-shouyiren', 1, 'auth.admin/lists', 'admin', 'permission/admin/index', '', '', 0, 1, 0, 1656901567, 1664355515), (8, 4, 'C', '角色', 'el-icon-Female', 1, 'auth.role/lists', 'role', 'permission/role/index', '', '', 0, 1, 0, 1656901660, 1664355612), (12, 8, 'A', '新增', '', 1, 'auth.role/add', '', '', '', '', 0, 1, 0, 1657001790, 1663750625), (14, 8, 'A', '编辑', '', 1, 'auth.role/edit', '', '', '', '', 0, 1, 0, 1657001924, 1663750631), (15, 8, 'A', '删除', '', 1, 'auth.role/delete', '', '', '', '', 0, 1, 0, 1657001982, 1663750637), (16, 6, 'A', '新增', '', 1, 'auth.menu/add', '', '', '', '', 0, 1, 0, 1657072523, 1663750565), (17, 6, 'A', '编辑', '', 1, 'auth.menu/edit', '', '', '', '', 0, 1, 0, 1657073955, 1663750570), (18, 6, 'A', '删除', '', 1, 'auth.menu/delete', '', '', '', '', 0, 1, 0, 1657073987, 1663750578), (19, 7, 'A', '新增', '', 1, 'auth.admin/add', '', '', '', '', 0, 1, 0, 1657074035, 1663750596), (20, 7, 'A', '编辑', '', 1, 'auth.admin/edit', '', '', '', '', 0, 1, 0, 1657074071, 1663750603), (21, 7, 'A', '删除', '', 1, 'auth.admin/delete', '', '', '', '', 0, 1, 0, 1657074108, 1663750609), (23, 0, 'M', '开发工具', 'el-icon-EditPen', 100, '', 'dev_tools', '', '', '', 0, 1, 0, 1657097744, 1664355057), (24, 23, 'C', '代码生成器', 'el-icon-DocumentAdd', 1, 'tools.generator/generateTable', 'code', 'dev_tools/code/index', '', '', 0, 1, 0, 1657098110, 1658989423), (25, 0, 'M', '组织管理', 'el-icon-OfficeBuilding', 500, '', 'organization', '', '', '', 0, 1, 0, 1657099914, 1664354956), (26, 25, 'C', '部门管理', 'el-icon-Coordinate', 1, 'dept.dept/lists', 'department', 'organization/department/index', '', '', 1, 1, 0, 1657099989, 1664353662), (27, 25, 'C', '岗位管理', 'el-icon-PriceTag', 1, 'dept.jobs/lists', 'post', 'organization/post/index', '', '', 0, 1, 0, 1657100044, 1658989726), (28, 0, 'M', '系统设置', 'el-icon-Setting', 200, '', 'setting', '', '', '', 0, 1, 0, 1657100164, 1664355035), (29, 28, 'M', '网站设置', 'el-icon-Basketball', 1, '', 'website', '', '', '', 0, 1, 0, 1657100230, 1658989861), (30, 29, 'C', '网站信息', '', 1, 'setting.web.web_setting/getWebsite', 'information', 'setting/website/information', '', '', 0, 1, 0, 1657100306, 1657164412), (31, 29, 'C', '网站备案', '', 1, 'setting.web.web_setting/getCopyright', 'filing', 'setting/website/filing', '', '', 0, 1, 0, 1657100434, 1657164723), (32, 29, 'C', '政策协议', '', 1, 'setting.web.web_setting/getAgreement', 'protocol', 'setting/website/protocol', '', '', 0, 1, 0, 1657100571, 1657164770), (33, 28, 'C', '存储设置', 'el-icon-FolderOpened', 1, 'setting.storage/lists', 'storage', 'setting/storage/index', '', '', 0, 1, 0, 1657160959, 1658989894), (34, 23, 'C', '字典管理', 'el-icon-Box', 1, 'setting.dict.dict_type/lists', 'dict', 'setting/dict/type/index', '', '', 0, 1, 0, 1657161211, 1663225935), (35, 28, 'M', '系统维护', 'el-icon-SetUp', 1, '', 'system', '', '', '', 0, 1, 0, 1657161569, 1658989938), (36, 35, 'C', '系统日志', '', 1, 'setting.system.log/lists', 'journal', 'setting/system/journal', '', '', 0, 1, 0, 1657161696, 1657165722), (37, 35, 'C', '系统缓存', '', 1, '', 'cache', 'setting/system/cache', '', '', 0, 1, 0, 1657161896, 1657173767), (38, 35, 'C', '系统环境', '', 1, 'setting.system.system/info', 'environment', 'setting/system/environment', '', '', 0, 1, 0, 1657162000, 1657173794), (39, 24, 'A', '导入数据表', '', 1, 'tools.generator/selectTable', '', '', '', '', 0, 1, 0, 1657162736, 1657162736), (40, 24, 'A', '代码生成', '', 1, 'tools.generator/generate', '', '', '', '', 0, 1, 0, 1657162806, 1657162806), (41, 23, 'C', '编辑数据表', '', 1, 'tools.generator/edit', 'code/edit', 'dev_tools/code/edit', '/dev_tools/code', '', 1, 0, 0, 1657162866, 1663748668), (42, 24, 'A', '同步表结构', '', 1, 'tools.generator/syncColumn', '', '', '', '', 0, 1, 0, 1657162934, 1657162934), (43, 24, 'A', '删除数据表', '', 1, 'tools.generator/delete', '', '', '', '', 0, 1, 0, 1657163015, 1657163015), (44, 24, 'A', '预览代码', '', 1, 'tools.generator/preview', '', '', '', '', 0, 1, 0, 1657163263, 1657163263), (45, 26, 'A', '新增', '', 1, 'dept.dept/add', '', '', '', '', 0, 1, 0, 1657163548, 1663750492), (46, 26, 'A', '编辑', '', 1, 'dept.dept/edit', '', '', '', '', 0, 1, 0, 1657163599, 1663750498), (47, 26, 'A', '删除', '', 1, 'dept.dept/delete', '', '', '', '', 0, 1, 0, 1657163687, 1663750504), (48, 27, 'A', '新增', '', 1, 'dept.jobs/add', '', '', '', '', 0, 1, 0, 1657163778, 1663750524), (49, 27, 'A', '编辑', '', 1, 'dept.jobs/edit', '', '', '', '', 0, 1, 0, 1657163800, 1663750530), (50, 27, 'A', '删除', '', 1, 'dept.jobs/delete', '', '', '', '', 0, 1, 0, 1657163820, 1663750535), (51, 30, 'A', '保存', '', 1, 'setting.web.web_setting/setWebsite', '', '', '', '', 0, 1, 0, 1657164469, 1663750649), (52, 31, 'A', '保存', '', 1, 'setting.web.web_setting/setCopyright', '', '', '', '', 0, 1, 0, 1657164692, 1663750657), (53, 32, 'A', '保存', '', 1, 'setting.web.web_setting/setAgreement', '', '', '', '', 0, 1, 0, 1657164824, 1663750665), (54, 33, 'A', '设置', '', 1, 'setting.storage/setup', '', '', '', '', 0, 1, 0, 1657165303, 1663750673), (55, 34, 'A', '新增', '', 1, 'setting.dict.dict_type/add', '', '', '', '', 0, 1, 0, 1657166966, 1663750783), (56, 34, 'A', '编辑', '', 1, 'setting.dict.dict_type/edit', '', '', '', '', 0, 1, 0, 1657166997, 1663750789), (57, 34, 'A', '删除', '', 1, 'setting.dict.dict_type/delete', '', '', '', '', 0, 1, 0, 1657167038, 1663750796), (58, 62, 'A', '新增', '', 1, 'setting.dict.dict_data/add', '', '', '', '', 0, 1, 0, 1657167317, 1663750758), (59, 62, 'A', '编辑', '', 1, 'setting.dict.dict_data/edit', '', '', '', '', 0, 1, 0, 1657167371, 1663750751), (60, 62, 'A', '删除', '', 1, 'setting.dict.dict_data/delete', '', '', '', '', 0, 1, 0, 1657167397, 1663750768), (61, 37, 'A', '清除系统缓存', '', 1, 'setting.system.cache/clear', '', '', '', '', 0, 1, 0, 1657173837, 1657173939), (62, 23, 'C', '字典数据管理', '', 1, 'setting.dict.dict_data/lists', 'dict/data', 'setting/dict/data/index', '/dev_tools/dict', '', 1, 0, 0, 1657174351, 1663745617), (63, 0, 'M', '素材管理', 'el-icon-Picture', 300, '', 'material', '', '', '', 0, 1, 0, 1657507133, 1664355047), (64, 63, 'C', '素材中心', 'el-icon-PictureRounded', 0, '', 'index', 'material/index', '', '', 0, 1, 0, 1657507296, 1664355653), (66, 26, 'A', '详情', '', 0, 'dept.dept/detail', '', '', '', '', 0, 1, 0, 1663725459, 1663750516), (67, 27, 'A', '详情', '', 0, 'dept.jobs/detail', '', '', '', '', 0, 1, 0, 1663725514, 1663750559), (68, 6, 'A', '详情', '', 0, 'auth.menu/detail', '', '', '', '', 0, 1, 0, 1663725564, 1663750584), (69, 7, 'A', '详情', '', 0, 'auth.admin/detail', '', '', '', '', 0, 1, 0, 1663725623, 1663750615), (70, 0, 'M', '文章资讯', 'el-icon-ChatLineSquare', 900, '', 'article', '', '', '', 0, 1, 0, 1663749965, 1664354597), (71, 70, 'C', '文章管理', 'el-icon-ChatDotSquare', 0, 'article.article/lists', 'lists', 'article/lists/index', '', '', 0, 1, 0, 1663750101, 1664354615), (72, 70, 'C', '文章添加/编辑', '', 0, 'article.article/add:edit', 'lists/edit', 'article/lists/edit', '/article/lists', '', 0, 0, 0, 1663750153, 1664356275), (73, 70, 'C', '文章栏目', 'el-icon-CollectionTag', 0, 'article.articleCate/lists', 'column', 'article/column/index', '', '', 1, 1, 0, 1663750287, 1664354678), (74, 71, 'A', '新增', '', 0, 'article.article/add', '', '', '', '', 0, 1, 0, 1663750335, 1663750335), (75, 71, 'A', '详情', '', 0, 'article.article/detail', '', '', '', '', 0, 1, 0, 1663750354, 1663750383), (76, 71, 'A', '删除', '', 0, 'article.article/delete', '', '', '', '', 0, 1, 0, 1663750413, 1663750413), (77, 71, 'A', '修改状态', '', 0, 'article.article/updateStatus', '', '', '', '', 0, 1, 0, 1663750442, 1663750442), (78, 73, 'A', '添加', '', 0, 'article.articleCate/add', '', '', '', '', 0, 1, 0, 1663750483, 1663750483), (79, 73, 'A', '删除', '', 0, 'article.articleCate/delete', '', '', '', '', 0, 1, 0, 1663750895, 1663750895), (80, 73, 'A', '详情', '', 0, 'article.articleCate/detail', '', '', '', '', 0, 1, 0, 1663750913, 1663750913), (81, 73, 'A', '修改状态', '', 0, 'article.articleCate/updateStatus', '', '', '', '', 0, 1, 0, 1663750936, 1663750936), (82, 0, 'M', '渠道设置', 'el-icon-Message', 600, '', 'channel', '', '', '', 0, 1, 0, 1663754084, 1664354919), (83, 82, 'C', 'h5设置', 'el-icon-Cellphone', 0, 'channel.web_page_setting/getConfig', 'h5', 'channel/h5', '', '', 0, 1, 0, 1663754158, 1663754158), (84, 83, 'A', '保存', '', 0, 'channel.web_page_setting/setConfig', '', '', '', '', 0, 1, 0, 1663754259, 1663754259), (85, 82, 'M', '微信公众号', 'local-icon-dingdan', 0, '', 'wx_oa', '', '', '', 0, 1, 0, 1663755470, 1664355356), (86, 85, 'C', '公众号配置', '', 0, 'channel.official_account_setting/getConfig', 'config', 'channel/wx_oa/config', '', '', 0, 1, 0, 1663755663, 1664355450), (87, 85, 'C', '菜单管理', '', 0, 'channel.official_account_menu/detail', 'menu', 'channel/wx_oa/menu', '', '', 0, 1, 0, 1663755767, 1664355456), (88, 86, 'A', '保存', '', 0, 'channel.official_account_setting/setConfig', '', '', '', '', 0, 1, 0, 1663755799, 1663755799), (89, 86, 'A', '保存并发布', '', 0, 'channel.official_account_menu/save', '', '', '', '', 0, 1, 0, 1663756490, 1663756490), (90, 85, 'C', '关注回复', '', 0, 'channel.official_account_reply/lists', 'follow', 'channel/wx_oa/reply/follow_reply', '', '', 0, 1, 0, 1663818358, 1663818366), (91, 85, 'C', '关键字回复', '', 0, '', 'keyword', 'channel/wx_oa/reply/keyword_reply', '', '', 0, 1, 0, 1663818445, 1663818445), (93, 85, 'C', '默认回复', '', 0, '', 'default', 'channel/wx_oa/reply/default_reply', '', '', 0, 1, 0, 1663818580, 1663818580), (94, 82, 'C', '微信小程序', 'local-icon-weixin', 0, 'channel.mnp_settings/getConfig', 'weapp', 'channel/weapp', '', '', 0, 1, 0, 1663831396, 1664355388), (95, 94, 'A', '保存', '', 0, 'channel.mnp_settings/setConfig', '', '', '', '', 0, 1, 0, 1663831436, 1663831436), (96, 0, 'M', '装修管理', 'el-icon-Brush', 700, '', 'decoration', '', '', '', 0, 1, 0, 1663834825, 1664354863), (97, 96, 'C', '页面装修', 'el-icon-CopyDocument', 0, 'decorate.page/detail', 'pages', 'decoration/pages/index', '', '', 0, 1, 0, 1663834879, 1664355183), (98, 97, 'A', '保存', '', 0, 'decorate.page/save', '', '', '', '', 0, 1, 0, 1663834956, 1663834956), (99, 96, 'C', '底部导航', 'el-icon-Position', 0, 'decorate.tabbar/detail', 'tabbar', 'decoration/tabbar', '', '', 0, 1, 0, 1663835004, 1664355253), (100, 99, 'A', '保存', '', 0, 'decorate.tabbar/save', '', '', '', '', 0, 1, 0, 1663835018, 1663835018), (101, 158, 'M', '消息管理', 'el-icon-ChatDotRound', 0, '', 'message', '', '', '', 0, 1, 0, 1663838602, 1677143459), (102, 101, 'C', '通知设置', '', 0, 'notice.notice/settingLists', 'notice', 'message/notice/index', '', '', 0, 1, 0, 1663839195, 1663839195), (103, 102, 'A', '详情', '', 0, 'notice.notice/detail', '', '', '', '', 0, 1, 0, 1663839537, 1663839537), (104, 101, 'C', '通知设置编辑', '', 0, 'notice.notice/set', 'notice/edit', 'message/notice/edit', '/message/notice', '', 0, 0, 0, 1663839873, 1663898477), (105, 71, 'A', '编辑', '', 0, 'article.article/edit', '', '', '', '', 0, 1, 0, 1663840043, 1663840053), (106, 71, 'A', '详情', '', 0, 'article.article/detail', '', '', '', '', 0, 1, 0, 1663840284, 1663840494), (107, 101, 'C', '短信设置', '', 0, 'notice.sms_config/getConfig', 'short_letter', 'message/short_letter/index', '', '', 0, 1, 0, 1663898591, 1664355708), (108, 107, 'A', '设置', '', 0, 'notice.sms_config/setConfig', '', '', '', '', 0, 1, 0, 1663898644, 1663898644), (109, 107, 'A', '详情', '', 0, 'notice.sms_config/detail', '', '', '', '', 0, 1, 0, 1663898661, 1663898661), (110, 28, 'C', '热门搜索', 'el-icon-Search', 0, 'setting.hot_search/getConfig', 'search', 'setting/search/index', '', '', 0, 1, 0, 1663901821, 1664355779), (111, 110, 'A', '保存', '', 0, 'setting.hot_search/setConfig', '', '', '', '', 0, 1, 0, 1663901856, 1663901856), (112, 28, 'M', '用户设置', 'local-icon-keziyuyue', 0, '', 'user', '', '', '', 0, 1, 0, 1663903302, 1664355695), (113, 112, 'C', '用户设置', '', 0, 'setting.user.user/getConfig', 'setup', 'setting/user/setup', '', '', 0, 1, 0, 1663903506, 1663903506), (114, 113, 'A', '保存', '', 0, 'setting.user.user/setConfig', '', '', '', '', 0, 1, 0, 1663903522, 1663903522), (115, 112, 'C', '登录注册', '', 0, 'setting.user.user/getRegisterConfig', 'login_register', 'setting/user/login_register', '', '', 0, 1, 0, 1663903832, 1663903832), (116, 115, 'A', '保存', '', 0, 'setting.user.user/setRegisterConfig', '', '', '', '', 0, 1, 0, 1663903852, 1663903852), (117, 0, 'M', '用户管理', 'el-icon-User', 800, '', 'consumer', '', '', '', 0, 1, 0, 1663904351, 1664354732), (118, 117, 'C', '用户列表', 'local-icon-user_guanli', 0, 'user.user/lists', 'lists', 'consumer/lists/index', '', '', 0, 1, 0, 1663904392, 1664355092), (119, 117, 'C', '用户详情', '', 0, 'user.user/detail', 'lists/detail', 'consumer/lists/detail', '/consumer/lists', '', 0, 0, 0, 1663904470, 1663928109), (120, 119, 'A', '编辑', '', 0, 'user.user/edit', '', '', '', '', 0, 1, 0, 1663904499, 1663904499), (140, 82, 'C', '微信开发平台', 'local-icon-notice_buyer', 0, 'channel.open_setting/getConfig', 'open_setting', 'channel/open_setting', '', '', 0, 1, 0, 1666085713, 1666085713), (141, 140, 'A', '保存', '', 0, 'channel.open_setting/setConfig', '', '', '', '', 0, 1, 0, 1666085751, 1666085776), (142, 96, 'C', 'PC端', 'el-icon-Monitor', 0, '', 'pc', 'decoration/pc', '', '', 0, 1, 0, 1668423284, 1668423284), (143, 35, 'C', '定时任务', '', 0, 'crontab.crontab/lists', 'scheduled_task', 'setting/system/scheduled_task/index', '', '', 0, 0, 1, 1669357509, 1669357711), (144, 35, 'C', '定时任务添加/编辑', '', 0, 'crontab.crontab/add:edit', 'scheduled_task/edit', 'setting/system/scheduled_task/edit', '/setting/system/scheduled_task', '', 0, 0, 0, 1669357670, 1669357765), (145, 143, 'A', '添加', '', 0, 'crontab.crontab/add', '', '', '', '', 0, 1, 0, 1669358282, 1669358282), (146, 143, 'A', '编辑', '', 0, 'crontab.crontab/edit', '', '', '', '', 0, 1, 0, 1669358303, 1669358303), (147, 143, 'A', '删除', '', 0, 'crontab.crontab/delete', '', '', '', '', 0, 1, 0, 1669358334, 1669358334), (148, 0, 'M', '模板示例', 'el-icon-SetUp', 0, '', 'template', '', '', '', 0, 1, 0, 1670206819, 1677842041), (149, 148, 'M', '组件示例', 'el-icon-Coin', 0, '', 'component', '', '', '', 0, 1, 0, 1670207182, 1670207244), (150, 149, 'C', '富文本', '', 0, '', 'rich_text', 'template/component/rich_text', '', '', 0, 1, 0, 1670207751, 1670207751), (151, 149, 'C', '上传文件', '', 0, '', 'upload', 'template/component/upload', '', '', 0, 1, 0, 1670208925, 1670208925), (152, 149, 'C', '图标', '', 0, '', 'icon', 'template/component/icon', '', '', 0, 1, 0, 1670230069, 1670230069), (153, 149, 'C', '文件选择器', '', 0, '', 'file', 'template/component/file', '', '', 0, 1, 0, 1670232129, 1670232129), (154, 149, 'C', '链接选择器', '', 0, '', 'link', 'template/component/link', '', '', 0, 1, 0, 1670292636, 1670292636), (155, 149, 'C', '超出自动打点', '', 0, '', 'overflow', 'template/component/overflow', '', '', 0, 1, 0, 1670292883, 1670292883), (156, 149, 'C', '悬浮input', '', 0, '', 'popover_input', 'template/component/popover_input', '', '', 0, 1, 0, 1670293336, 1670293336), (157, 119, 'A', '余额调整', '', 0, 'user.user/adjustMoney', '', '', '', '', 0, 1, 0, 1677143088, 1677143088), (158, 0, 'M', '应用管理', 'el-icon-Postcard', 750, '', 'app', '', '', '', 0, 1, 0, 1677143430, 1677842080), (159, 158, 'C', '用户充值', 'local-icon-fukuan', 0, 'recharge.recharge/getConfig', 'recharge', 'app/recharge/index', '', '', 0, 1, 0, 1677144284, 1677144316), (160, 159, 'A', '保存', '', 0, 'recharge.recharge/setConfig', '', '', '', '', 0, 1, 0, 1677145012, 1677145012), (161, 28, 'M', '支付设置', 'local-icon-set_pay', 0, '', 'pay', '', '', '', 0, 1, 0, 1677148075, 1677148075), (162, 161, 'C', '支付方式', '', 0, 'setting.pay.pay_way/getPayWay', 'method', 'setting/pay/method/index', '', '', 0, 1, 0, 1677148207, 1677148207), (163, 161, 'C', '支付配置', '', 0, 'setting.pay.pay_config/lists', 'config', 'setting/pay/config/index', '', '', 0, 1, 0, 1677148260, 1677148374), (164, 162, 'A', '设置支付方式', '', 0, 'setting.pay.pay_way/setPayWay', '', '', '', '', 0, 1, 0, 1677219624, 1677219624), (165, 163, 'A', '配置', '', 0, 'setting.pay.pay_config/setConfig', '', '', '', '', 0, 1, 0, 1677219655, 1677219655), (166, 0, 'M', '财务管理', 'local-icon-user_gaikuang', 650, '', 'finance', '', '', '', 0, 1, 0, 1677552269, 1677842158), (167, 166, 'C', '充值记录', 'el-icon-Wallet', 0, 'recharge.recharge/lists', 'recharge_record', 'finance/recharge_record', '', '', 0, 1, 0, 1677552757, 1677552777), (168, 166, 'C', '余额明细', 'local-icon-qianbao', 0, 'finance.account_log/lists', 'balance_details', 'finance/balance_details', '', '', 0, 1, 0, 1677552976, 1677553003), (169, 167, 'A', '退款', '', 0, 'recharge.recharge/refund', '', '', '', '', 0, 1, 0, 1677809715, 1677809715), (170, 166, 'C', '退款记录', 'local-icon-heshoujilu', 0, 'finance.refund/record', 'refund_record', 'finance/refund_record', '', '', 0, 1, 0, 1677811271, 1677811271), (171, 170, 'A', '重新退款', '', 0, 'recharge.recharge/refundAgain', '', '', '', '', 0, 1, 0, 1677811295, 1677811295), (172, 170, 'A', '退款日志', '', 0, 'finance.refund/log', '', '', '', '', 0, 1, 0, 1677811361, 1677811361); COMMIT; -- ----------------------------