fix: 修改学生名称同步修改学生课程表中的字段
This commit is contained in:
parent
eae7394952
commit
c632ee7011
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user