lion 2 weeks ago
commit ddd3c3e21b

@ -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,21 @@ 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'])) {
// 获取$all['month']的年份部分
$year = date('Y', strtotime($all['month']));
$query->where('start_time', 'like', $year . '%');
}
})->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();
// 本月课程
$monthCourses = Calendar::with('course.teacher')->where('type', 1)
$monthCourses = Calendar::with('course.teacher')
->where('date', 'like', '%' . date('Y-m') . '%')
->get();
// 课程统计
@ -591,6 +591,7 @@ class OtherController extends CommonController
'mobile' => $user->mobile ?? '',
'company_name' => $user->company_name ?? '',
'company_position' => $user->company_position ?? '',
'from' => $user->from ?? '',
];
}
$fields = [
@ -599,6 +600,7 @@ class OtherController extends CommonController
'mobile' => '手机号',
'company_name' => '企业名称',
'company_position' => '职位',
'from' => '标签',
];
$filename = '跟班学员明细';
break;

@ -157,7 +157,7 @@ class CourseSign extends SoftDeletesModel
public static function yhInvested($start_date = null, $end_date = null, $course_ids = null, $retList = false)
{
// 判断是否使用默认时间
$isDefaultDate = empty($start_date) || $start_date == CourseType::START_DATE;
$isDefaultDate = empty($start_date) || $start_date == CourseType::START_DATE || empty($course_ids);
// 获取学员ID列表
if ($isDefaultDate) {

Loading…
Cancel
Save