Compare commits

..

No commits in common. '50f17785e426f6747765f77bed8dfe301766a02c' and '392ba5ae4dedf7b60c0d33a5341b2c9bb919494a' have entirely different histories.

@ -125,7 +125,7 @@ class CompanyController extends BaseController
if ($start_year && $end_year) {
// 使用 LIKE 匹配 JSON 字符串中的年份范围
$query->where(function ($q) use ($start_year, $end_year) {
for ($year = (int) $start_year; $year <= (int) $end_year; $year++) {
for ($year = (int)$start_year; $year <= (int)$end_year; $year++) {
$q->orWhere('project_users', 'like', '%' . $year . '%');
}
});
@ -208,35 +208,16 @@ class CompanyController extends BaseController
'course_signs_invested' => 0,
'company_invested_after_enrollment_total' => 0,
'company_invested_year_total' => 0,
'course_signs_invested_companies' => [],
'company_invested_after_enrollment_companies' => [],
'company_invested_year_companies' => [],
];
$start_date = $start_year ? $start_year . '-01-01' : date('Y-01-01');
$end_date = $end_year ? $end_year . '-12-31' : date('Y-m-d');
if ($start_date && $end_date) {
// 累计被投企业数(从起始日期到结束日期)
$investedCompanies = Company::yhInvestedTotal($end_date, true);
if ($investedCompanies) {
$investedCompaniesCollection = collect($investedCompanies);
$statistics['course_signs_invested'] = $investedCompaniesCollection->count();
$statistics['course_signs_invested_companies'] = $investedCompaniesCollection->pluck('company_name')->filter()->unique()->values()->toArray();
}
$statistics['course_signs_invested'] = Company::yhInvestedTotal($end_date);
// 今年年份范围内被投企业数
$yearInvestedCompanies = Company::companyInvestedYear($start_date, $end_date, true);
if ($yearInvestedCompanies) {
$yearInvestedCompaniesCollection = collect($yearInvestedCompanies);
$statistics['company_invested_year_total'] = $yearInvestedCompaniesCollection->count();
$statistics['company_invested_year_companies'] = $yearInvestedCompaniesCollection->pluck('company_name')->filter()->unique()->values()->toArray();
}
$statistics['company_invested_year_total'] = Company::companyInvestedYear($start_date, $end_date);
// 入学后被投企业数量(在指定时间范围内报名的学员所在公司中,在入学后被投的公司数量)
$afterEnrollmentCompanies = CourseSign::companyInvestedAfterEnrollment($start_date, $end_date, null, true);
if ($afterEnrollmentCompanies) {
$statistics['company_invested_after_enrollment_total'] = count($afterEnrollmentCompanies);
$statistics['company_invested_after_enrollment_companies'] = collect($afterEnrollmentCompanies)->pluck('company.company_name')->filter()->unique()->values()->toArray();
}
$statistics['company_invested_after_enrollment_total'] = CourseSign::companyInvestedAfterEnrollment($start_date, $end_date);
}
// 将统计数据添加到返回结果中

Loading…
Cancel
Save