master
cody 2 weeks ago
parent a627852c36
commit 69deacb2f5

@ -50,7 +50,7 @@ class CalendarsController extends BaseController
public function index() public function index()
{ {
$all = \request()->all(); $all = \request()->all();
$list = Calendar::with('course', 'courseContent','historyCourses') $list = Calendar::with('course', 'courseContent', 'historyCourses')
->where(function ($query) use ($all) { ->where(function ($query) use ($all) {
if (isset($all['month'])) { if (isset($all['month'])) {
$query->where('start_time', 'like', $all['month'] . '%'); $query->where('start_time', 'like', $all['month'] . '%');
@ -61,7 +61,19 @@ class CalendarsController extends BaseController
$list = $list->toArray(); $list = $list->toArray();
return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), ($all['file_name'] ?? '') . date('YmdHis') . '.xlsx'); 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'));
} }
/** /**

@ -141,7 +141,7 @@ class OtherController extends CommonController
// 重点上市公司 // 重点上市公司
$list['cover_stock_total'] = CourseSign::shangshi(); $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') . '%') ->where('date', 'like', '%' . date('Y-m') . '%')
->get(); ->get();
// 课程统计 // 课程统计

Loading…
Cancel
Save