diff --git a/plugin/admin/app/controller/StudentController.php b/plugin/admin/app/controller/StudentController.php index 6a52d06..69bb39b 100644 --- a/plugin/admin/app/controller/StudentController.php +++ b/plugin/admin/app/controller/StudentController.php @@ -56,11 +56,11 @@ class StudentController extends Crud if (isset($data['id']) && $data['id']) { $student->where(['id' => $data['id']]); } - if(isset($data['account']) && $data['account']){ - $student->where('account' ,'like', '%' . $data['account'] . '%'); + if (isset($data['account']) && $data['account']) { + $student->where('account', 'like', '%' . $data['account'] . '%'); } - if(isset($data['student_name']) && $data['student_name']){ - $student->where('student_name' ,'like', '%' . $data['student_name'] . '%'); + if (isset($data['student_name']) && $data['student_name']) { + $student->where('student_name', 'like', '%' . $data['student_name'] . '%'); } $limit = (int)$request->get('limit', 10); @@ -169,6 +169,11 @@ class StudentController extends Crud $student->save($update); + if ($request_data['student_name']) { + //更改其他表中所有学生名称 + StudentSchedule::where(['student_id' => $request_data['id']])->save(['student_name' => $request_data['student_name']]); + } + return json([ 'code' => ResponseCode::WEB_API_SUCCESS, 'msg' => 'success' @@ -245,8 +250,6 @@ class StudentController extends Crud } - - /** * @desc 重置openid * @param Request $request @@ -258,7 +261,7 @@ class StudentController extends Crud $request_data = $request->post(); $student = \app\common\model\Student::where(['id' => $request_data['id']])->findOrEmpty(); - if($student->isEmpty()){ + if ($student->isEmpty()) { throw new Exception('未找到学生信息'); } @@ -376,7 +379,7 @@ class StudentController extends Crud // 遍历每一列 $account = trim($currSheet->getCell('A' . $row)->getValue() ?: ''); $student_name = trim($currSheet->getCell('B' . $row)->getValue() ?: ''); - if($account && $student_name){ + if ($account && $student_name) { $password = trim($currSheet->getCell('C' . $row)->getValue() ?: ''); $salt = random_str(16); if (empty($password)) {