fix: 教师端课程只显示发布的

This commit is contained in:
Dai 2025-01-15 21:30:06 +08:00
parent 43f6afd8a5
commit 9c733dba91

View File

@ -92,7 +92,7 @@ class TeacherScheduleTimeService
}
$data = $request->get();
$schedule = TeacherScheduleTime::order('id desc')->where(['teacher_id' => $teacher->id]);
$schedule = TeacherScheduleTime::order('id desc')->where(['teacher_id' => $teacher->id, 'is_publish' => 1]);
if (isset($data['month']) && !empty($data['month'])) {
$schedule->where('month', $data['month']);
}
@ -107,9 +107,9 @@ class TeacherScheduleTimeService
foreach ($list as $key => &$item) {
if ($item['studentSchedule']) {
foreach ($item['studentSchedule'] as $index => $value) {
if(!$value['is_publish']){
if (!$value['is_publish']) {
unset($item['studentSchedule'][$index]);
}else{
} else {
unset($item['studentSchedule'][$index]['deleted_at']);
unset($item['studentSchedule'][$index]['updated_at']);
unset($item['studentSchedule'][$index]['created_at']);
@ -120,16 +120,16 @@ class TeacherScheduleTimeService
}
}
}
if($item['studentHomework']){
if ($item['studentHomework']) {
$item['has_homework'] = 0;
foreach ($item['studentHomework'] as $index => $value) {
if($value['is_publish']){
if ($value['is_publish']) {
$item['has_homework'] = 1;
}else{
} else {
unset($item['studentHomework'][$index]);
}
}
}else{
} else {
$item['has_homework'] = 0;
}
}