diff --git a/app/Luru/controller/Index.php b/app/Luru/controller/Index.php index 7f919260..b93c71a7 100644 --- a/app/Luru/controller/Index.php +++ b/app/Luru/controller/Index.php @@ -30,18 +30,16 @@ class Index extends BaseController { $this->middleware = [ 'online' - ,'terlogin' + ,'login' ]; - $this->luruTeacherId = session('teacher.userid'); - }else{ $this->middleware = [ 'online' ,'login' ,'auth' ]; - $this->luruTeacherId = session('admin.userid'); } + $this->luruTeacherId = session('user_id'); } // 成绩列表 diff --git a/app/base/controller/AdminBase.php b/app/base/controller/AdminBase.php index 53e00cb8..3ca65b09 100644 --- a/app/base/controller/AdminBase.php +++ b/app/base/controller/AdminBase.php @@ -19,4 +19,14 @@ abstract class AdminBase extends BaseController ,'login' ,'auth' ]; + + // 初始化变量 + protected function initialize() + { + $this->online = session('onlineCategory'); + if($this->online != 'admin') + { + \app\facade\OnLine::jump('/login', '请使用管理员帐号登录'); + } + } } diff --git a/app/base/controller/StudentSearchBase.php b/app/base/controller/StudentSearchBase.php index 82a4abc5..bf8c084c 100644 --- a/app/base/controller/StudentSearchBase.php +++ b/app/base/controller/StudentSearchBase.php @@ -15,6 +15,16 @@ abstract class StudentSearchBase extends BaseController */ protected $middleware = [ 'online' - ,'stulogin' + ,'login' ]; + + // 初始化变量 + protected function initialize() + { + $this->online = session('onlineCategory'); + if($this->online != 'student') + { + \app\facade\OnLine::jump('/login', '请使用学生帐号登录'); + } + } } diff --git a/app/base/controller/TeacherSearchBase.php b/app/base/controller/TeacherSearchBase.php index df17c772..84768cf5 100644 --- a/app/base/controller/TeacherSearchBase.php +++ b/app/base/controller/TeacherSearchBase.php @@ -15,6 +15,16 @@ abstract class TeacherSearchBase extends BaseController */ protected $middleware = [ 'online' - ,'terlogin' + ,'login' ]; + + // 初始化变量 + protected function initialize() + { + $this->online = session('onlineCategory'); + if($this->online != 'teacher') + { + \app\facade\OnLine::jump('/login', '登录超时啦~'); + } + } } diff --git a/app/index/controller/Index.php b/app/index/controller/Index.php index 8752974b..0de823fb 100644 --- a/app/index/controller/Index.php +++ b/app/index/controller/Index.php @@ -18,9 +18,9 @@ class Index extends AdminBase $list['webtitle'] = config('shangma.webtitle'); # 系统名称 $list['version'] = config('shangma.version'); # 版本号 $ad = new \app\admin\model\Admin; # 获取用户姓名 - $list->xingming = $ad->where('id', session('admin.userid'))->value('xingming'); + $list->xingming = $ad->where('id', session('user_id'))->value('xingming'); $auth = new \app\admin\model\AuthRule; # 菜单 - $menu = $auth->menu(session('admin.userid')); + $menu = $auth->menu(session('user_id')); $list['menu'] = $menu; // 模版赋值 @@ -48,9 +48,9 @@ class Index extends AdminBase // 查询用户姓名及用户拥有的权限 $admin = new \app\admin\model\Admin; - $list['xingming'] = $admin->where('id',session('admin.userid')) + $list['xingming'] = $admin->where('id',session('user_id')) ->value('xingming'); - $list['group'] = $admin->getGroupnames(session('admin.userid')); + $list['group'] = $admin->getGroupnames(session('user_id')); $list['server'] = request()->server(); // 获取系统版本号 diff --git a/app/login/controller/Index.php b/app/login/controller/Index.php index 3e4ab2e7..d1873b33 100644 --- a/app/login/controller/Index.php +++ b/app/login/controller/Index.php @@ -53,15 +53,15 @@ class Index switch ($list['category']) { case 'admin': - $data = $this->admin($list); + $data = $this->admin($list['username'], $list['password']); break; case 'teacher': - $data = $this->teacher($list); + $data = $this->teacher($list['username'], $list['password']); break; case 'student': - $data = $this->student($list); + $data = $this->student($list['username'], $list['password']); break; default: @@ -74,33 +74,32 @@ class Index - // 登录验证 - public function admin($list) + // 管理员登录验证 + public function admin($username, $password) { + session(null); // 获取服务器密码 - $userinfo = AD::where('username', $list['username']) - ->where('val', 1) + $userinfo = AD::where('username', $username) + ->where('status', 1) ->field('id, lastip, username, ip, denglucishu, lasttime, thistime, password') ->find(); if($userinfo == null) { - // 清除session(当前作用域) - session(null); // 验证结果; $data = ['msg' => '管理员帐号不存在或被禁用', 'val' => 0]; - return json($data); + return $data; } - // 验证用户名和密码 - $check = $this->check($list['password'], $userinfo->password); + $check = $this->check($password, $userinfo->password); - if($check['val'] === 1) + if($check === true) { - session(null); session('onlineCategory', 'admin'); session('user_id', $userinfo->id); + session('username', $username); + session('password', $password); // 将本次信息上传到服务器上 $userinfo->lastip = $userinfo->ip; @@ -111,42 +110,117 @@ class Index $userinfo->save(); // 跳转到首页 - $data = ['msg' => '验证成功', 'val' => 1]; + $data = ['msg' => '验证成功', 'val' => 1, 'url' =>'\\']; }else{ // 提示错误信息 - $data = ['msg' => $check['msg'], 'val' => 0]; + $data = ['msg' => '用户名或密码错误', 'val' => 0]; } - return json($data); + return $data; + } + + + // 管理员登录验证 + public function teacher($username, $password) + { + session(null); + // 获取服务器密码 + $tch = new \app\teacher\model\Teacher; + $userinfo = $tch::where('phone', $username) + ->where('status', 1) + ->field('id, lastip, phone, ip, denglucishu, lasttime, thistime, password') + ->find(); + + if($userinfo == null) + { + // 验证结果; + $data = ['msg' => '教师帐号不存在或被禁用', 'val' => 0]; + return $data; + } + + // 验证用户名和密码 + $check = $this->check($password, $userinfo->password); + + if($check === true) + { + session('onlineCategory', 'teacher'); + session('user_id', $userinfo->id); + session('username', $username); + session('password', $password); + + // 将本次信息上传到服务器上 + $userinfo->lastip = $userinfo->ip; + $userinfo->ip = request()->ip(); + $userinfo->denglucishu = ['inc', 1]; + $userinfo->lasttime = $userinfo->getData('thistime'); + $userinfo->thistime = time(); + $userinfo->save(); + + // 跳转到首页 + $data = ['msg' => '验证成功', 'val' => 1, 'url' => '/teacherSearchChengji/index/index']; + }else{ + // 提示错误信息 + $data = ['msg' => '用户名或密码错误', 'val' => 0]; + } + + return $data; + } + + // 管理员登录验证 + public function student($username, $password) + { + session(null); + // 获取服务器密码 + $stu = new \app\student\model\Student; + $userinfo = $stu::where('shenfenzhenghao', $username) + ->where('status', 1) + ->field('id, lastip, shenfenzhenghao, ip, denglucishu, lasttime, thistime, password') + ->find(); + + if($userinfo == null) + { + // 验证结果; + $data = ['msg' => '教师帐号不存在或被禁用', 'val' => 0]; + return $data; + } + + // 验证用户名和密码 + $check = $this->check($password, $userinfo->password); + + if($check === true) + { + session('onlineCategory', 'student'); + session('user_id', $userinfo->id); + session('username', $username); + session('password', $password); + + // 将本次信息上传到服务器上 + $userinfo->lastip = $userinfo->ip; + $userinfo->ip = request()->ip(); + $userinfo->denglucishu = ['inc', 1]; + $userinfo->lasttime = $userinfo->getData('thistime'); + $userinfo->thistime = time(); + $userinfo->save(); + + // 跳转到首页 + $data = ['msg' => '验证成功', 'val' => 1, 'url' => '/studentSearchChengji/index/index']; + }else{ + // 提示错误信息 + $data = ['msg' => '用户名或密码错误', 'val' => 0]; + } + + return $data; } // 已知密码进行验证 - public function check($srcfrom) + public function check($inputPassword, $serverPassword) { - $src = [ - 'username' => '' - ,'password' => '' - ,'onlineCategory' => '' - ,'user_id' => '' - ]; - $src = array_cover($srcfrom, $src); - // 实例化加密类 $md5 = new APR1_MD5(); - //验证密码 $check = $md5->check($inputPassword, $serverPassword); - - if($check) - { - session('username', $username); - session('password', $password); - $data = ['msg' => '验证成功', 'val' => 1]; - }else{ - $data = ['msg' => '用户名或密码错误', 'val' => 0]; - } - return $data; + return $check; } diff --git a/app/login/controller/Student.php b/app/login/controller/Student.php deleted file mode 100644 index 17c88636..00000000 --- a/app/login/controller/Student.php +++ /dev/null @@ -1,141 +0,0 @@ -isMobile(); - // 清除cookie - cookie('userid', null); - cookie('username', null); - cookie('password', null); - // 清除session(当前作用域) - session(null); - - // 获取系统名称和版本号 - $list['webtitle'] = Config::get('shangma.webtitle'); - $list['version'] = Config::get('shangma.version'); - $list['mobile'] = $mobile; - - View::assign('list',$list); - - // 渲染输出 - return View::fetch(); - } - - - // 成绩验证 - public function yanzheng() - { - // 获取表单数据 - $data = request()->only(['username','password','online']); - - // 验证表单数据 - try { - // 实例化验证模型 - $validate = new \app\login\validate\Yanzheng; - validate(Yanzheng::class)->scene('student')->check($data); - } catch (ValidateException $e) { - // 验证失败 输出错误信息 - $data=['msg'=>$e->getError(),'status'=>0]; - return json($data); - } - - // 验证用户名和密码 - $check = $this->check($data['username'],$data['password']); - - if($check['status']==1) - { - // 设置cookie值 - if( request()->post('online') == true ) - { - // 设置 - cookie('userid', session('userid')); - cookie('username', $data['username']); - cookie('password', $data['password']); - } - - // 将本次信息上传到服务器上 - $userinfo = stu::where('shenfenzhenghao',$data['username']) - ->field('lastip,ip,denglucishu,lasttime,thistime') - ->find(); - $userinfo->lastip = $userinfo->ip; - $userinfo->ip = request()->ip(); - $userinfo->denglucishu = ['inc', 1]; - $userinfo->lasttime = $userinfo->getData('thistime'); - $userinfo->thistime = time(); - $userinfo->save(); - - // 跳转到首页 - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 提示错误信息 - $data=['msg'=>$check['msg'],'status'=>0]; - } - - return json($data); - } - - - // 已知密码进行验证 - public function check($username,$password) - { - // 实例化加密类 - $md5 = new APR1_MD5(); - - // 获取服务器密码 - $userinfo = stu::where('shenfenzhenghao', $username)->where('status', 1)->find(); - - if($userinfo == null) - { - // 清除session(当前作用域) - session(null); - // 验证结果; - $data=['msg'=>'学生不存在或被禁用','status'=>0]; - return $data; - } - - //验证密码 - $check = $md5->check($password,$userinfo->password); - - if($check) - { - session('student', null); - session('onlineCategory', 'student'); - session('student.userid', $userinfo->id); - session('student.username', $username); - session('student.password', $password); - - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 清除cookie - cookie('userid', null); - cookie('username', null); - cookie('password', null); - // 清除session(当前作用域) - session(null); - $data=['msg'=>'学生身份证号或密码错误','status'=>0]; - } - return $data; - } -} diff --git a/app/login/controller/Teacher.php b/app/login/controller/Teacher.php deleted file mode 100644 index 47633375..00000000 --- a/app/login/controller/Teacher.php +++ /dev/null @@ -1,140 +0,0 @@ -isMobile(); - // 清除cookie - cookie('userid', null); - cookie('username', null); - cookie('password', null); - // 清除session(当前作用域) - session(null); - - // 获取系统名称和版本号 - $list['webtitle'] = Config::get('shangma.webtitle'); - $list['version'] = Config::get('shangma.version'); - $list['mobile'] = $mobile; - - View::assign('list',$list); - - // 渲染输出 - return View::fetch(); - } - - - // 成绩验证 - public function yanzheng() - { - // 获取表单数据 - $data = request()->only(['username','password','online']); - - // 验证表单数据 - try { - // 实例化验证模型 - $validate = new \app\login\validate\Yanzheng; - validate(Yanzheng::class)->scene('admin')->check($data); - } catch (ValidateException $e) { - // 验证失败 输出错误信息 - $data=['msg'=>$e->getError(),'status'=>0]; - return json($data); - } - - // 验证用户名和密码 - $check = $this->check($data['username'],$data['password']); - - if($check['status']==1) - { - // 设置cookie值 - if( request()->post('online') == true ) - { - // 设置 - cookie('userid', session('userid')); - cookie('username', $data['username']); - cookie('password', $data['password']); - } - - // 将本次信息上传到服务器上 - $userinfo = tch::where('phone',$data['username']) - ->field('lastip,phone,ip,denglucishu,lasttime,thistime') - ->find(); - $userinfo->lastip = $userinfo->ip; - $userinfo->ip = request()->ip(); - $userinfo->denglucishu = ['inc', 1]; - $userinfo->lasttime = $userinfo->getData('thistime'); - $userinfo->thistime = time(); - $userinfo->save(); - - // 跳转到首页 - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 提示错误信息 - $data=['msg'=>$check['msg'],'status'=>0]; - } - - return json($data); - } - - - // 已知密码进行验证 - public function check($username,$password) - { - // 实例化加密类 - $md5 = new APR1_MD5(); - - // 获取服务器密码 - $userinfo = tch::where('phone', $username)->where('status', 1)->find(); - - if($userinfo == null) - { - // 清除session(当前作用域) - session(null); - // 验证结果; - $data=['msg'=>'手机号不存在或被禁用','status'=>0]; - return $data; - } - - //验证密码 - $check = $md5->check($password,$userinfo->password); - - if($check) - { - session('teacher', null); - session('onlineCategory', 'teacher'); - session('teacher.userid', $userinfo->id); - session('teacher.username', $username); - session('teacher.password', $password); - - $data=['msg'=>'验证成功','status'=>1]; - }else{ - // 清除cookie - cookie('userid', null); - cookie('username', null); - cookie('password', null); - // 清除session(当前作用域) - session(null); - $data=['msg'=>'手机号或密码错误','status'=>0]; - } - return $data; - } -} diff --git a/app/login/route/login.php b/app/login/route/login.php index 65d973eb..94d91621 100644 --- a/app/login/route/login.php +++ b/app/login/route/login.php @@ -14,7 +14,7 @@ use think\facade\Route; // 系统设置systembase Route::group('', function () { Route::rule('','Index/index','get'); - Route::rule('','Index/yanzheng','post'); + Route::rule('','Index/yanchengdenglu','post'); Route::rule('log','Index/shangmaLog','get'); # 配置更新 Route::rule('err','Index/myerror','get'); //错误页 Route::rule('weihu','Index/weihu','get'); //错误页 diff --git a/app/login/view/index/index.html b/app/login/view/index/index.html index 8804586d..7d723a66 100644 --- a/app/login/view/index/index.html +++ b/app/login/view/index/index.html @@ -42,7 +42,7 @@
- +

