From 11ea5a25e84bb85d7584f8cb0f75d7624098df9b Mon Sep 17 00:00:00 2001 From: suyi Date: Sat, 16 Nov 2024 16:51:33 +0800 Subject: [PATCH 01/18] =?UTF-8?q?=E8=AF=B7=E6=B1=82=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E6=94=B9=E6=B3=A8=E5=85=A5=E6=96=B9=E5=BC=8F,=E4=B8=8D?= =?UTF-8?q?=E6=94=BE=E7=BD=AE=E5=88=B0=E5=88=9D=E5=A7=8B=E5=8C=96=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/BaseController.php | 51 ++++++++++--------- .../controller/BaseAdminController.php | 8 +-- .../app/api/controller/BaseApiController.php | 4 -- .../common/http/middleware/EndMiddleware.php | 1 + server/app/common/service/sms/SmsDriver.php | 2 +- 5 files changed, 30 insertions(+), 36 deletions(-) diff --git a/server/app/BaseController.php b/server/app/BaseController.php index 4dbc18a..eda2d89 100644 --- a/server/app/BaseController.php +++ b/server/app/BaseController.php @@ -1,8 +1,10 @@ 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 +69,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 +89,4 @@ abstract class BaseController return $v->failException(true)->check($data); } - - } diff --git a/server/app/adminapi/controller/BaseAdminController.php b/server/app/adminapi/controller/BaseAdminController.php index 40df4b3..d2b043b 100644 --- a/server/app/adminapi/controller/BaseAdminController.php +++ b/server/app/adminapi/controller/BaseAdminController.php @@ -11,13 +11,9 @@ 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 { $this->adminId = $adminId; diff --git a/server/app/api/controller/BaseApiController.php b/server/app/api/controller/BaseApiController.php index b2e5cfb..52f4d74 100644 --- a/server/app/api/controller/BaseApiController.php +++ b/server/app/api/controller/BaseApiController.php @@ -21,10 +21,6 @@ class BaseApiController extends BaseLikeAdminController protected int $userId = 0; protected array $userInfo = []; - public function initialize() - { - parent::initialize(); - } public function setUser($userId,$userInfo): void { $this->userId = $userId; diff --git a/server/app/common/http/middleware/EndMiddleware.php b/server/app/common/http/middleware/EndMiddleware.php index e78c747..63c0d3e 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/service/sms/SmsDriver.php b/server/app/common/service/sms/SmsDriver.php index be6bfaf..9c5c8cf 100644 --- a/server/app/common/service/sms/SmsDriver.php +++ b/server/app/common/service/sms/SmsDriver.php @@ -77,7 +77,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function initialize() + public function initialize(): bool { try { $defaultEngine = ConfigService::get('sms', 'engine', false); -- Gitee From 58b8464c5b833cf23604773c97d8e5292c8d5327 Mon Sep 17 00:00:00 2001 From: suyi Date: Sat, 16 Nov 2024 17:27:15 +0800 Subject: [PATCH 02/18] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adminapi/controller/ConfigController.php | 14 ++-- .../controller/DownloadController.php | 3 +- .../adminapi/controller/FileController.php | 17 ++-- .../adminapi/controller/LoginController.php | 20 +++-- .../adminapi/controller/UploadController.php | 13 +-- .../controller/WorkbenchController.php | 3 +- .../article/ArticleCateController.php | 38 +++++---- .../controller/article/ArticleController.php | 25 +++--- .../controller/auth/AdminController.php | 15 ++-- .../controller/auth/MenuController.php | 26 +++--- .../controller/auth/RoleController.php | 28 ++++--- .../channel/AppSettingController.php | 9 ++- .../channel/MnpSettingsController.php | 9 ++- .../channel/OfficialAccountMenuController.php | 13 +-- .../OfficialAccountReplyController.php | 34 ++++---- .../OfficialAccountSettingController.php | 9 ++- .../channel/OpenSettingController.php | 9 ++- .../channel/WebPageSettingController.php | 9 ++- .../controller/crontab/CrontabController.php | 15 ++-- .../controller/decorate/DataController.php | 14 ++-- .../controller/decorate/PageController.php | 9 ++- .../controller/decorate/TabbarController.php | 18 +++-- .../controller/dept/DeptController.php | 30 ++++--- .../controller/dept/JobsController.php | 22 +++--- .../finance/AccountLogController.php | 9 ++- .../controller/finance/RefundController.php | 22 +++--- .../controller/notice/NoticeController.php | 7 +- .../controller/notice/SmsConfigController.php | 7 +- .../recharge/RechargeController.php | 21 ++--- .../setting/CustomerServiceController.php | 5 +- .../setting/HotSearchController.php | 5 +- .../controller/setting/StorageController.php | 9 ++- .../setting/TransactionSettingsController.php | 5 +- .../setting/dict/DictDataController.php | 11 +-- .../setting/dict/DictTypeController.php | 22 +++--- .../setting/pay/PayConfigController.php | 13 +-- .../setting/pay/PayWayController.php | 21 +++-- .../setting/system/CacheController.php | 3 +- .../setting/system/LogController.php | 3 +- .../setting/system/SystemController.php | 3 +- .../setting/user/UserController.php | 9 ++- .../setting/web/WebSettingController.php | 15 ++-- .../controller/tools/GeneratorController.php | 23 +++--- .../controller/user/UserController.php | 11 +-- .../api/controller/AccountLogController.php | 5 +- .../app/api/controller/ArticleController.php | 25 +++--- server/app/api/controller/IndexController.php | 32 ++++---- server/app/api/controller/LoginController.php | 59 +++++++------- server/app/api/controller/PayController.php | 42 +++++----- server/app/api/controller/PcController.php | 38 +++++---- .../app/api/controller/RechargeController.php | 13 +-- .../app/api/controller/SearchController.php | 5 +- server/app/api/controller/SmsController.php | 5 +- .../app/api/controller/UploadController.php | 9 ++- server/app/api/controller/UserController.php | 38 +++++---- .../app/api/controller/WechatController.php | 3 +- .../controller/BaseLikeAdminController.php | 13 +-- server/app/common/model/BaseModel.php | 2 +- server/app/functions.php | 79 ++++++++++--------- 59 files changed, 558 insertions(+), 436 deletions(-) diff --git a/server/app/adminapi/controller/ConfigController.php b/server/app/adminapi/controller/ConfigController.php index 69fb1cf..0274122 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 0224fa3..31b51a0 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 924a75f..4a8c067 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 2ca7c7f..b2664fe 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 71c0008..7e2652e 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 e269abe..5a4fe90 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 b1027e4..d6ad402 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 48053d0..5f0049e 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 2254ae4..2f6d583 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 42307cf..9f83ef7 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 b0d2677..a981a07 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 77ff7ec..84e6bc8 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 7070c6a..ab13a4a 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 2c7f4bb..fc745ae 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 a0ae11e..2b25ab8 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 3d43435..10abf8b 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 a99c570..2eb350e 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 214cff6..a5eb7d3 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 9e0b2ff..6b90d3f 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 07988c9..785fef8 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 439e431..55d40c1 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 561d869..b7304ae 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 f7218fb..087993d 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 452639b..85b224c 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 9ef88b0..efcf3a8 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 ce2b109..bfee22a 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 5943985..f448b62 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 491c088..2fa5aed 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 b21e6e2..89cfa5e 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 57249f8..4f75193 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 af59b36..463c592 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 0770737..445ad49 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 2938783..74e0c0c 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 c566255..d304c19 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 2c41740..5a9de56 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 f9a4bae..8ccf507 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 8df765e..86bf1cb 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 38586fd..8467d0f 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 4a0878f..a1c6d63 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 2a76f9d..96322c1 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 245d55f..f46dc8f 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 ca98ef8..8c5f737 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 12cf114..63258cf 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 ac1c584..1251b62 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/api/controller/AccountLogController.php b/server/app/api/controller/AccountLogController.php index 1d720de..e193342 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 3882d2c..bf26937 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/IndexController.php b/server/app/api/controller/IndexController.php index d99f682..296bd96 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 6ca39d9..f58d869 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 3a1fa8d..0f75fab 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 e7c6fde..e1f0bdb 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 b6e8534..53b5947 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 a43593d..4f51020 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 7325f75..1c2587a 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 32a3322..f67ba00 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 62d40dc..022c3ce 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 f7c1d9a..63519c0 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/common/controller/BaseLikeAdminController.php b/server/app/common/controller/BaseLikeAdminController.php index f5e446a..e839029 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/model/BaseModel.php b/server/app/common/model/BaseModel.php index d39821a..e3fbdcf 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -39,7 +39,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统计查询 diff --git a/server/app/functions.php b/server/app/functions.php index 3bdba92..16741c8 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++) { @@ -411,7 +412,7 @@ if (!function_exists('get_file_domain')) { * @author 段誉 * @date 2022/9/26 10:43 */ - function get_file_domain($content) + function get_file_domain($content): array|string|null { $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; -- Gitee From ca27f98cb3e0069142222e44832338c26b97ff28 Mon Sep 17 00:00:00 2001 From: suyi Date: Sat, 16 Nov 2024 17:32:21 +0800 Subject: [PATCH 03/18] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/BaseController.php | 4 ++-- server/app/adminapi/controller/BaseAdminController.php | 2 +- server/app/adminapi/middleware/LoginMiddleware.php | 3 +++ server/app/api/controller/BaseApiController.php | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/app/BaseController.php b/server/app/BaseController.php index eda2d89..e16fecf 100644 --- a/server/app/BaseController.php +++ b/server/app/BaseController.php @@ -7,7 +7,7 @@ namespace app; use ReflectionClass; use taoser\exception\ValidateException; use taoser\Validate; - +use \support\Request; /** * 控制器基础类 */ @@ -16,7 +16,7 @@ abstract class BaseController /** * Request实例 */ - protected \support\Request $request; + protected Request $request; /** * 是否批量验证 diff --git a/server/app/adminapi/controller/BaseAdminController.php b/server/app/adminapi/controller/BaseAdminController.php index d2b043b..a10c50b 100644 --- a/server/app/adminapi/controller/BaseAdminController.php +++ b/server/app/adminapi/controller/BaseAdminController.php @@ -14,7 +14,7 @@ class BaseAdminController extends BaseLikeAdminController protected int $adminId = 0; protected array $adminInfo = []; - 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/middleware/LoginMiddleware.php b/server/app/adminapi/middleware/LoginMiddleware.php index 0005cce..2f04346 100644 --- a/server/app/adminapi/middleware/LoginMiddleware.php +++ b/server/app/adminapi/middleware/LoginMiddleware.php @@ -57,6 +57,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/api/controller/BaseApiController.php b/server/app/api/controller/BaseApiController.php index 52f4d74..cb12863 100644 --- a/server/app/api/controller/BaseApiController.php +++ b/server/app/api/controller/BaseApiController.php @@ -21,7 +21,7 @@ class BaseApiController extends BaseLikeAdminController protected int $userId = 0; protected array $userInfo = []; - public function setUser($userId,$userInfo): void + public function setUser(int $userId,array $userInfo): void { $this->userId = $userId; $this->userInfo = $userInfo; -- Gitee From 033d2ede2802a9df7d2fc3f34cc44f66ca9c5a64 Mon Sep 17 00:00:00 2001 From: suyi Date: Sat, 16 Nov 2024 17:33:44 +0800 Subject: [PATCH 04/18] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/api/middleware/LoginMiddleware.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/app/api/middleware/LoginMiddleware.php b/server/app/api/middleware/LoginMiddleware.php index e06c7a5..c33e349 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); -- Gitee From dbe982f2a0644a10c9400c41e4067bd4ee9457ac Mon Sep 17 00:00:00 2001 From: suyi Date: Sat, 16 Nov 2024 17:36:24 +0800 Subject: [PATCH 05/18] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/adminapi/lists/BaseAdminDataLists.php | 4 ++-- server/app/adminapi/lists/article/ArticleCateLists.php | 2 +- server/app/adminapi/lists/article/ArticleLists.php | 2 +- server/app/adminapi/lists/auth/AdminLists.php | 2 +- server/app/adminapi/lists/finance/RefundRecordLists.php | 2 +- server/app/common/lists/ListsExtendInterface.php | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/server/app/adminapi/lists/BaseAdminDataLists.php b/server/app/adminapi/lists/BaseAdminDataLists.php index 748ad34..ecd7747 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 251605a..2178c86 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 0428ccf..dfccaea 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 b416cff..bbf6159 100644 --- a/server/app/adminapi/lists/auth/AdminLists.php +++ b/server/app/adminapi/lists/auth/AdminLists.php @@ -199,7 +199,7 @@ class AdminLists extends BaseAdminDataLists implements ListsExtendInterface, Lis ->count(); } - public function extend() + public function extend(): array { return []; } diff --git a/server/app/adminapi/lists/finance/RefundRecordLists.php b/server/app/adminapi/lists/finance/RefundRecordLists.php index e04a241..a3c03da 100644 --- a/server/app/adminapi/lists/finance/RefundRecordLists.php +++ b/server/app/adminapi/lists/finance/RefundRecordLists.php @@ -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/common/lists/ListsExtendInterface.php b/server/app/common/lists/ListsExtendInterface.php index 0ade277..b24f8cb 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 -- Gitee From a179f2da80e5d34a91de3fa3038bc33664d7bbbb Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:03:31 +0800 Subject: [PATCH 06/18] =?UTF-8?q?=E8=A7=A3=E5=BC=80=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/BaseController.php | 6 ++++- .../app/common/model/article/ArticleCate.php | 2 +- server/app/common/model/auth/AdminSession.php | 2 +- .../generator/stub/php/controller.stub | 22 +++++++++---------- .../service/generator/stub/php/lists.stub | 10 ++++----- .../service/generator/stub/php/model.stub | 2 ++ .../generator/stub/php/model/has_many.stub | 4 ++-- .../generator/stub/php/model/has_one.stub | 4 ++-- .../generator/stub/php/tree_lists.stub | 6 ++--- .../service/generator/stub/php/validate.stub | 12 +++++----- 10 files changed, 38 insertions(+), 32 deletions(-) diff --git a/server/app/BaseController.php b/server/app/BaseController.php index e16fecf..3938aef 100644 --- a/server/app/BaseController.php +++ b/server/app/BaseController.php @@ -7,7 +7,7 @@ namespace app; use ReflectionClass; use taoser\exception\ValidateException; use taoser\Validate; -use \support\Request; +use support\Request; /** * 控制器基础类 */ @@ -22,6 +22,10 @@ abstract class BaseController * 是否批量验证 */ protected bool $batchValidate = false; + /** + * 自定义中间件 + */ + protected array $middleware = []; /** * 构造方法 diff --git a/server/app/common/model/article/ArticleCate.php b/server/app/common/model/article/ArticleCate.php index d6928d7..33af6eb 100644 --- a/server/app/common/model/article/ArticleCate.php +++ b/server/app/common/model/article/ArticleCate.php @@ -35,7 +35,7 @@ class ArticleCate extends BaseModel * @author 段誉 * @date 2022/10/19 16:59 */ - public function article() + public function article(): \think\model\relation\HasMany { return $this->hasMany(Article::class, 'cid', 'id'); } diff --git a/server/app/common/model/auth/AdminSession.php b/server/app/common/model/auth/AdminSession.php index f8b2026..9e91765 100644 --- a/server/app/common/model/auth/AdminSession.php +++ b/server/app/common/model/auth/AdminSession.php @@ -24,7 +24,7 @@ class AdminSession extends BaseModel * @author 令狐冲 * @date 2021/7/5 14:39 */ - public function admin() + public function admin(): \think\model\relation\HasOne { return $this->hasOne(Admin::class, 'id', 'admin_id') ->field('id,multipoint_login'); diff --git a/server/app/common/service/generator/stub/php/controller.stub b/server/app/common/service/generator/stub/php/controller.stub index ad91a00..84ba467 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 ba05bba..8ad1094 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} @@ -32,16 +32,16 @@ class {UPPER_CAMEL_NAME}Lists extends {EXTENDS_LISTS} implements ListsSearchInte * 设置别名 * @return {UPPER_CAMEL_NAME} */ - 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 32e8eeb..aa040cb 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} 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 3155e75..f15fe50 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 db2396a..8461791 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 dc7ea5a..637fffa 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 7d9aa71..df1f31f 100644 --- a/server/app/common/service/generator/stub/php/validate.stub +++ b/server/app/common/service/generator/stub/php/validate.stub @@ -18,7 +18,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * 设置校验规则 * @var string[] */ - protected $rule = [ + protected array $rule = [ {RULE} ]; @@ -27,7 +27,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * 参数描述 * @var string[] */ - protected $field = [ + protected array $field = [ {FIELD} ]; @@ -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}']); } -- Gitee From fb745068eb6b95d712589b6d8b3f4289e489b9a6 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:18:10 +0800 Subject: [PATCH 07/18] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/adminapi/logic/auth/MenuLogic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/app/adminapi/logic/auth/MenuLogic.php b/server/app/adminapi/logic/auth/MenuLogic.php index 8678bb6..c30e823 100644 --- a/server/app/adminapi/logic/auth/MenuLogic.php +++ b/server/app/adminapi/logic/auth/MenuLogic.php @@ -56,7 +56,7 @@ class MenuLogic extends BaseLogic $menu = SystemMenu::where($where) ->order(['sort' => 'desc', 'id' => 'asc']) - ->select(); + ->select()->toArray(); return linear_to_tree($menu, 'children'); } -- Gitee From d3fa037c58e7eb78af1d74151a393175fadaf993 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:27:15 +0800 Subject: [PATCH 08/18] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/common/model/BaseModel.php | 2 ++ server/app/common/service/generator/stub/php/lists.stub | 4 ++-- server/app/common/service/generator/stub/php/validate.stub | 4 ++-- server/app/common/validate/BaseValidate.php | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/app/common/model/BaseModel.php b/server/app/common/model/BaseModel.php index e3fbdcf..afae69a 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -11,6 +11,8 @@ use think\Model; /** * Class BaseModel 基础模型 + * @property string $name 表名; + * @property string $deleteTime 删除时间; * * Class Model 框架基础模型 * @package think diff --git a/server/app/common/service/generator/stub/php/lists.stub b/server/app/common/service/generator/stub/php/lists.stub index 8ad1094..be061c4 100644 --- a/server/app/common/service/generator/stub/php/lists.stub +++ b/server/app/common/service/generator/stub/php/lists.stub @@ -30,9 +30,9 @@ class {UPPER_CAMEL_NAME}Lists extends {EXTENDS_LISTS} implements ListsSearchInte /** * 设置别名 - * @return {UPPER_CAMEL_NAME} + * @return {UPPER_CAMEL_NAME}|Query */ - public function getModel():{UPPER_CAMEL_NAME}|Query{ + public function getModel(): {UPPER_CAMEL_NAME}|Query{ return {UPPER_CAMEL_NAME}::whereRaw('1=1'); } diff --git a/server/app/common/service/generator/stub/php/validate.stub b/server/app/common/service/generator/stub/php/validate.stub index df1f31f..2ccf75e 100644 --- a/server/app/common/service/generator/stub/php/validate.stub +++ b/server/app/common/service/generator/stub/php/validate.stub @@ -18,7 +18,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * 设置校验规则 * @var string[] */ - protected array $rule = [ + protected $rule = [ {RULE} ]; @@ -27,7 +27,7 @@ class {UPPER_CAMEL_NAME}Validate extends BaseValidate * 参数描述 * @var string[] */ - protected array $field = [ + protected $field = [ {FIELD} ]; diff --git a/server/app/common/validate/BaseValidate.php b/server/app/common/validate/BaseValidate.php index 8ac4387..9a67a52 100644 --- a/server/app/common/validate/BaseValidate.php +++ b/server/app/common/validate/BaseValidate.php @@ -21,7 +21,7 @@ use taoser\Validate; class BaseValidate extends Validate { - public $method = 'GET'; + public string $method = 'GET'; /** * @notes 设置请求方式 -- Gitee From b9337be14debf5c15bac6710b62cc637aff94eab Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:43:53 +0800 Subject: [PATCH 09/18] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/adminapi/logic/channel/MnpSettingsLogic.php | 2 +- .../logic/channel/OfficialAccountSettingLogic.php | 2 +- server/app/adminapi/logic/channel/WebPageSettingLogic.php | 3 ++- server/app/adminapi/logic/setting/web/WebSettingLogic.php | 8 ++++---- server/app/functions.php | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/server/app/adminapi/logic/channel/MnpSettingsLogic.php b/server/app/adminapi/logic/channel/MnpSettingsLogic.php index 2e348e9..fb099b8 100644 --- a/server/app/adminapi/logic/channel/MnpSettingsLogic.php +++ b/server/app/adminapi/logic/channel/MnpSettingsLogic.php @@ -33,7 +33,7 @@ class MnpSettingsLogic extends BaseLogic */ public function getConfig() { - $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 = [ diff --git a/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php b/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php index 3d0b8f2..22913a2 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php @@ -33,7 +33,7 @@ class OfficialAccountSettingLogic extends BaseLogic */ public function getConfig() { - $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 = [ diff --git a/server/app/adminapi/logic/channel/WebPageSettingLogic.php b/server/app/adminapi/logic/channel/WebPageSettingLogic.php index d6242f6..2b54133 100644 --- a/server/app/adminapi/logic/channel/WebPageSettingLogic.php +++ b/server/app/adminapi/logic/channel/WebPageSettingLogic.php @@ -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; } diff --git a/server/app/adminapi/logic/setting/web/WebSettingLogic.php b/server/app/adminapi/logic/setting/web/WebSettingLogic.php index de836cf..8263cef 100644 --- a/server/app/adminapi/logic/setting/web/WebSettingLogic.php +++ b/server/app/adminapi/logic/setting/web/WebSettingLogic.php @@ -143,10 +143,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/functions.php b/server/app/functions.php index 16741c8..c9a7cfe 100644 --- a/server/app/functions.php +++ b/server/app/functions.php @@ -408,11 +408,11 @@ if (!function_exists('get_file_domain')) { /** * @notes 设置内容图片域名 * @param $content - * @return array|string|string[]|null + * @return array|string|string[] * @author 段誉 * @date 2022/9/26 10:43 */ - function get_file_domain($content): array|string|null + function get_file_domain($content): array|string { $preg = '/()/is'; $fileUrl = FileService::getFileUrl(); -- Gitee From 0005155385a2835d8b05f4cc5b4a57bf5ce140a2 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:45:47 +0800 Subject: [PATCH 10/18] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/sql/like.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/sql/like.sql b/server/sql/like.sql index e96174d..74d6fcd 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; -- ---------------------------- -- Gitee From e60ba8e42f35a11ad9998e2818730b4e43ed4ead Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 11:48:25 +0800 Subject: [PATCH 11/18] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E9=A3=8E=E6=A0=BC?= =?UTF-8?q?=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/BaseController.php | 3 +- server/app/adminapi/listener/OperationLog.php | 3 +- server/app/adminapi/lists/auth/AdminLists.php | 11 ++-- server/app/adminapi/lists/auth/MenuLists.php | 9 ++- server/app/adminapi/lists/auth/RoleLists.php | 9 ++- .../channel/OfficialAccountReplyLists.php | 11 ++-- .../adminapi/lists/crontab/CrontabLists.php | 9 ++- server/app/adminapi/lists/dept/JobsLists.php | 2 +- .../app/adminapi/lists/file/FileCateLists.php | 11 ++-- server/app/adminapi/lists/file/FileLists.php | 11 ++-- .../adminapi/lists/finance/RefundLogLists.php | 9 ++- .../lists/finance/RefundRecordLists.php | 2 +- .../lists/notice/NoticeSettingLists.php | 11 ++-- .../adminapi/lists/recharge/RechargeLists.php | 2 +- .../lists/setting/dict/DictDataLists.php | 11 ++-- .../lists/setting/dict/DictTypeLists.php | 11 ++-- .../lists/setting/pay/PayConfigLists.php | 9 ++- .../lists/setting/system/LogLists.php | 11 ++-- .../adminapi/lists/tools/DataTableLists.php | 3 +- .../lists/tools/GenerateTableLists.php | 11 ++-- server/app/adminapi/lists/user/UserLists.php | 9 ++- server/app/adminapi/logic/ConfigLogic.php | 9 ++- server/app/adminapi/logic/LoginLogic.php | 15 +++-- .../logic/article/ArticleCateLogic.php | 12 ++-- .../adminapi/logic/article/ArticleLogic.php | 3 +- server/app/adminapi/logic/auth/AdminLogic.php | 24 ++++---- server/app/adminapi/logic/auth/MenuLogic.php | 18 +++--- server/app/adminapi/logic/auth/RoleLogic.php | 20 ++++--- .../channel/OfficialAccountMenuLogic.php | 48 ++++++++-------- .../channel/OfficialAccountReplyLogic.php | 33 ++++++----- .../adminapi/logic/crontab/CrontabLogic.php | 13 +++-- .../logic/decorate/DecorateDataLogic.php | 9 ++- .../logic/decorate/DecorateTabbarLogic.php | 12 ++-- server/app/adminapi/logic/dept/DeptLogic.php | 24 ++++---- server/app/adminapi/logic/dept/JobsLogic.php | 12 ++-- .../adminapi/logic/finance/RefundLogic.php | 15 +++-- .../app/adminapi/logic/notice/NoticeLogic.php | 29 +++++----- .../adminapi/logic/recharge/RechargeLogic.php | 7 ++- .../adminapi/logic/setting/HotSearchLogic.php | 3 +- .../logic/setting/dict/DictDataLogic.php | 3 +- .../logic/setting/dict/DictTypeLogic.php | 12 ++-- .../logic/setting/pay/PayConfigLogic.php | 15 +++-- .../logic/setting/pay/PayWayLogic.php | 12 ++-- .../logic/setting/web/WebSettingLogic.php | 5 +- .../adminapi/logic/tools/GeneratorLogic.php | 18 +++--- server/app/adminapi/logic/user/UserLogic.php | 3 +- .../adminapi/middleware/LoginMiddleware.php | 3 +- .../adminapi/service/AdminTokenService.php | 21 ++++--- server/app/adminapi/validate/FileValidate.php | 2 +- .../app/adminapi/validate/LoginValidate.php | 9 ++- .../adminapi/validate/auth/RoleValidate.php | 15 +++-- .../validate/setting/PayConfigValidate.php | 9 ++- .../validate/setting/StorageValidate.php | 2 +- .../validate/tools/GenerateTableValidate.php | 2 +- .../adminapi/validate/user/UserValidate.php | 11 ++-- server/app/api/lists/AccountLogLists.php | 9 ++- server/app/api/lists/article/ArticleLists.php | 11 ++-- .../app/api/lists/recharge/RechargeLists.php | 9 ++- server/app/api/logic/ArticleLogic.php | 9 ++- server/app/api/logic/IndexLogic.php | 15 +++-- server/app/api/logic/LoginLogic.php | 47 +++++++++------- server/app/api/logic/PcLogic.php | 21 ++++--- server/app/api/logic/RechargeLogic.php | 3 +- server/app/api/logic/SearchLogic.php | 9 ++- server/app/api/logic/SmsLogic.php | 5 +- server/app/api/logic/UserLogic.php | 39 +++++++------ server/app/api/logic/WechatLogic.php | 3 +- server/app/api/service/UserTokenService.php | 21 ++++--- server/app/api/service/WechatUserService.php | 9 ++- server/app/common/cache/AdminTokenCache.php | 12 ++-- server/app/common/cache/UserTokenCache.php | 18 +++--- server/app/common/enum/notice/NoticeEnum.php | 4 +- .../exception/ControllerExtendException.php | 4 +- server/app/common/exception/HttpException.php | 3 +- .../http/middleware/AllowMiddleware.php | 4 +- .../common/http/middleware/BaseMiddleware.php | 4 +- server/app/common/lists/BaseDataLists.php | 3 +- server/app/common/lists/ListsExcelTrait.php | 3 +- server/app/common/logic/AccountLogLogic.php | 3 +- server/app/common/logic/NoticeLogic.php | 8 ++- server/app/common/logic/PayNotifyLogic.php | 3 +- server/app/common/logic/PaymentLogic.php | 18 +++--- server/app/common/logic/RefundLogic.php | 17 +++--- server/app/common/model/BaseModel.php | 12 ++-- .../app/common/model/article/ArticleCate.php | 5 +- server/app/common/model/auth/AdminSession.php | 5 +- server/app/common/model/auth/SystemRole.php | 3 +- .../common/model/decorate/DecorateTabbar.php | 9 ++- server/app/common/model/pay/PayWay.php | 3 +- .../app/common/model/tools/GenerateColumn.php | 3 +- .../app/common/model/tools/GenerateTable.php | 3 +- server/app/common/model/user/User.php | 12 ++-- server/app/common/service/LockService.php | 2 +- server/app/common/service/NoticeService.php | 7 ++- .../service/generator/GenerateService.php | 5 +- .../common/service/pay/WeChatPayService.php | 56 +++++++++++-------- server/app/common/service/sms/SmsDriver.php | 21 +++---- .../common/service/sms/SmsMessageService.php | 12 ++-- .../app/common/service/sms/engine/AliSms.php | 5 +- .../common/service/sms/engine/TencentSms.php | 5 +- .../service/wechat/WeChatMnpService.php | 27 ++++++--- .../common/service/wechat/WeChatOaService.php | 36 ++++++++---- server/app/crontab/Task.php | 3 +- server/app/functions.php | 2 +- server/app/queue/redis/ImportXlsxClient.php | 6 +- server/app/queue/redis/LogClient.php | 3 +- 106 files changed, 716 insertions(+), 459 deletions(-) diff --git a/server/app/BaseController.php b/server/app/BaseController.php index 3938aef..a4b5297 100644 --- a/server/app/BaseController.php +++ b/server/app/BaseController.php @@ -5,6 +5,7 @@ declare (strict_types = 1); namespace app; use ReflectionClass; +use ReflectionException; use taoser\exception\ValidateException; use taoser\Validate; use support\Request; @@ -61,7 +62,7 @@ abstract class BaseController * @param array $message 提示信息 * @param bool $batch 是否批量验证 * @throws ValidateException - * @throws \ReflectionException + * @throws ReflectionException */ protected function validate(array $data, array|string $validate, array $message = [], bool $batch = false): true|array|string { diff --git a/server/app/adminapi/listener/OperationLog.php b/server/app/adminapi/listener/OperationLog.php index 539cff3..df6655b 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,7 +18,7 @@ class OperationLog * @param Request $request * @param Response $response * @return bool - * @throws \ReflectionException + * @throws ReflectionException * @author bingo * @date 2022/4/8 17:09 */ diff --git a/server/app/adminapi/lists/auth/AdminLists.php b/server/app/adminapi/lists/auth/AdminLists.php index bbf6159..2c0bd71 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 */ diff --git a/server/app/adminapi/lists/auth/MenuLists.php b/server/app/adminapi/lists/auth/MenuLists.php index 9216461..de58ff3 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 8c5c751..68a8571 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 aa59326..4f2279e 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 14cd115..8d3d081 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 97d7a1a..d15b6d0 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 e9393db..bd4d1a8 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 edae997..bcd382a 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 4f9b981..52f5d4a 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 a3c03da..5f20108 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 */ diff --git a/server/app/adminapi/lists/notice/NoticeSettingLists.php b/server/app/adminapi/lists/notice/NoticeSettingLists.php index fca337e..bb66657 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 05fdc5c..80f17e2 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 3c07a29..27399ed 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 a0e41ed..a2bf0f1 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 f4c3ca9..38be1c5 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 4ed6ce2..54f6341 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 9fd5fb7..6788722 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 58a3650..31fbe05 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 25c2b1a..2641a27 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 ee3e402..0762be4 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,9 +60,9 @@ 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 */ diff --git a/server/app/adminapi/logic/LoginLogic.php b/server/app/adminapi/logic/LoginLogic.php index acbfc7a..c1e3129 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,9 +34,9 @@ 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 */ @@ -66,9 +69,9 @@ 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 */ diff --git a/server/app/adminapi/logic/article/ArticleCateLogic.php b/server/app/adminapi/logic/article/ArticleCateLogic.php index 366b8aa..df3334e 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; /** * 资讯分类管理逻辑 @@ -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; } @@ -110,9 +114,9 @@ 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 */ diff --git a/server/app/adminapi/logic/article/ArticleLogic.php b/server/app/adminapi/logic/article/ArticleLogic.php index 9664866..ad23acc 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; /** * 资讯管理逻辑 @@ -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; } diff --git a/server/app/adminapi/logic/auth/AdminLogic.php b/server/app/adminapi/logic/auth/AdminLogic.php index 90cd862..8fba15f 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; @@ -68,7 +72,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 +138,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 +159,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 +177,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 +189,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 */ @@ -264,7 +268,7 @@ class AdminLogic extends BaseLogic * @notes 新增角色 * @param $adminId * @param $roleIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:23 */ @@ -288,7 +292,7 @@ class AdminLogic extends BaseLogic * @notes 新增部门 * @param $adminId * @param $deptIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:22 */ @@ -312,7 +316,7 @@ class AdminLogic extends BaseLogic * @notes 新增岗位 * @param $adminId * @param $jobsIds - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/11/25 14:22 */ diff --git a/server/app/adminapi/logic/auth/MenuLogic.php b/server/app/adminapi/logic/auth/MenuLogic.php index c30e823..60563da 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,9 +39,9 @@ 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 */ @@ -65,7 +69,7 @@ class MenuLogic extends BaseLogic /** * @notes 添加菜单 * @param array $params - * @return SystemMenu|\think\Model + * @return SystemMenu|Model * @author 乔峰 * @date 2022/6/30 10:06 */ @@ -164,9 +168,9 @@ 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 */ diff --git a/server/app/adminapi/logic/auth/RoleLogic.php b/server/app/adminapi/logic/auth/RoleLogic.php index 84f8282..d15e503 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; @@ -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,9 +157,9 @@ 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 */ diff --git a/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php b/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php index 15c0d2f..40b1823 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; /** * 微信公众号菜单逻辑层 @@ -39,7 +41,7 @@ class OfficialAccountMenuLogic extends BaseLogic 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) { 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) { 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,7 +133,7 @@ class OfficialAccountMenuLogic extends BaseLogic /** * @notes 菜单类型校验 * @param $item - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/3/29 10:55 */ @@ -141,25 +143,25 @@ class OfficialAccountMenuLogic extends BaseLogic // 关键字 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,7 +171,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @notes 保存发布菜单 * @param $params * @return bool - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/3/29 10:55 */ @@ -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; } diff --git a/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php b/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php index 14d2e50..4d784a7 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; /** @@ -42,7 +49,7 @@ class OfficialAccountReplyLogic extends BaseLogic 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; } @@ -84,7 +91,7 @@ class OfficialAccountReplyLogic extends BaseLogic 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; } @@ -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 diff --git a/server/app/adminapi/logic/crontab/CrontabLogic.php b/server/app/adminapi/logic/crontab/CrontabLogic.php index cefd19f..2807d23 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; /** * 定时任务逻辑层 @@ -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; } @@ -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; } @@ -103,7 +104,7 @@ class CrontabLogic extends BaseLogic Crontab::destroy($params['id']); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -122,7 +123,7 @@ class CrontabLogic extends BaseLogic 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; } @@ -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 7447a04..84e6d76 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,9 +32,9 @@ 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 */ diff --git a/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php b/server/app/adminapi/logic/decorate/DecorateTabbarLogic.php index 49e0acb..efb4c16 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 ebe015d..8d69eae 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,9 +35,9 @@ 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 */ @@ -86,9 +90,9 @@ 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 */ @@ -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; } @@ -182,9 +186,9 @@ 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 */ diff --git a/server/app/adminapi/logic/dept/JobsLogic.php b/server/app/adminapi/logic/dept/JobsLogic.php index debb403..a6c26da 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; /** @@ -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; } @@ -100,9 +104,9 @@ 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 */ diff --git a/server/app/adminapi/logic/finance/RefundLogic.php b/server/app/adminapi/logic/finance/RefundLogic.php index 9a8a144..9247083 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,9 +35,9 @@ 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 */ @@ -75,9 +78,9 @@ 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 */ diff --git a/server/app/adminapi/logic/notice/NoticeLogic.php b/server/app/adminapi/logic/notice/NoticeLogic.php index cf1936b..b323f2b 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; /** * 通知逻辑层 @@ -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,7 +119,7 @@ class NoticeLogic extends BaseLogic /** * @notes 校验参数 * @param $params - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/3/29 11:35 */ @@ -127,11 +128,11 @@ class NoticeLogic extends BaseLogic $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) { 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) { 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) { 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) { 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/recharge/RechargeLogic.php b/server/app/adminapi/logic/recharge/RechargeLogic.php index af0feac..ffd872a 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; @@ -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; } @@ -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()]; @@ -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/HotSearchLogic.php b/server/app/adminapi/logic/setting/HotSearchLogic.php index 192301a..4082611 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; /** @@ -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/dict/DictDataLogic.php b/server/app/adminapi/logic/setting/dict/DictDataLogic.php index b242941..8ebbfd9 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,7 +31,7 @@ class DictDataLogic extends BaseLogic /** * @notes 添加编辑 * @param array $params - * @return DictData|\think\Model + * @return DictData|Model * @author 乔峰 * @date 2022/6/20 17:13 */ diff --git a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php index 8567f07..022b899 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,7 +35,7 @@ class DictTypeLogic extends BaseLogic /** * @notes 添加字典类型 * @param array $params - * @return DictType|\think\Model + * @return DictType|Model * @author 乔峰 * @date 2022/6/20 16:08 */ @@ -95,9 +99,9 @@ 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 */ diff --git a/server/app/adminapi/logic/setting/pay/PayConfigLogic.php b/server/app/adminapi/logic/setting/pay/PayConfigLogic.php index 4c41f5b..c3b2c9c 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,9 +34,9 @@ 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 */ @@ -75,9 +78,9 @@ 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 */ diff --git a/server/app/adminapi/logic/setting/pay/PayWayLogic.php b/server/app/adminapi/logic/setting/pay/PayWayLogic.php index bc5d510..6d42f4d 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,9 +37,9 @@ 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 */ @@ -66,7 +70,7 @@ class PayWayLogic extends BaseLogic * @notes 设置支付方式 * @param $params * @return bool|string - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2023/2/23 16:26 */ diff --git a/server/app/adminapi/logic/setting/web/WebSettingLogic.php b/server/app/adminapi/logic/setting/web/WebSettingLogic.php index 8263cef..a69ef8d 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; /** @@ -106,11 +107,11 @@ class WebSettingLogic extends BaseLogic { 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; } diff --git a/server/app/adminapi/logic/tools/GeneratorLogic.php b/server/app/adminapi/logic/tools/GeneratorLogic.php index c8b78e8..0de3e35 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; /** @@ -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; @@ -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; @@ -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; @@ -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; @@ -227,7 +229,7 @@ class GeneratorLogic extends BaseLogic return ['file' => $zipFile]; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -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,7 +278,7 @@ class GeneratorLogic extends BaseLogic * @notes 初始化代码生成数据表信息 * @param $tableData * @param $adminId - * @return GenerateTable|\think\Model + * @return GenerateTable|Model * @author 乔峰 * @date 2022/6/23 16:28 */ @@ -312,7 +314,7 @@ class GeneratorLogic extends BaseLogic * @notes 初始化代码生成字段信息 * @param $column * @param $tableId - * @throws \Exception + * @throws Exception * @author 乔峰 * @date 2022/6/23 16:28 */ diff --git a/server/app/adminapi/logic/user/UserLogic.php b/server/app/adminapi/logic/user/UserLogic.php index ec6e319..b93226d 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; /** @@ -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 2f04346..4b906da 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 */ diff --git a/server/app/adminapi/service/AdminTokenService.php b/server/app/adminapi/service/AdminTokenService.php index f26fcbe..94b2906 100644 --- a/server/app/adminapi/service/AdminTokenService.php +++ b/server/app/adminapi/service/AdminTokenService.php @@ -6,6 +6,9 @@ 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 @@ -16,9 +19,9 @@ class AdminTokenService * @param $terminal //多终端名称 * @param $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 */ @@ -61,9 +64,9 @@ class AdminTokenService * @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 2021/7/5 14:25 */ @@ -85,9 +88,9 @@ class AdminTokenService * @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/7/5 14:31 */ diff --git a/server/app/adminapi/validate/FileValidate.php b/server/app/adminapi/validate/FileValidate.php index 1b2e1f2..e9ba0a1 100644 --- a/server/app/adminapi/validate/FileValidate.php +++ b/server/app/adminapi/validate/FileValidate.php @@ -30,7 +30,7 @@ class FileValidate extends BaseValidate /** * @notes id验证场景 - * @return \app\adminapi\validate\FileValidate + * @return FileValidate * @author 乔峰 * @date 2021/12/29 14:32 */ diff --git a/server/app/adminapi/validate/LoginValidate.php b/server/app/adminapi/validate/LoginValidate.php index db92792..3b8b7ec 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,9 +33,9 @@ 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 */ diff --git a/server/app/adminapi/validate/auth/RoleValidate.php b/server/app/adminapi/validate/auth/RoleValidate.php index 5680ce6..042fbe2 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; /** * 角色验证器 @@ -80,9 +83,9 @@ 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 */ @@ -102,9 +105,9 @@ 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 */ diff --git a/server/app/adminapi/validate/setting/PayConfigValidate.php b/server/app/adminapi/validate/setting/PayConfigValidate.php index 132780d..1a1857c 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 @@ -52,9 +55,9 @@ 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 */ diff --git a/server/app/adminapi/validate/setting/StorageValidate.php b/server/app/adminapi/validate/setting/StorageValidate.php index 15aafd7..83b6a18 100644 --- a/server/app/adminapi/validate/setting/StorageValidate.php +++ b/server/app/adminapi/validate/setting/StorageValidate.php @@ -17,7 +17,7 @@ class StorageValidate extends BaseValidate /** * @notes 设置存储引擎参数场景 - * @return \app\adminapi\validate\setting\StorageValidate + * @return StorageValidate * @author 乔峰 * @date 2022/4/20 16:18 */ diff --git a/server/app/adminapi/validate/tools/GenerateTableValidate.php b/server/app/adminapi/validate/tools/GenerateTableValidate.php index 5703dc8..7edcfe1 100644 --- a/server/app/adminapi/validate/tools/GenerateTableValidate.php +++ b/server/app/adminapi/validate/tools/GenerateTableValidate.php @@ -82,7 +82,7 @@ class GenerateTableValidate extends BaseValidate 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'] . '表'; } diff --git a/server/app/adminapi/validate/user/UserValidate.php b/server/app/adminapi/validate/user/UserValidate.php index e74f20e..6205dec 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,7 +27,7 @@ class UserValidate extends BaseValidate /** * @notes 详情场景 - * @return \app\adminapi\validate\user\UserValidate + * @return UserValidate * @author 乔峰 * @date 2022/9/22 16:35 */ @@ -40,9 +43,9 @@ 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 */ diff --git a/server/app/api/lists/AccountLogLists.php b/server/app/api/lists/AccountLogLists.php index 699e033..be32307 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; /** @@ -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/article/ArticleLists.php b/server/app/api/lists/article/ArticleLists.php index f148585..c322bf3 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 */ @@ -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 bdafa39..0c84f58 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 f3e9b8f..2f728b0 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; /** @@ -94,9 +97,9 @@ 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 */ diff --git a/server/app/api/logic/IndexLogic.php b/server/app/api/logic/IndexLogic.php index fe1e739..eb93c02 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 fccfd8f..cfa5a2f 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}; @@ -63,7 +68,7 @@ class LoginLogic extends BaseLogic ]); return true; - } catch (\Exception $e) { + } catch (Exception $e) { self::setError($e->getMessage()); return false; } @@ -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,9 +127,9 @@ 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 */ @@ -157,7 +162,7 @@ class LoginLogic extends BaseLogic * @notes 公众号登录 * @param array $params * @return array|false - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/9/20 19:47 */ @@ -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; @@ -205,7 +210,7 @@ class LoginLogic extends BaseLogic } return $userInfo; - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -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,7 +249,7 @@ class LoginLogic extends BaseLogic /** * @notes 更新登录信息 * @param $userId - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/20 19:46 */ @@ -252,7 +257,7 @@ class LoginLogic extends BaseLogic { $user = User::findOrEmpty($userId); if ($user->isEmpty()) { - throw new \Exception('用户不存在'); + throw new Exception('用户不存在'); } $time = time(); @@ -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,7 +296,7 @@ class LoginLogic extends BaseLogic * @notes 公众号端绑定微信 * @param array $params * @return bool - * @throws \GuzzleHttp\Exception\GuzzleException + * @throws GuzzleException * @author 段誉 * @date 2022/9/16 10:43 */ @@ -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,7 +321,7 @@ class LoginLogic extends BaseLogic * @notes 生成授权记录 * @param $response * @return bool - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/16 10:43 */ @@ -325,7 +330,7 @@ class LoginLogic extends BaseLogic //先检查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('该微信已被绑定'); } } @@ -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; } @@ -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; diff --git a/server/app/api/logic/PcLogic.php b/server/app/api/logic/PcLogic.php index 8c0ba69..988add8 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,9 +39,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:15 */ @@ -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 fd60ac4..005a23d 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; /** @@ -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; } diff --git a/server/app/api/logic/SearchLogic.php b/server/app/api/logic/SearchLogic.php index c461517..6a510f0 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,9 +33,9 @@ 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 */ diff --git a/server/app/api/logic/SmsLogic.php b/server/app/api/logic/SmsLogic.php index d1b5a49..2faf6fa 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; /** @@ -39,7 +40,7 @@ class SmsLogic extends BaseLogic 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 a8330e3..187ac73 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 */ @@ -95,7 +100,7 @@ class UserLogic extends BaseLogic 'id' => $userId, $params['field'] => $params['value']] ); - } catch (\Exception $e) { + } catch (Exception $e) { self::$error = $e->getMessage(); return false; } @@ -133,7 +138,7 @@ class UserLogic extends BaseLogic // 校验验证码 $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; } @@ -166,7 +171,7 @@ class UserLogic extends BaseLogic 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,7 +204,7 @@ 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 */ @@ -209,7 +214,7 @@ class UserLogic extends BaseLogic $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; } @@ -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 691399e..bceb2eb 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,7 +31,7 @@ class WechatLogic extends BaseLogic * @notes 微信JSSDK授权接口 * @param $params * @return false|mixed[] - * @throws \Psr\SimpleCache\InvalidArgumentException + * @throws InvalidArgumentException * @author 段誉 * @date 2023/3/1 11:49 */ diff --git a/server/app/api/service/UserTokenService.php b/server/app/api/service/UserTokenService.php index 5c90daf..72a05a0 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 @@ -27,9 +30,9 @@ class UserTokenService * @param $userId * @param $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 */ @@ -69,9 +72,9 @@ class UserTokenService * @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:10 */ @@ -92,9 +95,9 @@ class UserTokenService * @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 2022/9/16 10:10 */ diff --git a/server/app/api/service/WechatUserService.php b/server/app/api/service/WechatUserService.php index 6f1e8bc..6610064 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}; @@ -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/common/cache/AdminTokenCache.php b/server/app/common/cache/AdminTokenCache.php index 639eb91..275b9fc 100644 --- a/server/app/common/cache/AdminTokenCache.php +++ b/server/app/common/cache/AdminTokenCache.php @@ -8,6 +8,10 @@ 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 @@ -42,9 +46,9 @@ class AdminTokenCache 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 2021/7/5 12:12 */ @@ -82,7 +86,7 @@ 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); } diff --git a/server/app/common/cache/UserTokenCache.php b/server/app/common/cache/UserTokenCache.php index 37a8b7d..2976c9e 100644 --- a/server/app/common/cache/UserTokenCache.php +++ b/server/app/common/cache/UserTokenCache.php @@ -17,6 +17,10 @@ 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 { @@ -28,9 +32,9 @@ 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 */ @@ -56,9 +60,9 @@ 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 */ @@ -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); } diff --git a/server/app/common/enum/notice/NoticeEnum.php b/server/app/common/enum/notice/NoticeEnum.php index 172f889..c59e318 100644 --- a/server/app/common/enum/notice/NoticeEnum.php +++ b/server/app/common/enum/notice/NoticeEnum.php @@ -196,7 +196,7 @@ class NoticeEnum * @notes 获取公众号模板消息示例 * @param $sceneId * @param false $flag - * @return array|string[]|\string[][] + * @return array|string[]|string[][] * @author 段誉 * @date 2022/3/29 11:33 */ @@ -236,7 +236,7 @@ class NoticeEnum * @notes 提示 * @param $type * @param $sceneId - * @return array|string|string[]|\string[][] + * @return array|string|string[]|string[][] * @author 段誉 * @date 2022/3/29 11:33 */ diff --git a/server/app/common/exception/ControllerExtendException.php b/server/app/common/exception/ControllerExtendException.php index 93c05b0..31072b9 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/HttpException.php b/server/app/common/exception/HttpException.php index 703b3ae..516ff5d 100644 --- a/server/app/common/exception/HttpException.php +++ b/server/app/common/exception/HttpException.php @@ -3,9 +3,10 @@ namespace app\common\exception; +use RuntimeException; use Throwable; -class HttpException extends \RuntimeException +class HttpException extends RuntimeException { protected $response = null; diff --git a/server/app/common/http/middleware/AllowMiddleware.php b/server/app/common/http/middleware/AllowMiddleware.php index af4be6e..5bd2961 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,7 +54,7 @@ class AllowMiddleware implements MiddlewareInterface OperationLog::handle($request,$response); })); $fiber->start(); - }catch (\Exception|\Throwable $e){ + }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 3cfd84c..4771375 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/lists/BaseDataLists.php b/server/app/common/lists/BaseDataLists.php index dfaa3f2..2e4bbd8 100644 --- a/server/app/common/lists/BaseDataLists.php +++ b/server/app/common/lists/BaseDataLists.php @@ -7,6 +7,7 @@ use app\common\enum\ExportEnum; use app\common\service\JsonService; use app\common\validate\ListsValidate; use app\Request; +use support\Response; use Webman\Config; abstract class BaseDataLists implements ListsInterface @@ -135,7 +136,7 @@ abstract class BaseDataLists implements ListsInterface /** * @notes 导出初始化 - * @return false|\support\Response + * @return false|Response * @author 令狐冲 * @date 2021/7/31 01:15 */ diff --git a/server/app/common/lists/ListsExcelTrait.php b/server/app/common/lists/ListsExcelTrait.php index ccc5d43..f626917 100644 --- a/server/app/common/lists/ListsExcelTrait.php +++ b/server/app/common/lists/ListsExcelTrait.php @@ -9,6 +9,7 @@ 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 { @@ -22,7 +23,7 @@ trait ListsExcelTrait * @param $lists * @return string * @throws \PhpOffice\PhpSpreadsheet\Exception - * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception + * @throws Exception * @author 令狐冲 * @date 2021/7/21 16:04 */ diff --git a/server/app/common/logic/AccountLogLogic.php b/server/app/common/logic/AccountLogLogic.php index ae1223a..87ae3e0 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,7 +24,7 @@ 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 */ diff --git a/server/app/common/logic/NoticeLogic.php b/server/app/common/logic/NoticeLogic.php index 6957d73..5d02f63 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; /** @@ -42,7 +44,7 @@ class NoticeLogic extends BaseLogic 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; } @@ -135,7 +137,7 @@ 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 */ diff --git a/server/app/common/logic/PayNotifyLogic.php b/server/app/common/logic/PayNotifyLogic.php index 09da1ca..b74c31d 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; @@ -24,7 +25,7 @@ class PayNotifyLogic extends BaseLogic self::$action($orderSn, $extra); Db::commit(); return true; - } catch (\Exception $e) { + } catch (Exception $e) { Db::rollback(); Log::info(implode('-', [ __CLASS__, diff --git a/server/app/common/logic/PaymentLogic.php b/server/app/common/logic/PaymentLogic.php index dd537a5..bdf2078 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; /** @@ -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; } @@ -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,7 +127,7 @@ 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 */ @@ -136,16 +138,16 @@ class PaymentLogic extends BaseLogic 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; } diff --git a/server/app/common/logic/RefundLogic.php b/server/app/common/logic/RefundLogic.php index d6ce286..2f66e16 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; /** @@ -43,7 +46,7 @@ class RefundLogic extends BaseLogic * @param $refundAmount * @param $handleId * @return bool - * @throws \Exception + * @throws Exception * @author bingo * @date 2023/2/28 17:24 */ @@ -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) { if ($refundAmount <= 0) { - throw new \Exception('订单金额异常'); + throw new Exception('订单金额异常'); } } @@ -96,8 +99,8 @@ 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 */ diff --git a/server/app/common/model/BaseModel.php b/server/app/common/model/BaseModel.php index afae69a..456c9ec 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -5,9 +5,13 @@ 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 基础模型 @@ -57,8 +61,8 @@ use think\Model; * @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 Collection select(mixed $data = null) static 查询多个记录 + * @method Model withAttr(array $name, Closure $closure) 动态定义获取器 * * Class DbManager 数据库管理类 * @package think @@ -75,10 +79,10 @@ use think\Model; * @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 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 Paginator paginate(integer $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/article/ArticleCate.php b/server/app/common/model/article/ArticleCate.php index 33af6eb..5d6c21f 100644 --- a/server/app/common/model/article/ArticleCate.php +++ b/server/app/common/model/article/ArticleCate.php @@ -16,6 +16,7 @@ namespace app\common\model\article; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +use think\model\relation\HasMany; /** * 资讯分类管理模型 @@ -31,11 +32,11 @@ class ArticleCate extends BaseModel /** * @notes 关联文章 - * @return \think\model\relation\HasMany + * @return HasMany * @author 段誉 * @date 2022/10/19 16:59 */ - public function article(): \think\model\relation\HasMany + public function article(): HasMany { return $this->hasMany(Article::class, 'cid', 'id'); } diff --git a/server/app/common/model/auth/AdminSession.php b/server/app/common/model/auth/AdminSession.php index 9e91765..c9f7152 100644 --- a/server/app/common/model/auth/AdminSession.php +++ b/server/app/common/model/auth/AdminSession.php @@ -15,16 +15,17 @@ namespace app\common\model\auth; use app\common\model\BaseModel; +use think\model\relation\HasOne; class AdminSession extends BaseModel { /** * @notes 关联管理员表 - * @return \think\model\relation\HasOne + * @return HasOne * @author 令狐冲 * @date 2021/7/5 14:39 */ - public function admin(): \think\model\relation\HasOne + public function admin(): HasOne { return $this->hasOne(Admin::class, 'id', 'admin_id') ->field('id,multipoint_login'); diff --git a/server/app/common/model/auth/SystemRole.php b/server/app/common/model/auth/SystemRole.php index fd0c528..a649865 100644 --- a/server/app/common/model/auth/SystemRole.php +++ b/server/app/common/model/auth/SystemRole.php @@ -16,6 +16,7 @@ namespace app\common\model\auth; use app\common\model\BaseModel; use think\model\concern\SoftDelete; +use think\model\relation\HasMany; /** * 角色模型 @@ -32,7 +33,7 @@ class SystemRole extends BaseModel /** * @notes 角色与菜单关联关系 - * @return \think\model\relation\HasMany + * @return HasMany * @author 乔峰 * @date 2022/7/6 11:16 */ diff --git a/server/app/common/model/decorate/DecorateTabbar.php b/server/app/common/model/decorate/DecorateTabbar.php index d1405a9..09b4461 100644 --- a/server/app/common/model/decorate/DecorateTabbar.php +++ b/server/app/common/model/decorate/DecorateTabbar.php @@ -16,6 +16,9 @@ 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; /** @@ -35,9 +38,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/pay/PayWay.php b/server/app/common/model/pay/PayWay.php index 011fb9b..8599205 100644 --- a/server/app/common/model/pay/PayWay.php +++ b/server/app/common/model/pay/PayWay.php @@ -17,6 +17,7 @@ namespace app\common\model\pay; use app\common\model\BaseModel; use app\common\service\FileService; +use think\model\relation\HasOne; class PayWay extends BaseModel @@ -43,7 +44,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/tools/GenerateColumn.php b/server/app/common/model/tools/GenerateColumn.php index 98e8dd8..8f8c99c 100644 --- a/server/app/common/model/tools/GenerateColumn.php +++ b/server/app/common/model/tools/GenerateColumn.php @@ -5,6 +5,7 @@ namespace app\common\model\tools; use app\common\model\BaseModel; +use think\model\relation\BelongsTo; /** @@ -17,7 +18,7 @@ class GenerateColumn extends BaseModel /** * @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 715a0a6..e90c3e2 100644 --- a/server/app/common/model/tools/GenerateTable.php +++ b/server/app/common/model/tools/GenerateTable.php @@ -5,6 +5,7 @@ namespace app\common\model\tools; use app\common\enum\GeneratorEnum; use app\common\model\BaseModel; +use think\model\relation\HasMany; /** @@ -21,7 +22,7 @@ class GenerateTable extends BaseModel /** * @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 ebd6cf2..e9fa65e 100644 --- a/server/app/common/model/user/User.php +++ b/server/app/common/model/user/User.php @@ -7,7 +7,11 @@ 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; /** * 用户模型 @@ -23,7 +27,7 @@ class User extends BaseModel /** * @notes 关联用户授权模型 - * @return \think\model\relation\HasOne + * @return HasOne * @author 乔峰 * @date 2022/9/22 16:03 */ @@ -141,9 +145,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/service/LockService.php b/server/app/common/service/LockService.php index bbf2d01..9fc0f7e 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 67ed24c..1e72549 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; /** @@ -15,15 +16,15 @@ class NoticeService { 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 b5c6ef7..f6dd1e2 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; /** @@ -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/pay/WeChatPayService.php b/server/app/common/service/pay/WeChatPayService.php index d0bc14a..751e4ff 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,7 +43,7 @@ class WeChatPayService extends BasePayService { /** * 授权信息 - * @var UserAuth|array|\think\Model + * @var UserAuth|array|Model */ protected $auth; @@ -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,8 +139,8 @@ 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 */ @@ -165,8 +173,8 @@ 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 */ @@ -195,8 +203,8 @@ 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 */ @@ -226,8 +234,8 @@ 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 */ @@ -266,8 +274,8 @@ 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 */ @@ -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 */ @@ -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) { if (!empty($result['code']) || !empty($result['message'])) { - throw new \Exception('微信:'. $result['code'] . '-' . $result['message']); + throw new Exception('微信:'. $result['code'] . '-' . $result['message']); } } @@ -340,8 +348,8 @@ 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 */ @@ -353,11 +361,11 @@ 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 */ diff --git a/server/app/common/service/sms/SmsDriver.php b/server/app/common/service/sms/SmsDriver.php index 9c5c8cf..5eaf6fb 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; /** * 短信驱动 @@ -82,26 +83,26 @@ class SmsDriver 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; } @@ -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,7 +154,7 @@ class SmsDriver /** * @notes 发送频率限制 * @param $mobile - * @throws \Exception + * @throws Exception * @author 段誉 * @date 2022/9/15 16:29 */ @@ -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条短信'); } } diff --git a/server/app/common/service/sms/SmsMessageService.php b/server/app/common/service/sms/SmsMessageService.php index 489cb91..6fc616c 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; /** * 短信服务 @@ -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()); } } @@ -103,7 +105,7 @@ class SmsMessageService * @notes 添加短信记录 * @param $params * @param $content - * @return SmsLog|\think\Model + * @return SmsLog|Model * @author 段誉 * @date 2022/9/15 16:24 */ diff --git a/server/app/common/service/sms/engine/AliSms.php b/server/app/common/service/sms/engine/AliSms.php index c9d48b8..7bfc488 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; /** * 阿里云短信 @@ -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 ae238a2..5c6df64 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; @@ -128,9 +129,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/wechat/WeChatMnpService.php b/server/app/common/service/wechat/WeChatMnpService.php index 38da47b..7a749d2 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; /** @@ -59,13 +68,13 @@ 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 */ @@ -85,8 +94,8 @@ 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 */ diff --git a/server/app/common/service/wechat/WeChatOaService.php b/server/app/common/service/wechat/WeChatOaService.php index e277d4f..76379c6 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; /** @@ -40,10 +52,10 @@ 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 */ @@ -114,8 +126,8 @@ 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 */ @@ -139,13 +151,13 @@ 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 */ diff --git a/server/app/crontab/Task.php b/server/app/crontab/Task.php index 4d4d56e..f37c7af 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 c9a7cfe..df00dfa 100644 --- a/server/app/functions.php +++ b/server/app/functions.php @@ -408,7 +408,7 @@ if (!function_exists('get_file_domain')) { /** * @notes 设置内容图片域名 * @param $content - * @return array|string|string[] + * @return array|string * @author 段誉 * @date 2022/9/26 10:43 */ diff --git a/server/app/queue/redis/ImportXlsxClient.php b/server/app/queue/redis/ImportXlsxClient.php index cd1dfa8..2f7c2f6 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 a38144d..5ab2d91 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"; -- Gitee From c005cb0905e671d480a1e12c414a402b172a6751 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 12:01:32 +0800 Subject: [PATCH 12/18] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/Request.php | 2 +- server/app/adminapi/listener/OperationLog.php | 5 ++- server/app/common/lists/BaseDataLists.php | 41 ++++++++++--------- server/app/common/lists/ListsSearchTrait.php | 6 ++- server/app/common/lists/ListsSortTrait.php | 4 +- server/app/common/validate/BaseValidate.php | 4 +- server/app/common/validate/ListsValidate.php | 4 +- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/server/app/Request.php b/server/app/Request.php index b1151b7..a56e9c7 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/listener/OperationLog.php b/server/app/adminapi/listener/OperationLog.php index df6655b..aa11c20 100644 --- a/server/app/adminapi/listener/OperationLog.php +++ b/server/app/adminapi/listener/OperationLog.php @@ -25,10 +25,13 @@ class OperationLog 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/common/lists/BaseDataLists.php b/server/app/common/lists/BaseDataLists.php index 2e4bbd8..b88db71 100644 --- a/server/app/common/lists/BaseDataLists.php +++ b/server/app/common/lists/BaseDataLists.php @@ -6,9 +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 { @@ -16,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 $startTime; + protected int $endTime; - 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() { @@ -142,7 +143,7 @@ abstract class BaseDataLists implements ListsInterface */ private function initExport() { - $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/ListsSearchTrait.php b/server/app/common/lists/ListsSearchTrait.php index b848d60..2cffdc6 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 搜索条件生成 diff --git a/server/app/common/lists/ListsSortTrait.php b/server/app/common/lists/ListsSortTrait.php index cefd4e3..37aa7e4 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 生成排序条件 diff --git a/server/app/common/validate/BaseValidate.php b/server/app/common/validate/BaseValidate.php index 9a67a52..bc3f84e 100644 --- a/server/app/common/validate/BaseValidate.php +++ b/server/app/common/validate/BaseValidate.php @@ -28,7 +28,7 @@ class BaseValidate extends Validate * @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 db7989f..590cf0a 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) { -- Gitee From 6ecc58a4219cc5b330caa19fddda28584a3796cd Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 13:18:03 +0800 Subject: [PATCH 13/18] =?UTF-8?q?model=E6=A8=A1=E6=9D=BF=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/generator/core/ModelGenerator.php | 47 +++++++++++++++++-- .../service/generator/stub/php/model.stub | 3 +- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/server/app/common/service/generator/core/ModelGenerator.php b/server/app/common/service/generator/core/ModelGenerator.php index 8187e6f..1b48bd9 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/model.stub b/server/app/common/service/generator/stub/php/model.stub index aa040cb..f8cb435 100644 --- a/server/app/common/service/generator/stub/php/model.stub +++ b/server/app/common/service/generator/stub/php/model.stub @@ -13,12 +13,13 @@ use think\model\relation\HasOne; * {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 -- Gitee From ff6150144455ff021004d986ed7e382fb50bbda3 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 13:49:28 +0800 Subject: [PATCH 14/18] =?UTF-8?q?model=E6=B3=A8=E9=87=8A=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/common/model/Config.php | 28 +++++++++ server/app/common/model/Crontab.php | 52 ++++++++++++++++ server/app/common/model/HotSearch.php | 23 +++++++ server/app/common/model/OperationLog.php | 45 ++++++++++++++ server/app/common/model/article/Article.php | 50 +++++++++++++++ .../app/common/model/article/ArticleCate.php | 26 +++++++- .../common/model/article/ArticleCollect.php | 25 ++++++++ server/app/common/model/auth/Admin.php | 50 ++++++++++++++- server/app/common/model/auth/AdminDept.php | 17 +++++ server/app/common/model/auth/AdminJobs.php | 16 +++++ server/app/common/model/auth/AdminRole.php | 17 ++++- server/app/common/model/auth/AdminSession.php | 28 +++++++++ server/app/common/model/auth/SystemMenu.php | 53 +++++++++++++++- server/app/common/model/auth/SystemRole.php | 24 +++++++ .../app/common/model/auth/SystemRoleMenu.php | 12 +++- .../model/channel/OfficialAccountReply.php | 42 +++++++++++++ .../common/model/decorate/DecoratePage.php | 24 +++++++ .../common/model/decorate/DecorateTabbar.php | 26 ++++++++ server/app/common/model/dept/Dept.php | 35 +++++++++++ server/app/common/model/dept/Jobs.php | 33 ++++++++++ server/app/common/model/dict/DictData.php | 38 ++++++++++++ server/app/common/model/dict/DictType.php | 30 +++++++++ server/app/common/model/file/File.php | 42 +++++++++++++ server/app/common/model/file/FileCate.php | 33 ++++++++++ .../app/common/model/notice/NoticeRecord.php | 47 +++++++++++++- .../app/common/model/notice/NoticeSetting.php | 48 ++++++++++++++ server/app/common/model/notice/SmsLog.php | 44 +++++++++++++ server/app/common/model/pay/PayConfig.php | 30 +++++++++ server/app/common/model/pay/PayWay.php | 24 ++++++- .../common/model/recharge/RechargeOrder.php | 49 ++++++++++++++- server/app/common/model/refund/RefundLog.php | 39 ++++++++++++ .../app/common/model/refund/RefundRecord.php | 47 ++++++++++++++ .../app/common/model/tools/GenerateColumn.php | 53 ++++++++++++++++ .../app/common/model/tools/GenerateTable.php | 56 +++++++++++++++++ server/app/common/model/user/User.php | 62 ++++++++++++++++++- .../app/common/model/user/UserAccountLog.php | 47 ++++++++++++++ server/app/common/model/user/UserAuth.php | 29 ++++++++- server/app/common/model/user/UserSession.php | 23 +++++++ 38 files changed, 1356 insertions(+), 11 deletions(-) diff --git a/server/app/common/model/Config.php b/server/app/common/model/Config.php index 1b75fb6..d7f2ba0 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 9a90549..62c05c0 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 2565e2e..9d41e4e 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 e9a393f..6e581d5 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 edc466a..182ebe6 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 5d6c21f..7de91c0 100644 --- a/server/app/common/model/article/ArticleCate.php +++ b/server/app/common/model/article/ArticleCate.php @@ -22,14 +22,38 @@ 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 HasMany diff --git a/server/app/common/model/article/ArticleCollect.php b/server/app/common/model/article/ArticleCollect.php index 8c683f7..8d06c12 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 3a0d873..7b0adbc 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 0bae455..74ca074 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 6e8c5b3..423c199 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 79433cd..e9c46ba 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 c9f7152..f0272a5 100644 --- a/server/app/common/model/auth/AdminSession.php +++ b/server/app/common/model/auth/AdminSession.php @@ -16,9 +16,37 @@ 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 HasOne diff --git a/server/app/common/model/auth/SystemMenu.php b/server/app/common/model/auth/SystemMenu.php index 246c735..f28469b 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 a649865..36e8306 100644 --- a/server/app/common/model/auth/SystemRole.php +++ b/server/app/common/model/auth/SystemRole.php @@ -22,6 +22,13 @@ 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 { @@ -31,6 +38,23 @@ 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 HasMany diff --git a/server/app/common/model/auth/SystemRoleMenu.php b/server/app/common/model/auth/SystemRoleMenu.php index 238415f..a9ef5a8 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 084d76f..2ca5e27 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 caa980d..9e428e1 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 09b4461..a3d7d35 100644 --- a/server/app/common/model/decorate/DecorateTabbar.php +++ b/server/app/common/model/decorate/DecorateTabbar.php @@ -25,9 +25,35 @@ 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']; diff --git a/server/app/common/model/dept/Dept.php b/server/app/common/model/dept/Dept.php index 5a1cb7c..e01feb6 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 d1c7346..be0acea 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 8773ff3..6b63b04 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 cca9218..ef9e85b 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 b17e5de..af6170d 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 b0e4c92..5ab9e9c 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 60f6d7a..378fa52 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 e8d6ecc..b8a8232 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 短信通知状态 diff --git a/server/app/common/model/notice/SmsLog.php b/server/app/common/model/notice/SmsLog.php index 4c3dedd..f2e8a52 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 30f3d61..4988048 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 8599205..ba3e079 100644 --- a/server/app/common/model/pay/PayWay.php +++ b/server/app/common/model/pay/PayWay.php @@ -18,11 +18,33 @@ 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) { diff --git a/server/app/common/model/recharge/RechargeOrder.php b/server/app/common/model/recharge/RechargeOrder.php index 2465dea..34db50b 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 8429a4d..8457945 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 7b6f3c6..96e9cea 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 8f8c99c..4b764f6 100644 --- a/server/app/common/model/tools/GenerateColumn.php +++ b/server/app/common/model/tools/GenerateColumn.php @@ -12,10 +12,63 @@ 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 BelongsTo diff --git a/server/app/common/model/tools/GenerateTable.php b/server/app/common/model/tools/GenerateTable.php index e90c3e2..94caf94 100644 --- a/server/app/common/model/tools/GenerateTable.php +++ b/server/app/common/model/tools/GenerateTable.php @@ -12,10 +12,66 @@ 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; diff --git a/server/app/common/model/user/User.php b/server/app/common/model/user/User.php index e9fa65e..9f91b32 100644 --- a/server/app/common/model/user/User.php +++ b/server/app/common/model/user/User.php @@ -17,12 +17,72 @@ 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', + ]; /** diff --git a/server/app/common/model/user/UserAccountLog.php b/server/app/common/model/user/UserAccountLog.php index 9c4e688..e5f88a0 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 18f190a..62ac4c0 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 e348e62..29a9aeb 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 -- Gitee From 352bb9750d0e4bb10dc3b32725fbef17774b4fcd Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 14:06:47 +0800 Subject: [PATCH 15/18] =?UTF-8?q?=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/common/model/BaseModel.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/app/common/model/BaseModel.php b/server/app/common/model/BaseModel.php index 456c9ec..cbec1d7 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -59,10 +59,9 @@ use think\Paginator; * @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 static $this find(mixed $data = null) static 查询单个记录 不存在返回Null + * @method static $this findOrEmpty(mixed $data = null) static 查询单个记录 不存在返回空模型 * @method Collection select(mixed $data = null) static 查询多个记录 - * @method Model withAttr(array $name, Closure $closure) 动态定义获取器 * * Class DbManager 数据库管理类 * @package think -- Gitee From 7e4c6d5a22e5adab3be1fdcd7b21330ee731abf1 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 15:11:02 +0800 Subject: [PATCH 16/18] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../logic/article/ArticleCateLogic.php | 2 +- .../adminapi/logic/article/ArticleLogic.php | 2 +- server/app/adminapi/logic/auth/AdminLogic.php | 3 +- server/app/adminapi/logic/auth/AuthLogic.php | 2 +- server/app/adminapi/logic/auth/MenuLogic.php | 2 +- server/app/adminapi/logic/dept/DeptLogic.php | 2 +- server/app/adminapi/logic/dept/JobsLogic.php | 2 +- .../logic/setting/dict/DictTypeLogic.php | 2 +- .../adminapi/service/AdminTokenService.php | 16 +++---- server/app/adminapi/validate/FileValidate.php | 12 ++--- .../app/adminapi/validate/LoginValidate.php | 2 +- .../validate/article/ArticleCateValidate.php | 14 +++--- .../validate/article/ArticleValidate.php | 10 ++-- .../adminapi/validate/auth/AdminValidate.php | 14 +++--- .../adminapi/validate/auth/MenuValidate.php | 14 +++--- .../adminapi/validate/auth/RoleValidate.php | 10 ++-- .../validate/auth/editSelfValidate.php | 2 +- .../validate/crontab/CrontabValidate.php | 14 +++--- .../adminapi/validate/dept/DeptValidate.php | 14 +++--- .../adminapi/validate/dept/JobsValidate.php | 10 ++-- .../validate/dict/DictDataValidate.php | 10 ++-- .../validate/dict/DictTypeValidate.php | 10 ++-- .../validate/notice/NoticeValidate.php | 2 +- .../validate/notice/SmsConfigValidate.php | 2 +- .../recharge/RechargeRefundValidate.php | 8 ++-- .../validate/setting/PayConfigValidate.php | 6 +-- .../validate/setting/StorageValidate.php | 6 +-- .../setting/TransactionSettingsValidate.php | 2 +- .../validate/setting/UserConfigValidate.php | 4 +- .../validate/tools/EditTableValidate.php | 4 +- .../validate/tools/GenerateTableValidate.php | 10 ++-- .../validate/user/AdjustUserMoney.php | 2 +- .../adminapi/validate/user/UserValidate.php | 6 +-- server/app/api/lists/AccountLogLists.php | 2 +- server/app/api/lists/BaseApiDataLists.php | 2 +- server/app/api/lists/article/ArticleLists.php | 2 +- server/app/api/logic/ArticleLogic.php | 8 ++-- server/app/api/logic/LoginLogic.php | 28 +++++------ server/app/api/logic/PcLogic.php | 2 +- server/app/api/logic/RechargeLogic.php | 4 +- server/app/api/logic/SearchLogic.php | 2 +- server/app/api/logic/SmsLogic.php | 2 +- server/app/api/logic/UserLogic.php | 14 +++--- server/app/api/logic/WechatLogic.php | 2 +- server/app/api/service/UserTokenService.php | 14 +++--- server/app/api/service/WechatUserService.php | 14 +++--- .../app/api/validate/LoginAccountValidate.php | 6 +-- server/app/api/validate/PasswordValidate.php | 4 +- server/app/api/validate/PayValidate.php | 4 +- server/app/api/validate/RechargeValidate.php | 4 +- .../app/api/validate/SetUserInfoValidate.php | 2 +- server/app/api/validate/UserValidate.php | 4 +- .../app/api/validate/WebScanLoginValidate.php | 2 +- .../app/api/validate/WechatLoginValidate.php | 8 ++-- server/app/api/validate/WechatValidate.php | 2 +- .../common/cache/AdminAccountSafeCache.php | 12 ++--- server/app/common/cache/AdminAuthCache.php | 22 ++++----- server/app/common/cache/AdminTokenCache.php | 14 +++--- server/app/common/cache/BaseCache.php | 4 +- server/app/common/cache/ExportCache.php | 8 ++-- .../app/common/cache/UserAccountSafeCache.php | 12 ++--- server/app/common/cache/UserTokenCache.php | 8 ++-- server/app/common/cache/WebScanLoginCache.php | 8 ++-- server/app/common/enum/DefaultEnum.php | 20 ++++---- server/app/common/enum/GeneratorEnum.php | 4 +- server/app/common/enum/MenuEnum.php | 4 +- .../app/common/enum/OfficialAccountEnum.php | 4 +- server/app/common/enum/PayEnum.php | 8 ++-- server/app/common/enum/RefundEnum.php | 12 ++--- server/app/common/enum/YesNoEnum.php | 4 +- server/app/common/enum/notice/NoticeEnum.php | 46 +++++++++---------- server/app/common/enum/notice/SmsEnum.php | 4 +- .../app/common/enum/user/AccountLogEnum.php | 20 ++++---- server/app/common/enum/user/UserEnum.php | 4 +- .../app/common/enum/user/UserTerminalEnum.php | 4 +- server/app/common/exception/Handler.php | 2 +- server/app/common/exception/HttpException.php | 5 +- .../http/middleware/AllowMiddleware.php | 2 +- server/app/common/lists/BaseDataLists.php | 12 ++--- server/app/common/lists/ListsExcelTrait.php | 10 ++-- server/app/common/lists/ListsSearchTrait.php | 2 +- server/app/common/lists/ListsSortTrait.php | 2 +- server/app/common/logic/AccountLogLogic.php | 2 +- server/app/common/logic/BaseLogic.php | 10 ++-- server/app/common/logic/NoticeLogic.php | 12 ++--- server/app/common/logic/PayNotifyLogic.php | 4 +- server/app/common/logic/PaymentLogic.php | 10 ++-- server/app/common/logic/RefundLogic.php | 12 ++--- .../app/common/model/notice/NoticeSetting.php | 14 +++--- server/app/common/service/ConfigService.php | 5 +- server/app/common/service/FileService.php | 4 +- server/app/common/service/NoticeService.php | 2 +- .../service/generator/GenerateService.php | 10 ++-- .../app/common/service/pay/BasePayService.php | 14 +++--- .../common/service/pay/WeChatPayService.php | 28 +++++------ server/app/common/service/sms/SmsDriver.php | 14 +++--- .../common/service/sms/SmsMessageService.php | 14 +++--- .../app/common/service/sms/engine/AliSms.php | 22 ++++----- .../common/service/sms/engine/TencentSms.php | 23 +++++----- server/app/common/service/storage/Driver.php | 34 +++++++------- .../service/wechat/WeChatConfigService.php | 2 +- .../service/wechat/WeChatMnpService.php | 10 ++-- .../common/service/wechat/WeChatOaService.php | 16 +++---- .../service/wechat/WeChatRequestService.php | 6 +-- 104 files changed, 441 insertions(+), 437 deletions(-) diff --git a/server/app/adminapi/logic/article/ArticleCateLogic.php b/server/app/adminapi/logic/article/ArticleCateLogic.php index df3334e..901e744 100644 --- a/server/app/adminapi/logic/article/ArticleCateLogic.php +++ b/server/app/adminapi/logic/article/ArticleCateLogic.php @@ -37,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'], diff --git a/server/app/adminapi/logic/article/ArticleLogic.php b/server/app/adminapi/logic/article/ArticleLogic.php index ad23acc..c6a07a8 100644 --- a/server/app/adminapi/logic/article/ArticleLogic.php +++ b/server/app/adminapi/logic/article/ArticleLogic.php @@ -33,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'], diff --git a/server/app/adminapi/logic/auth/AdminLogic.php b/server/app/adminapi/logic/auth/AdminLogic.php index 8fba15f..d4336e3 100644 --- a/server/app/adminapi/logic/auth/AdminLogic.php +++ b/server/app/adminapi/logic/auth/AdminLogic.php @@ -42,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 { diff --git a/server/app/adminapi/logic/auth/AuthLogic.php b/server/app/adminapi/logic/auth/AuthLogic.php index 7895512..64ed9b2 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([ diff --git a/server/app/adminapi/logic/auth/MenuLogic.php b/server/app/adminapi/logic/auth/MenuLogic.php index 60563da..6c7c1ec 100644 --- a/server/app/adminapi/logic/auth/MenuLogic.php +++ b/server/app/adminapi/logic/auth/MenuLogic.php @@ -73,7 +73,7 @@ class MenuLogic extends BaseLogic * @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'], diff --git a/server/app/adminapi/logic/dept/DeptLogic.php b/server/app/adminapi/logic/dept/DeptLogic.php index 8d69eae..3f09a2e 100644 --- a/server/app/adminapi/logic/dept/DeptLogic.php +++ b/server/app/adminapi/logic/dept/DeptLogic.php @@ -112,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'], diff --git a/server/app/adminapi/logic/dept/JobsLogic.php b/server/app/adminapi/logic/dept/JobsLogic.php index a6c26da..81ddb32 100644 --- a/server/app/adminapi/logic/dept/JobsLogic.php +++ b/server/app/adminapi/logic/dept/JobsLogic.php @@ -38,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'], diff --git a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php index 022b899..bc1b2e3 100644 --- a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php +++ b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php @@ -39,7 +39,7 @@ class DictTypeLogic extends BaseLogic * @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'], diff --git a/server/app/adminapi/service/AdminTokenService.php b/server/app/adminapi/service/AdminTokenService.php index 94b2906..e75973e 100644 --- a/server/app/adminapi/service/AdminTokenService.php +++ b/server/app/adminapi/service/AdminTokenService.php @@ -15,9 +15,9 @@ 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 DataNotFoundException * @throws DbException @@ -25,7 +25,7 @@ class AdminTokenService * @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(); @@ -62,7 +62,7 @@ class AdminTokenService /** * @notes 延长token过期时间 - * @param $token + * @param string $token * @return array|false|mixed * @throws DataNotFoundException * @throws DbException @@ -70,7 +70,7 @@ class AdminTokenService * @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(); @@ -86,7 +86,7 @@ class AdminTokenService /** * @notes 设置token为过期 - * @param $token + * @param string $token * @return bool * @throws DataNotFoundException * @throws DbException @@ -94,7 +94,7 @@ class AdminTokenService * @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 e9ba0a1..09cd48f 100644 --- a/server/app/adminapi/validate/FileValidate.php +++ b/server/app/adminapi/validate/FileValidate.php @@ -34,7 +34,7 @@ class FileValidate extends BaseValidate * @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 3b8b7ec..96be64c 100644 --- a/server/app/adminapi/validate/LoginValidate.php +++ b/server/app/adminapi/validate/LoginValidate.php @@ -39,7 +39,7 @@ class LoginValidate extends BaseValidate * @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 5f3c6af..c051346 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 13898d9..ad117e5 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 2e12c37..c8db5e4 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 3a52b2a..bbb1b23 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 042fbe2..157fbfa 100644 --- a/server/app/adminapi/validate/auth/RoleValidate.php +++ b/server/app/adminapi/validate/auth/RoleValidate.php @@ -48,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']); } @@ -59,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']); } @@ -70,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'); @@ -89,7 +89,7 @@ class RoleValidate extends BaseValidate * @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 '角色不存在'; @@ -111,7 +111,7 @@ class RoleValidate extends BaseValidate * @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 34c7251..a3d73e0 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 d21e157..34b0546 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 dfede9d..bed327b 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 1208201..ae4407e 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 9b5f08b..c1673c1 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 381f198..62a1986 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 fd94482..b3583d9 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 700a0bc..10a2ed0 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 cba99e0..b01d31e 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 1a1857c..421a383 100644 --- a/server/app/adminapi/validate/setting/PayConfigValidate.php +++ b/server/app/adminapi/validate/setting/PayConfigValidate.php @@ -43,7 +43,7 @@ class PayConfigValidate extends BaseValidate 'config.require' => '支付参数缺失', ]; - public function sceneGet() + public function sceneGet(): PayConfigValidate { return $this->only(['id']); } @@ -61,7 +61,7 @@ class PayConfigValidate extends BaseValidate * @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)) { @@ -118,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 83b6a18..231b6e0 100644 --- a/server/app/adminapi/validate/setting/StorageValidate.php +++ b/server/app/adminapi/validate/setting/StorageValidate.php @@ -21,7 +21,7 @@ class StorageValidate extends BaseValidate * @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 8c0e6e7..1f1ed20 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 3f890cf..764d14c 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 8cba12d..9f7456c 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 7edcfe1..7804fd3 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,7 +76,7 @@ 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'])) { @@ -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 69a58d4..009560a 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 6205dec..3f96ee2 100644 --- a/server/app/adminapi/validate/user/UserValidate.php +++ b/server/app/adminapi/validate/user/UserValidate.php @@ -31,7 +31,7 @@ class UserValidate extends BaseValidate * @author 乔峰 * @date 2022/9/22 16:35 */ - public function sceneDetail() + public function sceneDetail(): UserValidate { return $this->only(['id']); } @@ -49,7 +49,7 @@ class UserValidate extends BaseValidate * @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]; @@ -71,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/lists/AccountLogLists.php b/server/app/api/lists/AccountLogLists.php index be32307..b169b9e 100644 --- a/server/app/api/lists/AccountLogLists.php +++ b/server/app/api/lists/AccountLogLists.php @@ -35,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]; diff --git a/server/app/api/lists/BaseApiDataLists.php b/server/app/api/lists/BaseApiDataLists.php index c1c3f2a..ee4a6b3 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 c322bf3..8c07cc6 100644 --- a/server/app/api/lists/article/ArticleLists.php +++ b/server/app/api/lists/article/ArticleLists.php @@ -52,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'])) { diff --git a/server/app/api/logic/ArticleLogic.php b/server/app/api/logic/ArticleLogic.php index 2f728b0..165ee1a 100644 --- a/server/app/api/logic/ArticleLogic.php +++ b/server/app/api/logic/ArticleLogic.php @@ -40,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); @@ -58,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(); @@ -84,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, @@ -103,7 +103,7 @@ class ArticleLogic extends BaseLogic * @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/LoginLogic.php b/server/app/api/logic/LoginLogic.php index cfa5a2f..0758e07 100644 --- a/server/app/api/logic/LoginLogic.php +++ b/server/app/api/logic/LoginLogic.php @@ -50,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(); @@ -82,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 { // 账号/手机号 密码登录 @@ -133,7 +133,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/16 17:56 */ - public static function logout($userInfo) + public static function logout($userInfo): bool { //token不存在,不注销 if (!isset($userInfo['token'])) { @@ -152,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); } @@ -166,7 +166,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/20 19:47 */ - public static function oaLogin(array $params) + public static function oaLogin(array $params): false|array { Db::startTrans(); try { @@ -196,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 @@ -224,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 { @@ -253,7 +253,7 @@ class LoginLogic extends BaseLogic * @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()) { @@ -275,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 @@ -300,7 +300,7 @@ class LoginLogic extends BaseLogic * @author 段誉 * @date 2022/9/16 10:43 */ - public static function oaAuthLogin(array $params) + public static function oaAuthLogin(array $params): bool { try { //通过code获取微信openid @@ -325,7 +325,7 @@ class LoginLogic extends BaseLogic * @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(); @@ -359,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(); @@ -388,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 { @@ -428,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 988add8..9ca463c 100644 --- a/server/app/api/logic/PcLogic.php +++ b/server/app/api/logic/PcLogic.php @@ -45,7 +45,7 @@ class PcLogic extends BaseLogic * @author 段誉 * @date 2022/9/21 19:15 */ - public static function getIndexData() + public static function getIndexData(): array { // 装修配置 $decoratePage = DecoratePage::findOrEmpty(4); diff --git a/server/app/api/logic/RechargeLogic.php b/server/app/api/logic/RechargeLogic.php index 005a23d..7c70412 100644 --- a/server/app/api/logic/RechargeLogic.php +++ b/server/app/api/logic/RechargeLogic.php @@ -37,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 = [ @@ -67,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 6a510f0..9a5d8e4 100644 --- a/server/app/api/logic/SearchLogic.php +++ b/server/app/api/logic/SearchLogic.php @@ -39,7 +39,7 @@ class SearchLogic extends BaseLogic * @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 2faf6fa..4bc5639 100644 --- a/server/app/api/logic/SmsLogic.php +++ b/server/app/api/logic/SmsLogic.php @@ -35,7 +35,7 @@ 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']); diff --git a/server/app/api/logic/UserLogic.php b/server/app/api/logic/UserLogic.php index 187ac73..c7f7a09 100644 --- a/server/app/api/logic/UserLogic.php +++ b/server/app/api/logic/UserLogic.php @@ -72,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') @@ -93,7 +93,7 @@ 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([ @@ -114,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]; @@ -132,7 +132,7 @@ 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 { // 校验验证码 @@ -166,7 +166,7 @@ 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); @@ -208,7 +208,7 @@ class UserLogic extends BaseLogic * @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']); @@ -247,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 { // 变更手机号场景 diff --git a/server/app/api/logic/WechatLogic.php b/server/app/api/logic/WechatLogic.php index bceb2eb..a610b78 100644 --- a/server/app/api/logic/WechatLogic.php +++ b/server/app/api/logic/WechatLogic.php @@ -35,7 +35,7 @@ class WechatLogic extends BaseLogic * @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/service/UserTokenService.php b/server/app/api/service/UserTokenService.php index 72a05a0..249abd7 100644 --- a/server/app/api/service/UserTokenService.php +++ b/server/app/api/service/UserTokenService.php @@ -27,8 +27,8 @@ class UserTokenService /** * @notes 设置或更新用户token - * @param $userId - * @param $terminal + * @param int $userId + * @param int $terminal * @return array|false|mixed * @throws DataNotFoundException * @throws DbException @@ -36,7 +36,7 @@ class UserTokenService * @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(); @@ -70,7 +70,7 @@ class UserTokenService /** * @notes 延长token过期时间 - * @param $token + * @param string $token * @return array|false|mixed * @throws DataNotFoundException * @throws DbException @@ -78,7 +78,7 @@ class UserTokenService * @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(); @@ -93,7 +93,7 @@ class UserTokenService /** * @notes 设置token为过期 - * @param $token + * @param string $token * @return bool * @throws DataNotFoundException * @throws DbException @@ -101,7 +101,7 @@ class UserTokenService * @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 6610064..f35552f 100644 --- a/server/app/api/service/WechatUserService.php +++ b/server/app/api/service/WechatUserService.php @@ -35,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; @@ -101,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(); @@ -119,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('您的账号异常,请联系客服。'); diff --git a/server/app/api/validate/LoginAccountValidate.php b/server/app/api/validate/LoginAccountValidate.php index 3885775..00a2a3d 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 a227730..da86c46 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 65b736b..ea5822b 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 31fb9fd..798d488 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 7020c96..72a2559 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 c214a27..162fca4 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 2cbdb48..10e605d 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 323a5ed..61b7624 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 9cfa30b..86f313f 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 b03be56..8809d94 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 8eba810..580935d 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 275b9fc..44defc9 100644 --- a/server/app/common/cache/AdminTokenCache.php +++ b/server/app/common/cache/AdminTokenCache.php @@ -16,16 +16,16 @@ 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); @@ -44,7 +44,7 @@ class AdminTokenCache extends BaseCache /** * @notes 通过有效token设置管理信息缓存 - * @param $token + * @param string $token * @return array|false|mixed * @throws DataNotFoundException * @throws DbException @@ -52,7 +52,7 @@ class AdminTokenCache extends BaseCache * @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(); @@ -92,12 +92,12 @@ class AdminTokenCache extends BaseCache /** * @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 d4a09c6..b9b1625 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 9bb4d44..ce15990 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 4412f62..4a4cd80 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 2976c9e..c4e8eb4 100644 --- a/server/app/common/cache/UserTokenCache.php +++ b/server/app/common/cache/UserTokenCache.php @@ -25,7 +25,7 @@ use think\db\exception\ModelNotFoundException; class UserTokenCache extends BaseCache { - private $prefix = 'token_user_'; + private string $prefix = 'token_user_'; /** @@ -38,7 +38,7 @@ class UserTokenCache extends BaseCache * @author 段誉 * @date 2022/9/16 10:11 */ - public function getUserInfo($token) + public function getUserInfo($token): mixed { //直接从缓存获取 $userInfo = $this->get($this->prefix . $token); @@ -66,7 +66,7 @@ class UserTokenCache extends BaseCache * @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)) { @@ -100,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 1e16cc3..b32e18a 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/enum/DefaultEnum.php b/server/app/common/enum/DefaultEnum.php index 322148d..cfdf558 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 56a6030..a46e0cf 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 8889c4e..696456b 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 9478f94..0b04203 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 915fe27..dc0c705 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 0722d30..d2f30ec 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 dcea136..9c377cb 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 c59e318..7d43233 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 + * @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 + * @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 d1bc220..f290ace 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 ed8335e..b337f50 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 9b85d5b..1cf549d 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 87fdf88..5921088 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/Handler.php b/server/app/common/exception/Handler.php index 598a15d..f792daa 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 516ff5d..ba3e726 100644 --- a/server/app/common/exception/HttpException.php +++ b/server/app/common/exception/HttpException.php @@ -8,7 +8,7 @@ use Throwable; class HttpException extends RuntimeException { - protected $response = null; + protected ?\support\Response $response = null; public function __construct($message = "", $code = 0, $header=[],Throwable $previous = null) { @@ -17,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 5bd2961..747532f 100644 --- a/server/app/common/http/middleware/AllowMiddleware.php +++ b/server/app/common/http/middleware/AllowMiddleware.php @@ -55,7 +55,7 @@ class AllowMiddleware implements MiddlewareInterface })); $fiber->start(); }catch (Exception|Throwable $e){ - Log::error('请求日志记录失败:'.$e->getMessage()); +// Log::error('请求日志记录失败:'.$e->getMessage()); } } diff --git a/server/app/common/lists/BaseDataLists.php b/server/app/common/lists/BaseDataLists.php index b88db71..1ae9ea6 100644 --- a/server/app/common/lists/BaseDataLists.php +++ b/server/app/common/lists/BaseDataLists.php @@ -30,8 +30,8 @@ abstract class BaseDataLists implements ListsInterface protected string $orderBy; protected string $field; - protected int $startTime; - protected int $endTime; + protected int|null $startTime = null; + protected int|null $endTime = null; protected string|null $start; protected string|null $end; @@ -70,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'); @@ -97,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 []; @@ -123,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 []; @@ -141,7 +141,7 @@ abstract class BaseDataLists implements ListsInterface * @author 令狐冲 * @date 2021/7/31 01:15 */ - private function initExport() + private function initExport(): Response|false { $this->export = $this->request->get('export', 0); diff --git a/server/app/common/lists/ListsExcelTrait.php b/server/app/common/lists/ListsExcelTrait.php index f626917..ac7a553 100644 --- a/server/app/common/lists/ListsExcelTrait.php +++ b/server/app/common/lists/ListsExcelTrait.php @@ -13,9 +13,9 @@ 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 @@ -27,7 +27,7 @@ trait ListsExcelTrait * @author 令狐冲 * @date 2021/7/21 16:04 */ - public function createExcel($excelFields, $lists) + public function createExcel($excelFields, $lists): string { $title = array_values($excelFields); @@ -101,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/ListsSearchTrait.php b/server/app/common/lists/ListsSearchTrait.php index 2cffdc6..0215a38 100644 --- a/server/app/common/lists/ListsSearchTrait.php +++ b/server/app/common/lists/ListsSearchTrait.php @@ -18,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 37aa7e4..bd456a7 100644 --- a/server/app/common/lists/ListsSortTrait.php +++ b/server/app/common/lists/ListsSortTrait.php @@ -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 87ae3e0..ff3ca03 100644 --- a/server/app/common/logic/AccountLogLogic.php +++ b/server/app/common/logic/AccountLogLogic.php @@ -28,7 +28,7 @@ class AccountLogLogic extends BaseLogic * @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 cd9a279..a2728dd 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 5d02f63..c4a6b8a 100644 --- a/server/app/common/logic/NoticeLogic.php +++ b/server/app/common/logic/NoticeLogic.php @@ -39,7 +39,7 @@ 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(); @@ -71,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'])) { @@ -99,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'; @@ -120,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 . '}'; @@ -141,7 +141,7 @@ class NoticeLogic extends BaseLogic * @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, @@ -165,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 b74c31d..0c369d5 100644 --- a/server/app/common/logic/PayNotifyLogic.php +++ b/server/app/common/logic/PayNotifyLogic.php @@ -18,7 +18,7 @@ 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 { @@ -47,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 bdf2078..9cd2bad 100644 --- a/server/app/common/logic/PaymentLogic.php +++ b/server/app/common/logic/PaymentLogic.php @@ -30,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') { @@ -87,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 = []; @@ -131,7 +131,7 @@ class PaymentLogic extends BaseLogic * @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']) { @@ -165,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']; @@ -215,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 2f66e16..9f32742 100644 --- a/server/app/common/logic/RefundLogic.php +++ b/server/app/common/logic/RefundLogic.php @@ -36,7 +36,7 @@ use Exception; class RefundLogic extends BaseLogic { - protected static $refundLog; + protected static mixed $refundLog; /** @@ -50,7 +50,7 @@ class RefundLogic extends BaseLogic * @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); @@ -87,7 +87,7 @@ class RefundLogic extends BaseLogic * @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('订单金额异常'); @@ -104,7 +104,7 @@ class RefundLogic extends BaseLogic * @author bingo * @date 2023/2/28 17:19 */ - public static function wechatPayRefund($order, $refundAmount) + public static function wechatPayRefund($order, $refundAmount): void { // 发起退款。 若发起退款请求返回明确错误,退款日志和记录标记状态为退款失败 // 退款日志及记录的成功状态目前统一由定时任务查询退款结果为退款成功后才标记成功 @@ -125,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([ @@ -153,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/notice/NoticeSetting.php b/server/app/common/model/notice/NoticeSetting.php index b8a8232..1534afd 100644 --- a/server/app/common/model/notice/NoticeSetting.php +++ b/server/app/common/model/notice/NoticeSetting.php @@ -78,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); @@ -96,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']); } @@ -109,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 => '买家', @@ -125,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); } @@ -137,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); } @@ -149,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); } @@ -161,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/service/ConfigService.php b/server/app/common/service/ConfigService.php index 4700249..4485263 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 17e7778..cc79d0b 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/NoticeService.php b/server/app/common/service/NoticeService.php index 1e72549..fa02911 100644 --- a/server/app/common/service/NoticeService.php +++ b/server/app/common/service/NoticeService.php @@ -12,7 +12,7 @@ use support\Log; */ class NoticeService { - public function handle($params) + public function handle($params): true|string { try { if (empty($params['scene_id'])) { diff --git a/server/app/common/service/generator/GenerateService.php b/server/app/common/service/generator/GenerateService.php index f6dd1e2..335a7cf 100644 --- a/server/app/common/service/generator/GenerateService.php +++ b/server/app/common/service/generator/GenerateService.php @@ -27,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() { diff --git a/server/app/common/service/pay/BasePayService.php b/server/app/common/service/pay/BasePayService.php index 187038f..34e8066 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 751e4ff..5c6825e 100644 --- a/server/app/common/service/pay/WeChatPayService.php +++ b/server/app/common/service/pay/WeChatPayService.php @@ -45,28 +45,28 @@ class WeChatPayService extends BasePayService * 授权信息 * @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; /** @@ -93,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) { @@ -144,7 +144,7 @@ class WeChatPayService extends BasePayService * @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, @@ -178,7 +178,7 @@ class WeChatPayService extends BasePayService * @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, @@ -208,7 +208,7 @@ class WeChatPayService extends BasePayService * @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, @@ -239,7 +239,7 @@ class WeChatPayService extends BasePayService * @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, @@ -279,7 +279,7 @@ class WeChatPayService extends BasePayService * @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'], @@ -318,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' => '商品', @@ -335,7 +335,7 @@ class WeChatPayService extends BasePayService * @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']); @@ -353,7 +353,7 @@ class WeChatPayService extends BasePayService * @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); } @@ -369,7 +369,7 @@ class WeChatPayService extends BasePayService * @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 5eaf6fb..791355d 100644 --- a/server/app/common/service/sms/SmsDriver.php +++ b/server/app/common/service/sms/SmsDriver.php @@ -48,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; /** * 架构方法 @@ -115,7 +115,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -129,7 +129,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function send($mobile, $data) + public function send($mobile, $data): mixed { try { // 发送频率限制 @@ -158,7 +158,7 @@ class SmsDriver * @author 段誉 * @date 2022/9/15 16:29 */ - public function sendLimit($mobile) + public function sendLimit($mobile): void { $smsLog = SmsLog::where([ ['mobile', '=', $mobile], @@ -182,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 6fc616c..76a436c 100644 --- a/server/app/common/service/sms/SmsMessageService.php +++ b/server/app/common/service/sms/SmsMessageService.php @@ -45,10 +45,10 @@ use think\Model; */ class SmsMessageService { - protected $notice; - protected $smsLog; + protected mixed $notice; + protected mixed $smsLog; - public function send($params) + public function send($params): true { try { // 通知设置 @@ -90,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) { @@ -109,7 +109,7 @@ class SmsMessageService * @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'], @@ -131,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); // 阿里云 且是 验证码类型 @@ -186,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 7bfc488..667c346 100644 --- a/server/app/common/service/sms/engine/AliSms.php +++ b/server/app/common/service/sms/engine/AliSms.php @@ -23,11 +23,11 @@ use Exception; */ 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) { @@ -41,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; @@ -60,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; @@ -74,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; @@ -87,7 +87,7 @@ class AliSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -99,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']) diff --git a/server/app/common/service/sms/engine/TencentSms.php b/server/app/common/service/sms/engine/TencentSms.php index 5c6df64..e18bbbc 100644 --- a/server/app/common/service/sms/engine/TencentSms.php +++ b/server/app/common/service/sms/engine/TencentSms.php @@ -28,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)) { @@ -46,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; @@ -65,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; @@ -79,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; @@ -92,7 +91,7 @@ class TencentSms * @author 段誉 * @date 2022/9/15 16:27 */ - public function getError() + public function getError(): string|null { return $this->error; } @@ -104,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']); diff --git a/server/app/common/service/storage/Driver.php b/server/app/common/service/storage/Driver.php index ce7fac6..6a4a4d2 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/wechat/WeChatConfigService.php b/server/app/common/service/wechat/WeChatConfigService.php index 9a0a344..0183855 100644 --- a/server/app/common/service/wechat/WeChatConfigService.php +++ b/server/app/common/service/wechat/WeChatConfigService.php @@ -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: diff --git a/server/app/common/service/wechat/WeChatMnpService.php b/server/app/common/service/wechat/WeChatMnpService.php index 7a749d2..95661f9 100644 --- a/server/app/common/service/wechat/WeChatMnpService.php +++ b/server/app/common/service/wechat/WeChatMnpService.php @@ -35,9 +35,9 @@ use Symfony\Contracts\HttpClient\ResponseInterface; class WeChatMnpService { - protected $app; + protected Application $app; - protected $config; + protected array $config; public function __construct() { @@ -53,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'])) { @@ -78,7 +78,7 @@ class WeChatMnpService * @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); @@ -99,7 +99,7 @@ class WeChatMnpService * @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 76379c6..0386231 100644 --- a/server/app/common/service/wechat/WeChatOaService.php +++ b/server/app/common/service/wechat/WeChatOaService.php @@ -38,9 +38,9 @@ use Throwable; class WeChatOaService { - protected $app; + protected Application $app; - protected $config; + protected array $config; public function __construct() @@ -59,7 +59,7 @@ class WeChatOaService * @author 段誉 * @date 2023/2/27 14:22 */ - public function getServer() + public function getServer(): Server|\EasyWeChat\Kernel\Contracts\Server { return $this->app->getServer(); } @@ -72,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'])) { @@ -91,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']) @@ -114,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']) @@ -131,7 +131,7 @@ class WeChatOaService * @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', [ @@ -161,7 +161,7 @@ class WeChatOaService * @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 317b111..eecd72e 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; -- Gitee From d777c5f300d1799941158142cc240084c7bcca42 Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 15:22:00 +0800 Subject: [PATCH 17/18] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/app/adminapi/logic/ConfigLogic.php | 2 +- server/app/adminapi/logic/FileLogic.php | 2 +- server/app/adminapi/logic/LoginLogic.php | 4 ++-- server/app/adminapi/logic/WorkbenchLogic.php | 4 ++-- .../logic/article/ArticleCateLogic.php | 6 ++--- .../adminapi/logic/article/ArticleLogic.php | 4 ++-- server/app/adminapi/logic/auth/AdminLogic.php | 10 ++++----- server/app/adminapi/logic/auth/AuthLogic.php | 2 +- server/app/adminapi/logic/auth/MenuLogic.php | 14 ++++++------ server/app/adminapi/logic/auth/RoleLogic.php | 4 ++-- .../logic/channel/AppSettingLogic.php | 4 ++-- .../logic/channel/MnpSettingsLogic.php | 4 ++-- .../channel/OfficialAccountMenuLogic.php | 12 +++++----- .../channel/OfficialAccountReplyLogic.php | 14 ++++++------ .../channel/OfficialAccountSettingLogic.php | 4 ++-- .../logic/channel/OpenSettingLogic.php | 4 ++-- .../logic/channel/WebPageSettingLogic.php | 4 ++-- .../adminapi/logic/crontab/CrontabLogic.php | 12 +++++----- .../logic/decorate/DecorateDataLogic.php | 2 +- .../logic/decorate/DecoratePageLogic.php | 4 ++-- server/app/adminapi/logic/dept/DeptLogic.php | 10 ++++----- server/app/adminapi/logic/dept/JobsLogic.php | 4 ++-- .../adminapi/logic/finance/RefundLogic.php | 4 ++-- .../app/adminapi/logic/notice/NoticeLogic.php | 14 ++++++------ .../adminapi/logic/notice/SmsConfigLogic.php | 11 +++++----- .../adminapi/logic/recharge/RechargeLogic.php | 8 +++---- .../logic/setting/CustomerServiceLogic.php | 4 ++-- .../adminapi/logic/setting/HotSearchLogic.php | 4 ++-- .../adminapi/logic/setting/StorageLogic.php | 8 +++---- .../setting/TransactionSettingsLogic.php | 4 ++-- .../logic/setting/dict/DictDataLogic.php | 4 ++-- .../logic/setting/dict/DictTypeLogic.php | 6 ++--- .../logic/setting/pay/PayConfigLogic.php | 4 ++-- .../logic/setting/pay/PayWayLogic.php | 4 ++-- .../logic/setting/system/CacheLogic.php | 2 +- .../logic/setting/web/WebSettingLogic.php | 6 ++--- .../adminapi/logic/tools/GeneratorLogic.php | 22 +++++++++---------- server/app/adminapi/logic/user/UserLogic.php | 4 ++-- server/app/common/model/BaseModel.php | 16 +++++++------- 39 files changed, 128 insertions(+), 127 deletions(-) diff --git a/server/app/adminapi/logic/ConfigLogic.php b/server/app/adminapi/logic/ConfigLogic.php index 0762be4..dfb52a5 100644 --- a/server/app/adminapi/logic/ConfigLogic.php +++ b/server/app/adminapi/logic/ConfigLogic.php @@ -66,7 +66,7 @@ class ConfigLogic * @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 2017d08..4e8cc76 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 c1e3129..866b03d 100644 --- a/server/app/adminapi/logic/LoginLogic.php +++ b/server/app/adminapi/logic/LoginLogic.php @@ -40,7 +40,7 @@ class LoginLogic extends BaseLogic * @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(); @@ -75,7 +75,7 @@ class LoginLogic extends BaseLogic * @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 94ee46f..e48964e 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 901e744..fa1e9ae 100644 --- a/server/app/adminapi/logic/article/ArticleCateLogic.php +++ b/server/app/adminapi/logic/article/ArticleCateLogic.php @@ -77,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']); } @@ -101,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'], @@ -120,7 +120,7 @@ class ArticleCateLogic extends BaseLogic * @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 c6a07a8..59105e5 100644 --- a/server/app/adminapi/logic/article/ArticleLogic.php +++ b/server/app/adminapi/logic/article/ArticleLogic.php @@ -87,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']); } @@ -111,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 d4336e3..cfb3c96 100644 --- a/server/app/adminapi/logic/auth/AdminLogic.php +++ b/server/app/adminapi/logic/auth/AdminLogic.php @@ -245,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'], @@ -273,7 +273,7 @@ class AdminLogic extends BaseLogic * @author 乔峰 * @date 2022/11/25 14:23 */ - public static function insertRole($adminId, $roleIds) + public static function insertRole($adminId, $roleIds): void { if (!empty($roleIds)) { // 角色 @@ -297,7 +297,7 @@ class AdminLogic extends BaseLogic * @author 乔峰 * @date 2022/11/25 14:22 */ - public static function insertDept($adminId, $deptIds) + public static function insertDept($adminId, $deptIds): void { // 部门 if (!empty($deptIds)) { @@ -321,7 +321,7 @@ class AdminLogic extends BaseLogic * @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 64ed9b2..9f0a3fd 100644 --- a/server/app/adminapi/logic/auth/AuthLogic.php +++ b/server/app/adminapi/logic/auth/AuthLogic.php @@ -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 6c7c1ec..8b9bbb5 100644 --- a/server/app/adminapi/logic/auth/MenuLogic.php +++ b/server/app/adminapi/logic/auth/MenuLogic.php @@ -45,7 +45,7 @@ class MenuLogic extends BaseLogic * @author 乔峰 * @date 2022/7/1 10:50 */ - public static function getMenuByAdminId($adminId) + public static function getMenuByAdminId($adminId): array { $admin = Admin::findOrEmpty($adminId); @@ -100,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'], @@ -128,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(); } @@ -140,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']); @@ -152,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'], @@ -174,7 +174,7 @@ class MenuLogic extends BaseLogic * @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 d15e503..581adda 100644 --- a/server/app/adminapi/logic/auth/RoleLogic.php +++ b/server/app/adminapi/logic/auth/RoleLogic.php @@ -126,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(); @@ -163,7 +163,7 @@ class RoleLogic extends BaseLogic * @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 978cc01..9bc2811 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 fb099b8..6697e72 100644 --- a/server/app/adminapi/logic/channel/MnpSettingsLogic.php +++ b/server/app/adminapi/logic/channel/MnpSettingsLogic.php @@ -31,7 +31,7 @@ class MnpSettingsLogic extends BaseLogic * @author ljj * @date 2022/2/16 9:38 上午 */ - public function getConfig() + public function getConfig(): array { $domainName = str_replace(['http://','https://'],'',getAgreementHost()); $qrCode = ConfigService::get('mnp_setting', 'qr_code', ''); @@ -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 40b1823..de332c1 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountMenuLogic.php @@ -35,7 +35,7 @@ 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); @@ -55,7 +55,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @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('请设置正确格式菜单'); @@ -102,7 +102,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @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('二级菜单须为数组格式'); @@ -137,7 +137,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:55 */ - public static function checkType($item) + public static function checkType($item): void { switch ($item['type']) { // 关键字 @@ -175,7 +175,7 @@ class OfficialAccountMenuLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:55 */ - public static function saveAndPublish($params) + public static function saveAndPublish($params): bool { try { self::checkMenu($params); @@ -202,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 4d784a7..371040a 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountReplyLogic.php @@ -44,7 +44,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 10:57 */ - public static function add($params) + public static function add($params): bool { try { // 关键字回复排序值须大于0 @@ -71,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'; @@ -86,7 +86,7 @@ class OfficialAccountReplyLogic extends BaseLogic * @author 段誉 * @date 2022/3/29 11:01 */ - public static function edit($params) + public static function edit($params): bool { try { // 关键字回复排序值须大于0 @@ -112,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']); } @@ -124,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); @@ -137,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; @@ -224,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 22913a2..fdfdca5 100644 --- a/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php +++ b/server/app/adminapi/logic/channel/OfficialAccountSettingLogic.php @@ -31,7 +31,7 @@ class OfficialAccountSettingLogic extends BaseLogic * @author ljj * @date 2022/2/16 10:08 上午 */ - public function getConfig() + public function getConfig(): array { $domainName = str_replace(['http://','https://'],'',getAgreementHost()); $qrCode = ConfigService::get('oa_setting', 'qr_code', ''); @@ -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 2541519..3e6566f 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 2b54133..d91d473 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-开启 @@ -51,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 2807d23..1132c7e 100644 --- a/server/app/adminapi/logic/crontab/CrontabLogic.php +++ b/server/app/adminapi/logic/crontab/CrontabLogic.php @@ -33,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'] ?? ''; @@ -57,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']); @@ -75,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'] ?? ''; @@ -98,7 +98,7 @@ 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']); @@ -118,7 +118,7 @@ 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']); @@ -150,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']); diff --git a/server/app/adminapi/logic/decorate/DecorateDataLogic.php b/server/app/adminapi/logic/decorate/DecorateDataLogic.php index 84e6d76..c9fc459 100644 --- a/server/app/adminapi/logic/decorate/DecorateDataLogic.php +++ b/server/app/adminapi/logic/decorate/DecorateDataLogic.php @@ -38,7 +38,7 @@ class DecorateDataLogic extends BaseLogic * @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 efd632b..7c7276d 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/dept/DeptLogic.php b/server/app/adminapi/logic/dept/DeptLogic.php index 3f09a2e..691b126 100644 --- a/server/app/adminapi/logic/dept/DeptLogic.php +++ b/server/app/adminapi/logic/dept/DeptLogic.php @@ -41,7 +41,7 @@ class DeptLogic extends BaseLogic * @author 乔峰 * @date 2022/5/30 15:44 */ - public static function lists($params) + public static function lists($params): array { $where = []; if (!empty($params['name'])) { @@ -73,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) { @@ -96,7 +96,7 @@ class DeptLogic extends BaseLogic * @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']) @@ -164,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']); } @@ -192,7 +192,7 @@ class DeptLogic extends BaseLogic * @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 81ddb32..e15a0fa 100644 --- a/server/app/adminapi/logic/dept/JobsLogic.php +++ b/server/app/adminapi/logic/dept/JobsLogic.php @@ -82,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']); } @@ -110,7 +110,7 @@ class JobsLogic extends BaseLogic * @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 9247083..424eb5f 100644 --- a/server/app/adminapi/logic/finance/RefundLogic.php +++ b/server/app/adminapi/logic/finance/RefundLogic.php @@ -41,7 +41,7 @@ class RefundLogic extends BaseLogic * @author 段誉 * @date 2023/3/3 12:09 */ - public static function stat() + public static function stat(): array { $records = RefundRecord::select()->toArray(); @@ -84,7 +84,7 @@ class RefundLogic extends BaseLogic * @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 b323f2b..b9c1a4a 100644 --- a/server/app/adminapi/logic/notice/NoticeLogic.php +++ b/server/app/adminapi/logic/notice/NoticeLogic.php @@ -34,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(); @@ -96,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 { // 校验参数 @@ -123,7 +123,7 @@ class NoticeLogic extends BaseLogic * @author 乔峰 * @date 2022/3/29 11:35 */ - public static function checkSet($params) + public static function checkSet($params): void { $noticeSetting = NoticeSetting::findOrEmpty($params['id'] ?? 0); @@ -172,7 +172,7 @@ class NoticeLogic extends BaseLogic * @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'); @@ -187,7 +187,7 @@ class NoticeLogic extends BaseLogic * @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'); @@ -202,7 +202,7 @@ class NoticeLogic extends BaseLogic * @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'); @@ -217,7 +217,7 @@ class NoticeLogic extends BaseLogic * @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'); diff --git a/server/app/adminapi/logic/notice/SmsConfigLogic.php b/server/app/adminapi/logic/notice/SmsConfigLogic.php index e0a62e6..0a47806 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 ffd872a..214563a 100644 --- a/server/app/adminapi/logic/recharge/RechargeLogic.php +++ b/server/app/adminapi/logic/recharge/RechargeLogic.php @@ -44,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), @@ -62,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'])) { @@ -87,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 { @@ -158,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 { diff --git a/server/app/adminapi/logic/setting/CustomerServiceLogic.php b/server/app/adminapi/logic/setting/CustomerServiceLogic.php index ba890df..98077f9 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 4082611..63c5e63 100644 --- a/server/app/adminapi/logic/setting/HotSearchLogic.php +++ b/server/app/adminapi/logic/setting/HotSearchLogic.php @@ -35,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-开启 @@ -53,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'])) { diff --git a/server/app/adminapi/logic/setting/StorageLogic.php b/server/app/adminapi/logic/setting/StorageLogic.php index b79345f..5f4f6f7 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 3648022..b0508c9 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 8ebbfd9..ff58489 100644 --- a/server/app/adminapi/logic/setting/dict/DictDataLogic.php +++ b/server/app/adminapi/logic/setting/dict/DictDataLogic.php @@ -35,7 +35,7 @@ class DictDataLogic extends BaseLogic * @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'], @@ -63,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 bc1b2e3..ca0af67 100644 --- a/server/app/adminapi/logic/setting/dict/DictTypeLogic.php +++ b/server/app/adminapi/logic/setting/dict/DictTypeLogic.php @@ -56,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'], @@ -77,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']); } @@ -105,7 +105,7 @@ class DictTypeLogic extends BaseLogic * @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 c3b2c9c..90f6dac 100644 --- a/server/app/adminapi/logic/setting/pay/PayConfigLogic.php +++ b/server/app/adminapi/logic/setting/pay/PayConfigLogic.php @@ -40,7 +40,7 @@ class PayConfigLogic extends BaseLogic * @author 段誉 * @date 2023/2/23 16:16 */ - public static function setConfig($params) + public static function setConfig($params): bool { $payConfig = PayConfig::find($params['id']); @@ -84,7 +84,7 @@ class PayConfigLogic extends BaseLogic * @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 6d42f4d..d0e85f6 100644 --- a/server/app/adminapi/logic/setting/pay/PayWayLogic.php +++ b/server/app/adminapi/logic/setting/pay/PayWayLogic.php @@ -43,7 +43,7 @@ class PayWayLogic extends BaseLogic * @author 段誉 * @date 2023/2/23 16:25 */ - public static function getPayWay() + public static function getPayWay(): array { $payWay = PayWay::select()->append(['pay_way_name']) ->toArray(); @@ -74,7 +74,7 @@ class PayWayLogic extends BaseLogic * @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 f9b0f54..059b49d 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 a69ef8d..ecf6149 100644 --- a/server/app/adminapi/logic/setting/web/WebSettingLogic.php +++ b/server/app/adminapi/logic/setting/web/WebSettingLogic.php @@ -60,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']); @@ -103,7 +103,7 @@ 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'])) { @@ -124,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'] ?? ''); diff --git a/server/app/adminapi/logic/tools/GeneratorLogic.php b/server/app/adminapi/logic/tools/GeneratorLogic.php index 0de3e35..3fb65aa 100644 --- a/server/app/adminapi/logic/tools/GeneratorLogic.php +++ b/server/app/adminapi/logic/tools/GeneratorLogic.php @@ -62,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 { @@ -91,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 { @@ -147,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 { @@ -170,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 { @@ -200,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 { // 获取数据表信息 @@ -243,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 { // 获取数据表信息 @@ -282,7 +282,7 @@ class GeneratorLogic extends BaseLogic * @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'], @@ -318,7 +318,7 @@ class GeneratorLogic extends BaseLogic * @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']; @@ -358,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)) { @@ -415,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'] ?? []; @@ -464,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 b93226d..277e78f 100644 --- a/server/app/adminapi/logic/user/UserLogic.php +++ b/server/app/adminapi/logic/user/UserLogic.php @@ -60,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'], @@ -76,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 { diff --git a/server/app/common/model/BaseModel.php b/server/app/common/model/BaseModel.php index cbec1d7..77b8e9d 100644 --- a/server/app/common/model/BaseModel.php +++ b/server/app/common/model/BaseModel.php @@ -72,16 +72,16 @@ use think\Paginator; * @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 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 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 用于非自动提交状态下面的查询提交 -- Gitee From 7fea2641daa0ef8e2197e8714a51d897e9a7238d Mon Sep 17 00:00:00 2001 From: suyi Date: Mon, 18 Nov 2024 15:38:19 +0800 Subject: [PATCH 18/18] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/service/storage/engine/Aliyun.php | 20 +++++----- .../common/service/storage/engine/Local.php | 19 ++++++---- .../common/service/storage/engine/Qcloud.php | 27 ++++++------- .../common/service/storage/engine/Qiniu.php | 20 +++++----- .../common/service/storage/engine/Server.php | 38 +++++++++---------- .../service/wechat/WeChatConfigService.php | 8 ++-- 6 files changed, 68 insertions(+), 64 deletions(-) diff --git a/server/app/common/service/storage/engine/Aliyun.php b/server/app/common/service/storage/engine/Aliyun.php index 98728fc..97507b3 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 25d08cd..28c7b4a 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 252fea7..89e4f8c 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 0611217..6bef30a 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 9f2a872..2bf811d 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 0183855..8237766 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'), @@ -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); -- Gitee