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 aa088c92..59147a74 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 @@ +