新增控制同一时间同一管理员只能在一个地方登录的功能
修复后台背景插件不作用的BUG 修复后台常规管理,系统配置新增时无法保存的BUG
正在显示
4 个修改的文件
包含
21 行增加
和
4 行删除
@@ -87,6 +87,8 @@ class Index extends Backend | @@ -87,6 +87,8 @@ class Index extends Backend | ||
87 | { | 87 | { |
88 | $this->redirect($url); | 88 | $this->redirect($url); |
89 | } | 89 | } |
90 | + $background = cdnurl("/assets/img/loginbg.jpg"); | ||
91 | + $this->view->assign('background', $background); | ||
90 | \think\Hook::listen("login_init", $this->request); | 92 | \think\Hook::listen("login_init", $this->request); |
91 | return $this->view->fetch(); | 93 | return $this->view->fetch(); |
92 | } | 94 | } |
@@ -84,7 +84,7 @@ class Config extends Backend | @@ -84,7 +84,7 @@ class Config extends Backend | ||
84 | { | 84 | { |
85 | if (in_array($params['type'], ['select', 'selects', 'checkbox', 'radio', 'array'])) | 85 | if (in_array($params['type'], ['select', 'selects', 'checkbox', 'radio', 'array'])) |
86 | { | 86 | { |
87 | - $params['content'] = ConfigModel::decode($params['content']); | 87 | + $params['content'] = json_encode(ConfigModel::decode($params['content']), JSON_UNESCAPED_UNICODE); |
88 | } | 88 | } |
89 | else | 89 | else |
90 | { | 90 | { |
@@ -133,7 +133,7 @@ class Config extends Backend | @@ -133,7 +133,7 @@ class Config extends Backend | ||
133 | $value = $row[$v['name']]; | 133 | $value = $row[$v['name']]; |
134 | if (is_array($value) && isset($value['field'])) | 134 | if (is_array($value) && isset($value['field'])) |
135 | { | 135 | { |
136 | - $value = json_encode(\app\common\model\Config::getArrayData($value), JSON_UNESCAPED_UNICODE); | 136 | + $value = json_encode(ConfigModel::getArrayData($value), JSON_UNESCAPED_UNICODE); |
137 | } | 137 | } |
138 | else | 138 | else |
139 | { | 139 | { |
@@ -14,6 +14,7 @@ class Auth extends \fast\Auth | @@ -14,6 +14,7 @@ class Auth extends \fast\Auth | ||
14 | 14 | ||
15 | protected $requestUri = ''; | 15 | protected $requestUri = ''; |
16 | protected $breadcrumb = []; | 16 | protected $breadcrumb = []; |
17 | + protected $loginUnique = false; //是否同一账号同一时间只能在一个地方登录 | ||
17 | 18 | ||
18 | public function __construct() | 19 | public function __construct() |
19 | { | 20 | { |
@@ -153,7 +154,21 @@ class Auth extends \fast\Auth | @@ -153,7 +154,21 @@ class Auth extends \fast\Auth | ||
153 | */ | 154 | */ |
154 | public function isLogin() | 155 | public function isLogin() |
155 | { | 156 | { |
156 | - return Session::get('admin') ? true : false; | 157 | + $admin = Session::get('admin'); |
158 | + if (!$admin) | ||
159 | + { | ||
160 | + return false; | ||
161 | + } | ||
162 | + //判断是否同一时间同一账号只能在一个地方登录 | ||
163 | + if ($this->loginUnique) | ||
164 | + { | ||
165 | + $my = Admin::get($admin->id); | ||
166 | + if (!$my || $my->token != $admin->token) | ||
167 | + { | ||
168 | + return false; | ||
169 | + } | ||
170 | + } | ||
171 | + return true; | ||
157 | } | 172 | } |
158 | 173 | ||
159 | /** | 174 | /** |
-
请 注册 或 登录 后发表评论