苏州市外查询

master
lion 2 weeks ago
parent edf8bfaf07
commit 71fc6f09bd

@ -273,35 +273,9 @@ class OtherController extends CommonController
$courseType->course_signs_total = $courseType->history_course_signs_total + $courseType->now_course_signs_total;
}
// 与 courses-home 口径一致:附加 is_history=1 的 HistoryCoursewhereHas calendar is_count_people=1type=体系 id日期在配置范围内
$courseTypesHistory = CourseType::where('is_history', 1)->get();
foreach ($courseTypesHistory as $hc) {
$historyList = HistoryCourse::whereHas('calendar', function ($query) {
$query->where('is_count_people', 1);
})->where(function ($query) use ($configStartDate, $configEndDate) {
$query->whereBetween('start_time', [$configStartDate, $configEndDate])
->orWhereBetween('end_time', [$configStartDate, $configEndDate]);
})->where('type', $hc->id)->get();
$hc->history_course_periods_total = $historyList->count();
$hc->now_course_periods_total = 0;
$hc->history_course_signs_total = $historyList->sum('course_type_signs_pass_unique');
$hc->now_course_signs_total = 0;
$hc->course_periods_total = $hc->history_course_periods_total;
$hc->course_signs_total = $hc->history_course_signs_total;
$courseTypes->push(clone $hc);
}
// 统计 is_chart=0 的课程类型数据,组成"其他"统计项
$otherCourseType = CourseType::getOtherStatistics($configStartDate, $configEndDate);
// 将"其他"添加到 courseTypes 集合中
$courseTypes->push($otherCourseType);
$configCourseIds = $configCourseIds->merge(CourseType::getOtherCourseIds($configStartDate, $configEndDate));
// 将统计数据直接组合到配置对象中
$config->courseTypes = $courseTypes;
// 总期数(包含"其他"
// 总期数
$config->course_periods_total = $courseTypes->sum('course_periods_total');
// 总去重人数(与 courses-home 的 course_signs_pass_unique 口径一致courseSignsTotalByUnique
$config->course_signs_unique_total = CourseSign::courseSignsTotalByUnique($configStartDate, $configEndDate, 1, $configCourseIds->unique()->values(), false);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save