diff --git a/app/Http/Controllers/Admin/CalendarsController.php b/app/Http/Controllers/Admin/CalendarsController.php index 1490dbf..1367922 100644 --- a/app/Http/Controllers/Admin/CalendarsController.php +++ b/app/Http/Controllers/Admin/CalendarsController.php @@ -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')); } /** diff --git a/app/Http/Controllers/Admin/OtherController.php b/app/Http/Controllers/Admin/OtherController.php index c630553..5a5d2b5 100755 --- a/app/Http/Controllers/Admin/OtherController.php +++ b/app/Http/Controllers/Admin/OtherController.php @@ -141,7 +141,7 @@ class OtherController extends CommonController // 重点上市公司 $list['cover_stock_total'] = CourseSign::shangshi(); // 本月课程 - $monthCourses = Calendar::with('course.teacher')->where('type', 1) + $monthCourses = Calendar::with('course.teacher') ->where('date', 'like', '%' . date('Y-m') . '%') ->get(); // 课程统计