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()) {
$model = new UserModel;
if ($model->login($this->postData('User'))) {
return $this->renderSuccess('登录成功', url('index/index'));
if ($model->login($_POST['User'])) {
return $this->renderSuccess('登录成功', url('admin/setting.config/index'));
}
return $this->renderError($model->getError() ?: '登录失败');
}

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

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

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

@ -2,6 +2,7 @@
namespace app\admin\model\admin;
use app\common\dm\Dm;
use think\Session;
use app\common\model\admin\User as UserModel;
@ -23,10 +24,11 @@ class User extends UserModel
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'],
'password' => yoshop_hash($data['password'])
])->find()) {
])) {
$this->error = '登录失败, 用户名或密码错误';
return false;
}

Loading…
Cancel
Save