@@ -87,7 +87,7 @@ success:function(result){ if(result.val == 1) { - window.location.href="/"; + window.location.href = result.url; }else{ layer.msg(result.msg); $('#password').val(''); diff --git a/app/login/view/index/shangma_log.html b/app/login/view/index/shangma_log.html index ed24c45b..232921d5 100644 --- a/app/login/view/index/shangma_log.html +++ b/app/login/view/index/shangma_log.html @@ -49,7 +49,8 @@

V1.3.6 2020-09-07

- 增加数据库备份 + 增加数据库备份
+ 合并用户登录

diff --git a/app/login/view/student/index.html b/app/login/view/student/index.html deleted file mode 100644 index 50e6c872..00000000 --- a/app/login/view/student/index.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - {$list['webtitle']} {$list['version']} - - - - - - - - - - - - - - - - - - -
-
{$list['webtitle']} {$list['version']}
-
-
- -
- -
-
-
-
-
- 管理入口 - 教师入口 - -
-
-
- - - - - diff --git a/app/login/view/teacher/index.html b/app/login/view/teacher/index.html deleted file mode 100644 index c830bf1e..00000000 --- a/app/login/view/teacher/index.html +++ /dev/null @@ -1,124 +0,0 @@ - - - - - {$list['webtitle']} {$list['version']} - - - - - - - - - - - - - - - - - - -
-
{$list['webtitle']} {$list['version']}
-
-
- -
- -
-
-
-
-
- 管理入口 - 学生入口 - -
-
-
- - - - - diff --git a/app/middleware/Auth.php b/app/middleware/Auth.php index 330e1745..1a4ff2c1 100644 --- a/app/middleware/Auth.php +++ b/app/middleware/Auth.php @@ -22,7 +22,7 @@ class Auth { $admins = Config::get('auth.auth_config.administrator'); // 如果当前用户ID在配置排除的列表中,愚昧取消验证 - if(in_array(session('admin.userid'),$admins)){ + if(in_array(session('user_id'), $admins)){ $admin = true; }else{ $admin = false; @@ -107,7 +107,7 @@ class Auth $auth = new AuthHandle; // 验证方法 - if( $auth->check($url, session('admin.userid')) == false && $except == false && $admin == false ){// 第一个参数是规则名称,第二个参数是用户UID + if( $auth->check($url, session('user_id')) == false && $except == false && $admin == false ){// 第一个参数是规则名称,第二个参数是用户UID $this->error('哎哟~ 因为权限不足', '/login/err'); } diff --git a/app/middleware/Login.php b/app/middleware/Login.php new file mode 100644 index 00000000..9995f3e8 --- /dev/null +++ b/app/middleware/Login.php @@ -0,0 +1,51 @@ +admin(session('username'), session('password')); + if($yz['val'] == 0) + { + \app\facade\OnLine::jump('/login', $yz['msg']); + } + break; + case 'teacher': + $yz = new \app\login\controller\Index; + $yz = $yz->teacher(session('username'), session('password')); + if($yz['val'] == 0) + { + \app\facade\OnLine::jump('/login', $yz['msg']); + } + break; + case 'student': + $yz = new \app\login\controller\Index; + $yz = $yz->student(session('username'), session('password')); + if($yz['val'] == 0) + { + \app\facade\OnLine::jump('/login', $yz['msg']); + } + break; + + default: + \app\facade\OnLine::jump('/login', '请选择用户角色'); + break; + } + + return $next($request); + } +} diff --git a/app/middleware/Online.php b/app/middleware/Online.php index 584d76fc..99208b62 100644 --- a/app/middleware/Online.php +++ b/app/middleware/Online.php @@ -15,18 +15,19 @@ class Online public function handle($request, \Closure $next) { $weihu = config('shangma.weihu'); - $adminid = session('admin.userid'); - if( $weihu == true && $adminid>2 ) - { - \app\facade\OnLine::jump('/login/weihu', '系统维护中~'); - } - // 判断是否在线,如果不在线则跳转 $online = session('?onlineCategory'); if($online == false) { - \app\facade\OnLine::jump('/login/index/index', '登录超时啦~'); + \app\facade\OnLine::jump('/login', '登录超时啦~'); } + + $user_id = session('user_id'); + if($weihu == true && $user_id > 2) + { + \app\facade\OnLine::jump('/login/weihu', '系统维护中~'); + } + return $next($request); } } diff --git a/app/middleware/StudentLogin.php b/app/middleware/StudentLogin.php deleted file mode 100644 index 98790e68..00000000 --- a/app/middleware/StudentLogin.php +++ /dev/null @@ -1,39 +0,0 @@ -isAjax(); - if ($category != 'student') - { - - \app\facade\OnLine::jump('/login/student', '请使用学生帐号登录'); - } - - $userInfo = \app\facade\OnLine::getLoginInfo('student'); - - // 检验用户名或密码是否正确 - $yz = new \app\login\controller\Student; - $yz = $yz->check($userInfo['username'],$userInfo['password']); - - if($yz['status'] == 0){ - \app\facade\OnLine::jump('/login/student', '请使用新密码登录'); - } - - return $next($request); - } -} diff --git a/app/middleware/TeacherLogin.php b/app/middleware/TeacherLogin.php deleted file mode 100644 index ebc13ced..00000000 --- a/app/middleware/TeacherLogin.php +++ /dev/null @@ -1,38 +0,0 @@ -isAjax(); - if ($category != 'teacher') - { - - \app\facade\OnLine::jump('/login/teacher', '请使用教师帐号登录'); - } - - $userInfo = \app\facade\OnLine::getLoginInfo('teacher'); - - // 检验用户名或密码是否正确 - $yz = new \app\login\controller\Teacher; - $yz = $yz->check($userInfo['username'],$userInfo['password']); - - if($yz['status'] == 0){ - \app\facade\OnLine::jump('/login/teacher', '请使用新密码登录'); - } - - return $next($request); - } -} diff --git a/app/middleware/UserLogin.php b/app/middleware/UserLogin.php deleted file mode 100644 index e471a3e7..00000000 --- a/app/middleware/UserLogin.php +++ /dev/null @@ -1,37 +0,0 @@ -isAjax(); - if ($category != 'admin') - { - - \app\facade\OnLine::jump('/login/index/index', '请使用管理员帐号登录'); - } - - $userInfo = \app\facade\OnLine::getLoginInfo('admin'); - - // 检验用户名或密码是否正确 - $yz = new \app\login\controller\Index; - $yz = $yz->check($userInfo['username'],$userInfo['password']); - - if($yz['status'] == 0){ - \app\facade\OnLine::jump('/login/index/index', '请使用新密码登录'); - } - - return $next($request); - } -} diff --git a/app/studentSearchChengji/controller/Index.php b/app/studentSearchChengji/controller/Index.php index 232aab0c..072a82f6 100644 --- a/app/studentSearchChengji/controller/Index.php +++ b/app/studentSearchChengji/controller/Index.php @@ -30,7 +30,7 @@ class Index extends StudentSearchBase $list['webtitle'] = config('shangma.webtitle'); # 系统名称 $stu = new \app\student\model\Student; - $stuInfo = $stu->where('id', session('student.userid')) + $stuInfo = $stu->where('id', session('user_id')) ->with([ 'stuBanji' => function ($query) { $query->field('id, paixu, ruxuenian') @@ -41,7 +41,7 @@ class Index extends StudentSearchBase ->find(); $list['xingming'] = $stuInfo->xingming; $list['banjiTitle'] = $stuInfo->stuBanji->banjiTitle; - $list['student_id'] = session('student.userid'); + $list['student_id'] = session('user_id'); $list['sbj'] = subjectKaoshiList(); // 模板赋值 @@ -81,7 +81,7 @@ class Index extends StudentSearchBase 'webtitle' => '修改密码' ,'butname' => '修改' ,'formpost' => 'PUT' - ,'url' => '/studentsearchchengji/index/updatepassword/' . session('student.userid') + ,'url' => '/studentsearchchengji/index/updatepassword/' . session('user_id') ); // 模板赋值 diff --git a/app/studentSearchChengji/view/index/index.html b/app/studentSearchChengji/view/index/index.html index e4ba54bc..fb92c27d 100644 --- a/app/studentSearchChengji/view/index/index.html +++ b/app/studentSearchChengji/view/index/index.html @@ -60,11 +60,11 @@ 系统帮助
- 切换帐号
+ 切换帐号
  • - 退了
  • + 退了
    {if (session('student.password') == 123) } diff --git a/app/teacherSearchChengji/controller/Index.php b/app/teacherSearchChengji/controller/Index.php index 07af9a56..c14e363a 100644 --- a/app/teacherSearchChengji/controller/Index.php +++ b/app/teacherSearchChengji/controller/Index.php @@ -26,7 +26,7 @@ class Index extends TeacherSearchBase $list['version'] = config('shangma.version'); # 版本号 $tch = new TCH; # 获取用户姓名 - $list->info = $tch->where('id', session('teacher.userid')) + $list->info = $tch->where('id', session('user_id')) ->field('id, xingming, danwei_id') ->with([ 'jsDanwei' => function ($query) { @@ -94,10 +94,8 @@ class Index extends TeacherSearchBase ] ]; } - $list['menu'] = $temp; - // 模版赋值 $this->view->assign('list', $list); // 渲染输出 @@ -127,19 +125,15 @@ class Index extends TeacherSearchBase $list['version'] = config('shangma.version'); $ry = new \app\rongyu\model\JsRongyuCanyu; - $list['rongyu'] = $ry->where('teacher_id', session('teacher.userid'))->count(); + $list['rongyu'] = $ry->where('teacher_id', session('user_id'))->count(); $kt = new \app\keti\model\KetiCanyu; - $list['keti'] = $ry->where('teacher_id', session('teacher.userid'))->count(); - - - + $list['keti'] = $ry->where('teacher_id', session('user_id'))->count(); $list['kaoshi'] = 1; $list['teacher'] = 1; $list['student'] = 1; - // 模版赋值 $this->view->assign('list',$list); // 渲染输出 @@ -177,7 +171,7 @@ class Index extends TeacherSearchBase 'webtitle' => '修改密码' ,'butname' => '修改' ,'formpost' => 'PUT' - ,'url' => '/teachersearchchengji/index/updatepassword/' . session('teacher.userid') + ,'url' => '/teachersearchchengji/index/updatepassword/' . session('user_id') ); // 模板赋值 @@ -235,7 +229,7 @@ class Index extends TeacherSearchBase // 班级成绩列表 public function banji() { - $teacher_id = session('teacher.userid'); + $teacher_id = session('user_id'); $list['teacher_id'] = $teacher_id; $sbj = new \app\teach\model\Subject; @@ -341,7 +335,7 @@ class Index extends TeacherSearchBase // 设置要给模板赋值的信息 $list['webtitle'] = '个人荣誉'; $list['dataurl'] = '/tools/teacherinfo/srcry'; - $list['teacher_id'] = session('teacher.userid'); + $list['teacher_id'] = session('user_id'); // 模板赋值 $this->view->assign('list', $list); @@ -357,7 +351,7 @@ class Index extends TeacherSearchBase // 设置要给模板赋值的信息 $list['webtitle'] = '个人课题'; $list['dataurl'] = '/tools/teacherinfo/srckt'; - $list['teacher_id'] = session('teacher.userid'); + $list['teacher_id'] = session('user_id'); // 模板赋值 $this->view->assign('list', $list); diff --git a/app/teacherSearchChengji/view/index/index.html b/app/teacherSearchChengji/view/index/index.html index 126d4289..b1a27bf0 100644 --- a/app/teacherSearchChengji/view/index/index.html +++ b/app/teacherSearchChengji/view/index/index.html @@ -77,11 +77,11 @@ 修改密码
    - 切换帐号
    + 切换帐号
  • - 退了
  • + 退了 diff --git a/app/tools/controller/CanKao1.php b/app/tools/controller/CanKao1.php deleted file mode 100644 index d9b36c84..00000000 --- a/app/tools/controller/CanKao1.php +++ /dev/null @@ -1,25 +0,0 @@ -srcSubject($srcfrom); - if(count($ksSubject)==0) - { - return $data = array(); - } - $xk = array(); - foreach ($ksSubject as $key => $value) { - $xk[$value['id']] = $value['lieming']; - } - return $xk; - } -} diff --git a/app/tools/controller/File.php b/app/tools/controller/File.php index 02aba8df..e0c0cb55 100644 --- a/app/tools/controller/File.php +++ b/app/tools/controller/File.php @@ -24,18 +24,17 @@ class File extends BaseController 'online' ,'terlogin' ]; - $this->luruTeacherId = session('teacher.userid'); - }else{ $this->middleware = [ 'online' ,'login' ,'auth' ]; - $this->luruTeacherId = session('admin.userid'); } + $this->luruTeacherId = session('user_id'); } + /** * 获取文件信息并保存 * diff --git a/app/tools/controller/OnLine.php b/app/tools/controller/OnLine.php index 11042e19..5c1360c0 100644 --- a/app/tools/controller/OnLine.php +++ b/app/tools/controller/OnLine.php @@ -20,30 +20,30 @@ class OnLine } - // 获取用户信息 - public function getLoginInfo($yu) - { - $username = ''; - $password = ''; - // 尝试从session中获取用户名和密码 - $username = session('?'.$yu.'.username') - ? $username = session($yu.'.username') : $username = ''; - $password = session('?'.$yu.'.password') - ? $password = session($yu.'.password') : $password = ''; - // 尝试从cookie中获取用户名和密码 - if (strlen($username) < 1 ) - { - $username = cookie('?username') - ? $username = cookie('username') : $username = ''; - $password = cookie('?password') - ? $password = cookie('password') : $password = ''; - } + // // 获取用户信息 + // public function getLoginInfo($yu) + // { + // $username = ''; + // $password = ''; + // // 尝试从session中获取用户名和密码 + // $username = session('?'.$yu.'.username') + // ? $username = session($yu.'.username') : $username = ''; + // $password = session('?'.$yu.'.password') + // ? $password = session($yu.'.password') : $password = ''; + // // 尝试从cookie中获取用户名和密码 + // if (strlen($username) < 1 ) + // { + // $username = cookie('?username') + // ? $username = cookie('username') : $username = ''; + // $password = cookie('?password') + // ? $password = cookie('password') : $password = ''; + // } - $userInfo = [ - 'username' => $username - ,'password' => $password - ]; + // $userInfo = [ + // 'username' => $username + // ,'password' => $password + // ]; - return $userInfo; - } + // return $userInfo; + // } } diff --git a/config/middleware.php b/config/middleware.php index 8c0a4b3d..c42cfcfd 100644 --- a/config/middleware.php +++ b/config/middleware.php @@ -3,10 +3,8 @@ return [ // 别名或分组 'alias' => [ - 'login' => app\middleware\Userlogin::class, + 'login' => app\middleware\Login::class, 'auth' => app\middleware\Auth::class, - 'stulogin' => app\middleware\StudentLogin::class, - 'terlogin' => app\middleware\TeacherLogin::class, 'online' => app\middleware\Online::class, ], // 优先级设置,此数组中的中间件会按照数组中的顺序优先执行