From e2f7b3b7947e864972fdcb58e3962a17933e79d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B7=B4=E6=8E=8C?= Date: Fri, 29 Jan 2021 09:42:06 +0800 Subject: [PATCH] 0 --- app/admin/controller/AuthRule.php | 43 ++++++++++++++- app/admin/model/AuthRule.php | 6 ++- app/admin/route/admin.php | 2 + app/admin/view/auth_rule/index.html | 19 ++++++- app/base/controller/AdminBase.php | 8 +-- app/kaoshi/view/index/index.html | 2 +- app/login/view/index/shangma_log.html | 12 ++--- app/middleware/Auth.php | 5 +- app/teacherSearchChengji/controller/Index.php | 6 ++- app/tools/model/OneStudentChengji.php | 4 +- .../20210117005351_rule_addsystemreset.php | 4 +- .../20210124053905_rule_add_shenfen.php | 53 +++++++++++++++++++ vendor/liliuwei/thinkphp-auth/src/Auth.php | 4 +- 13 files changed, 145 insertions(+), 23 deletions(-) create mode 100644 database/migrations/20210124053905_rule_add_shenfen.php diff --git a/app/admin/controller/AuthRule.php b/app/admin/controller/AuthRule.php index 36828193..ac42a8b3 100755 --- a/app/admin/controller/AuthRule.php +++ b/app/admin/controller/AuthRule.php @@ -15,6 +15,8 @@ class AuthRule extends AdminBase // 设置要给模板赋值的信息 $list['webtitle'] = '权限列表'; $list['dataurl'] = '/admin/authrule/data'; + $list['teacher'] = '/admin/authrule/teacher'; + $list['student'] = '/admin/authrule/student'; $list['status'] = '/admin/authrule/status'; // 模板赋值 @@ -31,7 +33,8 @@ class AuthRule extends AdminBase // 获取参数 $src = $this->request ->only([ - 'page'=>'1' + 'category' => '' + ,'page'=>'1' ,'limit' => '10' ,'field' => 'id' ,'order' => 'asc' @@ -187,4 +190,42 @@ class AuthRule extends AdminBase // 返回信息 return json($data); } + + + // 设置权限状态 + public function setTeacher() + { + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); + + // 获取权限信息 + $data = AR::where('id', $id)->update(['teacher' => $value]); + + // 根据更新结果设置返回提示信息 + $data ? $data = ['msg' => '教师权限设置成功', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } + + + // 设置权限状态 + public function setStudent() + { + // 获取id变量 + $id = request()->post('id'); + $value = request()->post('value'); + + // 获取权限信息 + $data = AR::where('id', $id)->update(['student' => $value]); + + // 根据更新结果设置返回提示信息 + $data ? $data = ['msg' => '学生权限设置成功', 'val' => 1] + : $data = ['msg' => '数据处理错误', 'val' => 0]; + + // 返回信息 + return json($data); + } } diff --git a/app/admin/model/AuthRule.php b/app/admin/model/AuthRule.php index bfbffdda..9036e5c6 100755 --- a/app/admin/model/AuthRule.php +++ b/app/admin/model/AuthRule.php @@ -29,6 +29,7 @@ class AuthRule extends BaseModel $src = [ 'searchval' => '' ,'status' => '' + ,'category' => '' ]; $src = array_cover($srcfrom, $src); @@ -37,6 +38,9 @@ class AuthRule extends BaseModel ->when(strlen($src['searchval']) > 0, function($query) use($src){ $query->where('title|name', 'like', '%' . $src['searchval'] . '%'); }) + ->when(strlen($src['category']) > 0, function($query) use($src){ + $query->where($src['category'], 1); + }) ->when(strlen($src['status']) > 0, function($query) use($src){ $query->where('status', $src['status']); }) @@ -45,7 +49,7 @@ class AuthRule extends BaseModel $query->field('id, title'); } ]) - ->field('id, name, title, condition, paixu, ismenu, url, pid, type, status') + ->field('id, name, title, condition, paixu, ismenu, url, pid, type, status, teacher, student') ->select(); return $data; diff --git a/app/admin/route/admin.php b/app/admin/route/admin.php index 83a0bc94..069ecd67 100755 --- a/app/admin/route/admin.php +++ b/app/admin/route/admin.php @@ -39,6 +39,8 @@ Route::group('authrule', function () { Route::rule('update/', 'AuthRule/update', 'put'); # 更新信息 Route::rule('delete/', 'AuthRule/delete', 'delete'); # 删除信息 Route::rule('status', 'AuthRule/setStatus', 'post'); # 删除信息 + Route::rule('teacher', 'AuthRule/setTeacher', 'post'); # 删除信息 + Route::rule('student', 'AuthRule/setStudent', 'post'); # 删除信息 Route::rule('menu/', 'AuthRule/menu', 'get'); # 删除信息 }); diff --git a/app/admin/view/auth_rule/index.html b/app/admin/view/auth_rule/index.html index f12e1c13..7069947c 100755 --- a/app/admin/view/auth_rule/index.html +++ b/app/admin/view/auth_rule/index.html @@ -19,6 +19,15 @@ +
+ +
+ + + +
+
+ {/block} {block name="table"}
@@ -40,6 +49,12 @@ + + -{/block} \ No newline at end of file +{/block} diff --git a/app/base/controller/AdminBase.php b/app/base/controller/AdminBase.php index 3ca65b09..dbacd7b2 100755 --- a/app/base/controller/AdminBase.php +++ b/app/base/controller/AdminBase.php @@ -24,9 +24,9 @@ abstract class AdminBase extends BaseController protected function initialize() { $this->online = session('onlineCategory'); - if($this->online != 'admin') - { - \app\facade\OnLine::jump('/login', '请使用管理员帐号登录'); - } + // if($this->online != 'admin') + // { + // \app\facade\OnLine::jump('/login', '请使用管理员帐号登录'); + // } } } diff --git a/app/kaoshi/view/index/index.html b/app/kaoshi/view/index/index.html index c8df3edb..3873f74c 100755 --- a/app/kaoshi/view/index/index.html +++ b/app/kaoshi/view/index/index.html @@ -65,7 +65,7 @@