Merge branch 'master' of http://gitea.enheng.asia/risin9/course
This commit is contained in:
commit
8af9c329b4
@ -54,4 +54,9 @@ class TeacherScheduleTime extends BaseModel
|
||||
return $this->hasMany(StudentSchedule::class, 'teacher_schedule_time_id', 'id');
|
||||
}
|
||||
|
||||
public function studentHomework()
|
||||
{
|
||||
return $this->hasMany(StudentHomework::class, 'teacher_schedule_time_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class TeacherScheduleTimeService
|
||||
}
|
||||
|
||||
$list = $schedule->field('id,teacher_id,date,time,en_time,hour,month,subject_id,is_publish')
|
||||
->with(['subject', 'studentSchedule', 'teacher'])
|
||||
->with(['subject', 'studentSchedule', 'teacher', 'studentHomework'])
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($list as $key => &$item) {
|
||||
@ -120,6 +120,18 @@ class TeacherScheduleTimeService
|
||||
}
|
||||
}
|
||||
}
|
||||
if($item['studentHomework']){
|
||||
$item['has_homework'] = 0;
|
||||
foreach ($item['studentHomework'] as $index => $value) {
|
||||
if($value['is_publish']){
|
||||
$item['has_homework'] = 1;
|
||||
}else{
|
||||
unset($item['studentHomework'][$index]);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$item['has_homework'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
|
@ -515,8 +515,8 @@ class TeacherScheduleTimeController extends Crud
|
||||
return json([
|
||||
'code' => ResponseCode::WEB_API_SUCCESS,
|
||||
'data' => [
|
||||
// 'url' => getenv('SERVER_DOMAIN') . $file_path,
|
||||
'file_url' => 'http://course.test' . $file_path . $file_name,
|
||||
'file_url' => getenv('SERVER_DOMAIN') . $file_path . $file_name,
|
||||
// 'file_url' => 'http://course.test' . $file_path . $file_name,
|
||||
'file_name' => $file_name
|
||||
],
|
||||
'msg' => 'success'
|
||||
|
Loading…
x
Reference in New Issue
Block a user