From dd47c6473e44afe2492693247090f5e15f962e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=9C=E5=AE=9D=E4=B9=A6=E8=AE=B0?= Date: Wed, 26 May 2021 19:53:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=A6=E7=94=9F=E6=89=B9?= =?UTF-8?q?=E9=87=8F=E4=B8=8A=E4=BC=A0=E7=8F=AD=E7=BA=A7=E5=88=AB=E5=90=8D?= =?UTF-8?q?=E5=9D=9A=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/student/controller/Index.php | 9 +++------ app/student/model/Student.php | 13 +++++++++++-- app/student/validate/Student.php | 4 +++- app/student/view/index/create.html | 10 +++++++++- app/teach/model/Banji.php | 15 ++++++++++----- public/uploads/student/student_template.xlsx | Bin 22484 -> 22500 bytes 6 files changed, 36 insertions(+), 15 deletions(-) diff --git a/app/student/controller/Index.php b/app/student/controller/Index.php index 67422649..3a275f12 100755 --- a/app/student/controller/Index.php +++ b/app/student/controller/Index.php @@ -180,6 +180,7 @@ class Index extends AdminBase ,'kaoshi' ,'quanpin' ,'shoupin' + ,'kaohao' ], 'POST'); if(session('user_id') != 1 && session('user_id') != 2) { @@ -231,7 +232,7 @@ class Index extends AdminBase public function edit($id) { // 获取学生信息 - $list['data'] = STU::field('id, xingming, sex, shenfenzhenghao, shengri, banji_id, kaoshi, status, quanpin, shoupin') + $list['data'] = STU::field('id, xingming, sex, shenfenzhenghao, shengri, banji_id, kaoshi, status, quanpin, shoupin, kaohao') ->with([ 'stuBanji'=>function($query){ $query->field('id, ruxuenian, paixu, school_id') @@ -269,6 +270,7 @@ class Index extends AdminBase ,'kaoshi' ,'quanpin' ,'shoupin' + ,'kaohao' ], 'PUT'); $list['id'] = $id; @@ -438,11 +440,6 @@ class Index extends AdminBase ,'url' ], 'POST'); - if(session('user_id') != 1 && session('user_id') != 2) { - $data = ['msg' => '请使用超级管理员帐号添加', 'val' => 0]; - return json($data); - } - $fengefu = DIRECTORY_SEPARATOR; // 读取表格数据 $stuinfo = \app\facade\File::readXls(public_path() . 'uploads' . $fengefu . $list['url']); diff --git a/app/student/model/Student.php b/app/student/model/Student.php index 8253e46d..5a59f807 100755 --- a/app/student/model/Student.php +++ b/app/student/model/Student.php @@ -282,6 +282,17 @@ class Student extends BaseModel } } + // 权限判断 + $bjqx = event('mybanji', array()); + $bjqx = $bjqx[0]; + if ($bjqx['check'] == true) { + foreach ($bjStrName as $key => $value) { + if (!in_array($key, $bjqx['banji_id'])) { + unset($bjStrName[$key]); + } + } + } + // 根据班级切割数组 $arr = array(); foreach ($bjStrName as $sbj_k => $sbj_val) { @@ -315,8 +326,6 @@ class Student extends BaseModel $add = array_diff($xlsStuList, $sfzh); $del = array_diff($sfzh, $xlsStuList); - - // 从新增的数据中查找是否有已经存在,但是班级不正确的信息。 $add_temp = self::withTrashed() ->where('shenfenzhenghao', 'in', $add) diff --git a/app/student/validate/Student.php b/app/student/validate/Student.php index 02961d87..da258fd3 100755 --- a/app/student/validate/Student.php +++ b/app/student/validate/Student.php @@ -22,7 +22,7 @@ class Student extends Validate 'banji_id|班级' => 'require|number', 'kaoshi|是否参加考试' => 'require|number', 'quanpin|姓名全拼' => 'require', - 'kaohao|考号' => 'require|max:25' + 'kaohao|考号' => 'alphaNum|max:25' ]; /** @@ -41,6 +41,7 @@ class Student extends Validate ,'ruxuenian' ,'banji_id' ,'kaoshi' + ,'kaohao' ], 'edit' => [ 'id' @@ -48,6 +49,7 @@ class Student extends Validate ,'sex' ,'shenfenzhenghao' ,'kaoshi' + ,'kaohao' ], 'onekaohao' => [ 'id' diff --git a/app/student/view/index/create.html b/app/student/view/index/create.html index 685d37b7..1739a896 100755 --- a/app/student/view/index/create.html +++ b/app/student/view/index/create.html @@ -74,6 +74,14 @@ +
+ +
+ +
+