|
|
|
|
@ -50,7 +50,7 @@ class CalendarsController extends BaseController
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
|
|
|
|
$all = \request()->all();
|
|
|
|
|
$list = Calendar::with('course', 'courseContent','historyCourses')
|
|
|
|
|
$list = Calendar::with('course', 'courseContent', 'historyCourses')
|
|
|
|
|
->where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['month'])) {
|
|
|
|
|
$query->where('start_time', 'like', $all['month'] . '%');
|
|
|
|
|
@ -61,7 +61,19 @@ class CalendarsController extends BaseController
|
|
|
|
|
$list = $list->toArray();
|
|
|
|
|
return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), ($all['file_name'] ?? '') . date('YmdHis') . '.xlsx');
|
|
|
|
|
}
|
|
|
|
|
return $this->success($list);
|
|
|
|
|
// 本月日历天数
|
|
|
|
|
$monthDayCalendar = Calendar::where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['month'])) {
|
|
|
|
|
$query->where('start_time', 'like', $all['month'] . '%');
|
|
|
|
|
}
|
|
|
|
|
})->where('is_count_days', 1)->sum('days');
|
|
|
|
|
// 本年日历天数
|
|
|
|
|
$yearDayCalendar = Calendar::where(function ($query) use ($all) {
|
|
|
|
|
if (isset($all['month'])) {
|
|
|
|
|
$query->where('start_time', 'like', $all['month'] . '%');
|
|
|
|
|
}
|
|
|
|
|
})->where('is_count_days', 1)->sum('days');
|
|
|
|
|
return $this->success(compact('list', 'monthDayCalendar', 'yearDayCalendar'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|