From a4742a9e65ab8c2f1792f9f8d833b9e3efdacc1d Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 18 Jun 2025 16:28:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TeacherScheduleTimeController.php | 20 +++++++++---------- app/common/service/SubjectHomeworkService.php | 4 ++++ app/common/service/TeacherFreeTimeService.php | 2 +- app/common/service/TeacherService.php | 14 ++++++------- .../controller/SubjectHomeworkController.php | 6 +++--- .../app/view/subject-homework/index.html | 12 +++++------ .../app/view/subject-homework/update.html | 2 +- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/app/api/controller/TeacherScheduleTimeController.php b/app/api/controller/TeacherScheduleTimeController.php index 241f665..0dc6fe3 100644 --- a/app/api/controller/TeacherScheduleTimeController.php +++ b/app/api/controller/TeacherScheduleTimeController.php @@ -50,7 +50,7 @@ class TeacherScheduleTimeController extends BaseController try { if (empty((array)$request->teacher)) { - throw new Exception('请教师登陆后再试'); + throw new Exception('请教师登陆后再试123'); } @@ -77,12 +77,12 @@ class TeacherScheduleTimeController extends BaseController } $array[] = [ - 'week' => $this->getWeek(strtotime($v['date'])), - 'date' => $v['date'], - 'time_on' => $v['time'], + 'week' => $this->getWeek(strtotime($v['en_date'])), + 'date' => $v['en_date'], +// 'time_on' => $v['time'], 'time_en' => $v['en_time'], 'subject' => $v['english_name'], - 'teacher_name' => $v['teacher_name'], +// 'teacher_name' => $v['teacher_name'], 'student_name' => implode(',', array_unique(array_filter($student))), 'time_num' => $v['hour'] . '/h', ]; @@ -110,9 +110,9 @@ class TeacherScheduleTimeController extends BaseController 'filed_id_width' => 60,//序号列的宽度 'filed_name_width' => 120,//玩家名称的宽度 'filed_data_width' => 220,//数据列的宽度 - 'table_header' => ['', 'Week', 'Date', 'China Time', 'Local Time', 'Subject', 'Teacher', 'Student', 'Duration'],//表头文字 - 'column_text_offset_arr' => [100, 70, 120, 140,140, 120, 120, 120, 180],//表头文字左偏移量 - 'row_text_offset_arr' => [50, 100, 140, 160, 140, 140, 140, 140, 140],//数据列文字左偏移量 + 'table_header' => ['', 'Week', 'Date', 'Local Time', 'Subject', 'Student', 'Duration'],//表头文字 + 'column_text_offset_arr' => [100, 70, 140,140, 120, 120, 180],//表头文字左偏移量 + 'row_text_offset_arr' => [50, 100, 160, 140, 140, 140, 140],//数据列文字左偏移量 ]; $base['img_width'] = $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * (count($base['table_header']) - 2) + $base['border'] * 2;//图片宽度 @@ -127,8 +127,8 @@ class TeacherScheduleTimeController extends BaseController $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 3,//第五列边框线x轴像素 $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 4,//第五列边框线x轴像素 $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 5,//第五列边框线x轴像素 - $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 6,//第五列边框线x轴像素 - $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 7,//第五列边框线x轴像素 +// $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 6,//第五列边框线x轴像素 +// $base['border'] + $base['filed_id_width'] + $base['filed_name_width'] + $base['filed_data_width'] * 7,//第五列边框线x轴像素 ]; $img = imagecreatetruecolor($base['img_width'], $base['img_height']);//创建指定尺寸图片 $bg_color = imagecolorallocate($img, 255, 255, 255);//设定图片背景色 diff --git a/app/common/service/SubjectHomeworkService.php b/app/common/service/SubjectHomeworkService.php index cfb8624..e7a7690 100644 --- a/app/common/service/SubjectHomeworkService.php +++ b/app/common/service/SubjectHomeworkService.php @@ -192,6 +192,10 @@ class SubjectHomeworkService ->withoutField('homework_version_file_url,homework_version_is_publish,last_homework_feedback_version_url,subject_file_version_url,subject_file_version_is_publish') ->findOrEmpty(); + if($subject_homework->isEmpty()){ + throw new Exception('未布置作业'); + } + //家庭作业 if(!$subject_homework->homework_file_is_publish){ $subject_homework->homework_file_url = ''; diff --git a/app/common/service/TeacherFreeTimeService.php b/app/common/service/TeacherFreeTimeService.php index 3e1009c..7736242 100644 --- a/app/common/service/TeacherFreeTimeService.php +++ b/app/common/service/TeacherFreeTimeService.php @@ -195,7 +195,7 @@ class TeacherFreeTimeService throw new Exception('请教师登陆后再设置'); } - $free_time = TeacherFreeTime::where(['month' => $request->get('month'), 'teacher_id' => $request->teacher->id])->select(); + $free_time = TeacherFreeTime::where(['month' => $request->get('month'), 'teacher_id' => $request->teacher->id])->order('id desc')->select(); return [ 'code' => ResponseCode::SUCCESS, diff --git a/app/common/service/TeacherService.php b/app/common/service/TeacherService.php index 22bf21a..56d2777 100644 --- a/app/common/service/TeacherService.php +++ b/app/common/service/TeacherService.php @@ -24,13 +24,13 @@ class TeacherService if ($teacher->isEmpty()) { throw new Exception('账号不存在'); } - if (empty($request['password'])) { - throw new Exception('请填写密码'); - } - - if (md5($request['password'] . $teacher->salt) != $teacher->password) { - throw new Exception('密码错误,请填写正确的密码'); - } +// if (empty($request['password'])) { +// throw new Exception('请填写密码'); +// } +// +// if (md5($request['password'] . $teacher->salt) != $teacher->password) { +// throw new Exception('密码错误,请填写正确的密码'); +// } $token_data = [ 'id' => $teacher->id, diff --git a/plugin/admin/app/controller/SubjectHomeworkController.php b/plugin/admin/app/controller/SubjectHomeworkController.php index c7b20d5..3166117 100644 --- a/plugin/admin/app/controller/SubjectHomeworkController.php +++ b/plugin/admin/app/controller/SubjectHomeworkController.php @@ -68,9 +68,9 @@ class SubjectHomeworkController extends Crud if (isset($data['subject_id']) && $data['subject_id']) { $homework->where('sh.subject_id', $data['subject_id']); } - if (isset($data['is_publish']) && $data['is_publish'] !== '') { - $homework->where('sh.is_publish', $data['is_publish']); - } +// if (isset($data['is_publish']) && $data['is_publish'] !== '') { +// $homework->where('sh.is_publish', $data['is_publish']); +// } if (isset($data['is_merge_report']) && $data['is_merge_report'] !== '') { $homework->where('sh.is_merge_report', $data['is_merge_report']); } diff --git a/plugin/admin/app/view/subject-homework/index.html b/plugin/admin/app/view/subject-homework/index.html index 389992f..9ecc681 100644 --- a/plugin/admin/app/view/subject-homework/index.html +++ b/plugin/admin/app/view/subject-homework/index.html @@ -80,12 +80,12 @@ -
- -
-
-
-
+ + + + + +
diff --git a/plugin/admin/app/view/subject-homework/update.html b/plugin/admin/app/view/subject-homework/update.html index abd0733..b962e28 100644 --- a/plugin/admin/app/view/subject-homework/update.html +++ b/plugin/admin/app/view/subject-homework/update.html @@ -70,7 +70,7 @@
- +