diff --git a/plugin/admin/app/controller/StudentController.php b/plugin/admin/app/controller/StudentController.php index 69bb39b..f96cbe3 100644 --- a/plugin/admin/app/controller/StudentController.php +++ b/plugin/admin/app/controller/StudentController.php @@ -141,6 +141,10 @@ class StudentController extends Crud throw new Exception('未找到学生信息,操作失败'); } + if (check_chinese_chars($request_data['student_name'])){ + throw new Exception('名字中不能包含中文'); + } + if (empty($request_data['password'])) { $update = [ 'student_name' => $request_data['student_name'], @@ -373,12 +377,18 @@ class StudentController extends Crud $success_count = 0; $error_count = 0; $msg = ''; + $check_msg = ''; // 遍历每一行 for ($row = 2; $row <= $rowCnt; $row++) { // 遍历每一列 $account = trim($currSheet->getCell('A' . $row)->getValue() ?: ''); $student_name = trim($currSheet->getCell('B' . $row)->getValue() ?: ''); + + if(check_chinese_chars($student_name)){ + $check_msg .= '【'+ $student_name +'】'; + } + if ($account && $student_name) { $password = trim($currSheet->getCell('C' . $row)->getValue() ?: ''); $salt = random_str(16); @@ -409,6 +419,9 @@ class StudentController extends Crud if ($error_count) { $return_msg .= ',失败数据' . $msg . '已存在'; } + if($check_msg){ + $return_msg .= ',包含中文字符数据' . $check_msg; + } return json([ 'code' => ResponseCode::WEB_API_SUCCESS, diff --git a/plugin/admin/app/controller/StudentParentController.php b/plugin/admin/app/controller/StudentParentController.php index 30f443f..2d01067 100644 --- a/plugin/admin/app/controller/StudentParentController.php +++ b/plugin/admin/app/controller/StudentParentController.php @@ -293,12 +293,16 @@ class StudentParentController extends Crud $success_count = 0; $error_count = 0; $msg = ''; + $check_msg = ''; // 遍历每一行 for ($row = 2; $row <= $rowCnt; $row++) { // 遍历每一列 $account = trim($currSheet->getCell('A' . $row)->getValue() ?: ''); $parent_name = trim($currSheet->getCell('B' . $row)->getValue() ?: ''); +// if(check_chinese_chars($parent_name)){ +// $check_msg .= '【'+ $parent_name +'】'; +// } if($account && $parent_name){ $password = trim($currSheet->getCell('C' . $row)->getValue() ?: ''); $salt = random_str(16); @@ -329,6 +333,9 @@ class StudentParentController extends Crud if ($error_count) { $return_msg .= ',失败数据' . $msg . '已存在'; } + if($check_msg){ + $return_msg .= ',包含中文字符数据' . $check_msg; + } return json([ 'code' => ResponseCode::WEB_API_SUCCESS, diff --git a/plugin/admin/app/controller/TeacherController.php b/plugin/admin/app/controller/TeacherController.php index 0346708..b48d4b9 100644 --- a/plugin/admin/app/controller/TeacherController.php +++ b/plugin/admin/app/controller/TeacherController.php @@ -461,13 +461,16 @@ class TeacherController extends Crud $success_count = 0; $error_count = 0; $msg = ''; + $check_msg = ''; // 遍历每一行 for ($row = 2; $row <= $rowCnt; $row++) { // 遍历每一列 $account = trim($currSheet->getCell('A' . $row)->getValue() ?: ''); $teacher_name = trim($currSheet->getCell('B' . $row)->getValue() ?: ''); - +// if(check_chinese_chars($teacher_name)){ +// $check_msg .= '【'+ $teacher_name +'】'; +// } if ($account && $teacher_name) { $password = trim($currSheet->getCell('C' . $row)->getValue() ?: ''); @@ -498,6 +501,9 @@ class TeacherController extends Crud if ($error_count) { $return_msg .= ',失败数据' . $msg . '已存在'; } + if($check_msg){ + $return_msg .= ',包含中文字符数据' . $check_msg; + } return json([ 'code' => ResponseCode::WEB_API_SUCCESS,