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 @@ - - - - - + + + + + -
+