From c632ee7011e4199dbab0dc3c19f5ece9c6707169 Mon Sep 17 00:00:00 2001 From: Dai Date: Sat, 18 Jan 2025 14:39:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E5=90=8D=E7=A7=B0=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E8=AF=BE=E7=A8=8B=E8=A1=A8=E4=B8=AD=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/StudentController.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) 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)) {