|
|
|
|
@ -1087,7 +1087,32 @@ class CourseController extends CommonController
|
|
|
|
|
->orderBy('start_time', 'asc')
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
|
|
$list->each(function ($calendar) {
|
|
|
|
|
if (!empty($calendar->course)) {
|
|
|
|
|
$calendar->course->start_time = $this->formatDateTimeWithSeconds($calendar->course->start_time ?? null);
|
|
|
|
|
$calendar->course->end_time = $this->formatDateTimeWithSeconds($calendar->course->end_time ?? null);
|
|
|
|
|
}
|
|
|
|
|
if (!empty($calendar->courseContent)) {
|
|
|
|
|
$calendar->courseContent->each(function ($content) {
|
|
|
|
|
$content->start_time = $this->formatDateTimeWithSeconds($content->start_time ?? null);
|
|
|
|
|
$content->end_time = $this->formatDateTimeWithSeconds($content->end_time ?? null);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function formatDateTimeWithSeconds($value)
|
|
|
|
|
{
|
|
|
|
|
if (empty($value)) {
|
|
|
|
|
return $value;
|
|
|
|
|
}
|
|
|
|
|
$timestamp = strtotime($value);
|
|
|
|
|
if ($timestamp === false) {
|
|
|
|
|
return $value;
|
|
|
|
|
}
|
|
|
|
|
return date('Y-m-d H:i:s', $timestamp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|