Browse Source

后台登录

master
wanghongjun 3 years ago
parent
commit
dd21fc5d24
  1. 4
      source/application/admin/controller/Passport.php
  2. 52
      source/application/admin/extra/menus.php
  3. 6
      source/application/admin/model/admin/User.php

4
source/application/admin/controller/Passport.php

@ -23,8 +23,8 @@ class Passport extends Controller
{ {
if ($this->request->isAjax()) { if ($this->request->isAjax()) {
$model = new UserModel; $model = new UserModel;
if ($model->login($this->postData('User'))) { if ($model->login($_POST['User'])) {
return $this->renderSuccess('登录成功', url('index/index')); return $this->renderSuccess('登录成功', url('admin/setting.config/index'));
} }
return $this->renderError($model->getError() ?: '登录失败'); return $this->renderError($model->getError() ?: '登录失败');
} }

52
source/application/admin/extra/menus.php

@ -30,36 +30,36 @@ return [
// ] // ]
// ], // ],
// ], // ],
'statistics' => [ // 'statistics' => [
'name' => '数据统计', // 'name' => '数据统计',
'icon' => 'icon-shezhi', // 'icon' => 'icon-shezhi',
'submenu' => [ // 'submenu' => [
[ // [
'name' => '客流统计数据', // 'name' => '客流统计数据',
'index' => 'pass.pass/index' // 'index' => 'pass.pass/index'
], // ],
[ // [
'name' => '总客流统计数据', // 'name' => '总客流统计数据',
'index' => 'pass.pass/allIndex' // 'index' => 'pass.pass/allIndex'
], // ],
[ // [
'name' => '客流实时统计数据', // 'name' => '客流实时统计数据',
'index' => 'pass.pass/realIndex' // 'index' => 'pass.pass/realIndex'
], // ],
], // ],
], // ],
'setting' => [ 'setting' => [
'name' => '系统设置', 'name' => '系统设置',
'icon' => 'icon-shezhi', 'icon' => 'icon-shezhi',
'submenu' => [ 'submenu' => [
[ // [
'name' => '清理缓存', // 'name' => '清理缓存',
'index' => 'setting.cache/clear' // 'index' => 'setting.cache/clear'
], // ],
[ // [
'name' => '环境检测', // 'name' => '环境检测',
'index' => 'setting.science/index' // 'index' => 'setting.science/index'
], // ],
[ [
'name' => '配置', 'name' => '配置',
'index' => 'setting.config/index' 'index' => 'setting.config/index'

6
source/application/admin/model/admin/User.php

@ -2,6 +2,7 @@
namespace app\admin\model\admin; namespace app\admin\model\admin;
use app\common\dm\Dm;
use think\Session; use think\Session;
use app\common\model\admin\User as UserModel; use app\common\model\admin\User as UserModel;
@ -23,10 +24,11 @@ class User extends UserModel
public function login($data) public function login($data)
{ {
// 验证用户名密码是否正确 // 验证用户名密码是否正确
if (!$user = self::useGlobalScope(false)->where([ $dm = new Dm();
if (!$user = $dm->find('bt_admin_user',[
'user_name' => $data['user_name'], 'user_name' => $data['user_name'],
'password' => yoshop_hash($data['password']) 'password' => yoshop_hash($data['password'])
])->find()) { ])) {
$this->error = '登录失败, 用户名或密码错误'; $this->error = '登录失败, 用户名或密码错误';
return false; return false;
} }

Loading…
Cancel
Save