feat: 限制学生中文名称
This commit is contained in:
parent
c632ee7011
commit
23ab42b371
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user