From c72547f73e6b386559c80a9387ee0bcb24bfd1e9 Mon Sep 17 00:00:00 2001 From: liyukun <1099438829@qq.com> Date: Mon, 3 Jan 2022 02:22:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/config/view.php | 14 - app/admin/controller/AdminAuth.php | 4 + app/admin/controller/AdminRole.php | 2 + app/admin/controller/Index.php | 7 +- app/admin/controller/Login.php | 16 +- app/admin/controller/SystemBasic.php | 6 +- app/admin/controller/TemplateTrait.php | 3 + app/admin/view/admin/profile.html | 26 +- app/admin/view/admin/pwd.html | 20 +- app/admin/view/admin_auth/index.html | 6 +- app/admin/view/admin_role/index.html | 6 +- app/admin/view/article/add.html | 8 +- app/admin/view/article/edit.html | 8 +- app/admin/view/category/add.html | 8 +- app/admin/view/category/edit.html | 8 +- app/admin/view/category/index.html | 6 +- app/admin/view/icon/index.html | 12 +- app/admin/view/images/index.html | 6 +- app/admin/view/index/index.html | 41 +- app/admin/view/index/main.html | 14 +- app/admin/view/login/login.html | 136 +--- app/admin/view/public/404.html | 10 +- app/admin/view/public/error.html | 10 +- app/admin/view/public/footer.html | 32 +- app/admin/view/public/form-builder.html | 14 +- app/admin/view/public/header.html | 16 +- app/admin/view/public/notice.html | 10 +- app/admin/view/system_config/base.html | 20 +- app/admin/view/system_config/clear_cache.html | 18 +- app/admin/view/system_config/pay.html | 20 +- app/common/model/Admin.php | 24 +- app/common/model/AdminAuth.php | 55 +- app/common/model/ModelTrait.php | 128 ++-- composer.json | 8 +- config/route.php | 2 +- public/static/admin/js/login.js | 13 - vendor/autoload.php | 2 +- vendor/composer/autoload_files.php | 4 +- vendor/composer/autoload_psr4.php | 2 - vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 27 +- vendor/composer/installed.json | 105 +-- vendor/composer/installed.php | 27 +- vendor/firebase/php-jwt/LICENSE | 30 - vendor/firebase/php-jwt/README.md | 289 --------- vendor/firebase/php-jwt/composer.json | 36 -- .../php-jwt/src/BeforeValidException.php | 7 - .../firebase/php-jwt/src/ExpiredException.php | 7 - vendor/firebase/php-jwt/src/JWK.php | 172 ----- vendor/firebase/php-jwt/src/JWT.php | 611 ------------------ vendor/firebase/php-jwt/src/Key.php | 59 -- .../php-jwt/src/SignatureInvalidException.php | 7 - vendor/services.php | 2 +- vendor/topthink/framework/src/think/Env.php | 20 +- .../think-helper/.github/workflows/ci.yml | 36 ++ .../think-helper/.github/workflows/php.yml | 36 ++ vendor/topthink/think-helper/.gitignore | 3 +- vendor/topthink/think-helper/README.md | 2 + vendor/topthink/think-helper/composer.json | 16 +- vendor/topthink/think-helper/phpunit.xml.dist | 17 + .../topthink/think-helper/src/Collection.php | 17 +- .../topthink/think-helper/src/helper/Str.php | 2 +- .../topthink/think-helper/tests/ArrTest.php | 342 ++++++++++ .../think-helper/tests/CollectionTest.php | 70 ++ .../topthink/think-helper/tests/StrTest.php | 59 ++ .../topthink/think-helper/tests/TestCase.php | 13 + vendor/topthink/think-orm/src/Model.php | 4 +- .../src/db/concern/ModelRelationQuery.php | 1 + .../think-orm/src/db/concern/WhereQuery.php | 4 +- 69 files changed, 974 insertions(+), 1806 deletions(-) delete mode 100644 app/admin/config/view.php delete mode 100644 public/static/admin/js/login.js delete mode 100644 vendor/firebase/php-jwt/LICENSE delete mode 100644 vendor/firebase/php-jwt/README.md delete mode 100644 vendor/firebase/php-jwt/composer.json delete mode 100644 vendor/firebase/php-jwt/src/BeforeValidException.php delete mode 100644 vendor/firebase/php-jwt/src/ExpiredException.php delete mode 100644 vendor/firebase/php-jwt/src/JWK.php delete mode 100644 vendor/firebase/php-jwt/src/JWT.php delete mode 100644 vendor/firebase/php-jwt/src/Key.php delete mode 100644 vendor/firebase/php-jwt/src/SignatureInvalidException.php create mode 100644 vendor/topthink/think-helper/.github/workflows/ci.yml create mode 100644 vendor/topthink/think-helper/.github/workflows/php.yml create mode 100644 vendor/topthink/think-helper/phpunit.xml.dist create mode 100644 vendor/topthink/think-helper/tests/ArrTest.php create mode 100644 vendor/topthink/think-helper/tests/CollectionTest.php create mode 100644 vendor/topthink/think-helper/tests/StrTest.php create mode 100644 vendor/topthink/think-helper/tests/TestCase.php diff --git a/app/admin/config/view.php b/app/admin/config/view.php deleted file mode 100644 index d633625..0000000 --- a/app/admin/config/view.php +++ /dev/null @@ -1,14 +0,0 @@ - 'html', - // 视图输出字符串内容替换 - 'tpl_replace_string' => [ - '__PUBLIC_PATH__' => '/', //public 目录 - '__ADMIN_PATH__' => '/static/admin/', //全局静态目录 - ] -]; diff --git a/app/admin/controller/AdminAuth.php b/app/admin/controller/AdminAuth.php index 109cfc4..1110bd2 100644 --- a/app/admin/controller/AdminAuth.php +++ b/app/admin/controller/AdminAuth.php @@ -130,6 +130,8 @@ class AdminAuth extends AuthController $data['update_time'] = time(); $res = aModel::update($data, ['id' => $id]); } + //清理缓存 + aModel::clearCache($this->adminId); return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败"); } @@ -143,6 +145,8 @@ class AdminAuth extends AuthController if (!$id) return app("json")->fail("参数有误,Id为空!"); $where = Util::postMore([['field', ''], ['value', '']]); if ($where['field'] == '' || $where['value'] == '') return app("json")->fail("参数有误!"); + //清理缓存 + aModel::clearCache($this->adminId); return aModel::update([$where['field'] => $where['value']], ['id' => $id]) ? app("json")->success("操作成功") : app("json")->fail("操作失败"); } } \ No newline at end of file diff --git a/app/admin/controller/AdminRole.php b/app/admin/controller/AdminRole.php index c993ff9..194123e 100644 --- a/app/admin/controller/AdminRole.php +++ b/app/admin/controller/AdminRole.php @@ -106,6 +106,8 @@ class AdminRole extends AuthController $data['update_time'] = time(); $res = rModel::update($data, ['id' => $id]); } + //清理缓存 + aModel::clearCache($this->adminId); return $res ? app("json")->success("操作成功", 'code') : app("json")->fail("操作失败"); } } \ No newline at end of file diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php index b1ea2e5..d1a530f 100644 --- a/app/admin/controller/Index.php +++ b/app/admin/controller/Index.php @@ -9,9 +9,6 @@ use app\admin\extend\Util as Util; class Index extends AuthController { - // 无需登录的 - protected $noNeedLogin = ['test', 'accessauth', 'pddlogin']; - /** * 后台首页 * @return string @@ -26,8 +23,8 @@ class Index extends AuthController cache(AdminAuth::getMenuCacheKey($this->adminId), $menuList, 1 * 60 * 60); } $this->assign("menu", $menuList); - $message = ['data' => [], 'count' => 0]; - $this->assign("message", $message); + $messageList = ['data' => [], 'count' => 0]; + $this->assign("message", $messageList); return $this->fetch(); } diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index 6a512af..dc87577 100644 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -3,7 +3,6 @@ namespace app\admin\controller; -use app\common\model\Admin; use app\common\model\Admin as adminModel; use app\admin\extend\Util as Util; @@ -34,20 +33,15 @@ class Login extends AuthController */ public function verify() { - list($account, $pwd, $verify) = Util::postMore(['account', 'password', 'verify'], null, true); - if (empty($account) || empty($pwd)) return app("json")->fail("账号、密码和验证码不能为空!"); + list($username, $password, $captcha) = Util::postMore(['username', 'password', 'captcha'], null, true); + if (empty($username) || empty($password)) return app("json")->fail("账号、密码和验证码不能为空!"); // 验证码验证 - if (!captcha_check($verify)) return app("json")->fail("验证码不正确!"); + if (!captcha_check($captcha)) return app("json")->fail("验证码不正确!"); // 验证登录 - if (!adminModel::login($account, $pwd)) return app("json")->fail("登录失败!"); + if (!adminModel::login($username, $password)) return app("json")->fail(adminModel::getErrorInfo()); return app("json")->success("登录成功!"); } - public function wechatLogin() - { - - } - /** * 注册 * @return string @@ -75,7 +69,7 @@ class Login extends AuthController */ public function logout() { - return Admin::clearLoginInfo() ? $this->successfulNotice("操作成功", "/admin/login/login") : $this->failedNotice("操作失败", "/admin/index/index"); + return adminModel::clearLoginInfo() ? $this->successfulNotice("操作成功", "/admin/login/login") : $this->failedNotice("操作失败", "/admin/index/index"); } /** diff --git a/app/admin/controller/SystemBasic.php b/app/admin/controller/SystemBasic.php index c333973..451f0da 100644 --- a/app/admin/controller/SystemBasic.php +++ b/app/admin/controller/SystemBasic.php @@ -16,11 +16,11 @@ class SystemBasic extends BaseController /** * 操作失败提示框 * @param string $msg 提示信息 - * @param int $backUrl 跳转地址 - * @param string $info + * @param string $backUrl 跳转地址 + * @param string $title 标题 * @param int $duration 持续时间 * @return mixed - * @throws Exception + * @throws \Exception */ protected function failedNotice($msg = '操作失败', $backUrl = 0, $info = '', $duration = 3) { diff --git a/app/admin/controller/TemplateTrait.php b/app/admin/controller/TemplateTrait.php index e4ddd2e..712a488 100644 --- a/app/admin/controller/TemplateTrait.php +++ b/app/admin/controller/TemplateTrait.php @@ -26,6 +26,7 @@ trait TemplateTrait $ids = $request->param("id", 0); if (empty($ids) || !$ids) return app("json")->fail("参数有误,Id为空!"); if (!is_array($ids)) $ids = explode(",", $ids); + if (in_array(1, $ids)) return app("json")->fail("参数有误,初始ID不允许操作!"); return $this->model->where($this->model->getPk(), "in", $ids)->delete() ? app("json")->success("操作成功") : app("json")->fail("操作失败"); } @@ -39,6 +40,7 @@ trait TemplateTrait $ids = $request->param("id", 0); if (empty($ids) || !$ids) return app("json")->fail("参数有误,Id为空!"); if (!is_array($ids)) $ids = explode(",", $ids); + if (in_array(1, $ids)) return app("json")->fail("参数有误,初始ID不允许操作!"); return $this->model->where($this->model->getPk(), "in", $ids)->update(['status' => 1]) ? app("json")->success("操作成功") : app("json")->fail("操作失败"); } @@ -52,6 +54,7 @@ trait TemplateTrait $ids = $request->param("id", 0); if (empty($ids) || !$ids) return app("json")->fail("参数有误,Id为空!"); if (!is_array($ids)) $ids = explode(",", $ids); + if (in_array(1, $ids)) return app("json")->fail("参数有误,初始ID不允许操作!"); return $this->model->where($this->model->getPk(), "in", $ids)->update(['status' => 0]) ? app("json")->success("操作成功") : app("json")->fail("操作失败"); } diff --git a/app/admin/view/admin/profile.html b/app/admin/view/admin/profile.html index cd48182..b20f56c 100644 --- a/app/admin/view/admin/profile.html +++ b/app/admin/view/admin/profile.html @@ -8,11 +8,11 @@ - - - - - + + + + + -
+