fix: 教师端课程只显示发布的
This commit is contained in:
parent
43f6afd8a5
commit
9c733dba91
@ -92,7 +92,7 @@ class TeacherScheduleTimeService
|
|||||||
}
|
}
|
||||||
$data = $request->get();
|
$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'])) {
|
if (isset($data['month']) && !empty($data['month'])) {
|
||||||
$schedule->where('month', $data['month']);
|
$schedule->where('month', $data['month']);
|
||||||
}
|
}
|
||||||
@ -107,9 +107,9 @@ class TeacherScheduleTimeService
|
|||||||
foreach ($list as $key => &$item) {
|
foreach ($list as $key => &$item) {
|
||||||
if ($item['studentSchedule']) {
|
if ($item['studentSchedule']) {
|
||||||
foreach ($item['studentSchedule'] as $index => $value) {
|
foreach ($item['studentSchedule'] as $index => $value) {
|
||||||
if(!$value['is_publish']){
|
if (!$value['is_publish']) {
|
||||||
unset($item['studentSchedule'][$index]);
|
unset($item['studentSchedule'][$index]);
|
||||||
}else{
|
} else {
|
||||||
unset($item['studentSchedule'][$index]['deleted_at']);
|
unset($item['studentSchedule'][$index]['deleted_at']);
|
||||||
unset($item['studentSchedule'][$index]['updated_at']);
|
unset($item['studentSchedule'][$index]['updated_at']);
|
||||||
unset($item['studentSchedule'][$index]['created_at']);
|
unset($item['studentSchedule'][$index]['created_at']);
|
||||||
@ -120,16 +120,16 @@ class TeacherScheduleTimeService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if($item['studentHomework']){
|
if ($item['studentHomework']) {
|
||||||
$item['has_homework'] = 0;
|
$item['has_homework'] = 0;
|
||||||
foreach ($item['studentHomework'] as $index => $value) {
|
foreach ($item['studentHomework'] as $index => $value) {
|
||||||
if($value['is_publish']){
|
if ($value['is_publish']) {
|
||||||
$item['has_homework'] = 1;
|
$item['has_homework'] = 1;
|
||||||
}else{
|
} else {
|
||||||
unset($item['studentHomework'][$index]);
|
unset($item['studentHomework'][$index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
$item['has_homework'] = 0;
|
$item['has_homework'] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user