diff --git a/app/Http/Controllers/Admin/CompanyController.php b/app/Http/Controllers/Admin/CompanyController.php index 6f10d31..92d0af1 100644 --- a/app/Http/Controllers/Admin/CompanyController.php +++ b/app/Http/Controllers/Admin/CompanyController.php @@ -284,9 +284,11 @@ class CompanyController extends BaseController $statistics = [ 'course_signs_invested' => 0, 'company_invested_after_enrollment_total' => 0, + 'company_invested_after_enrollment_current_total' => 0, 'company_invested_year_total' => 0, 'course_signs_invested_companies' => [], 'company_invested_after_enrollment_companies' => [], + 'company_invested_after_enrollment_current_companies' => [], 'company_invested_year_companies' => [], ]; $start_date = $start_year ? $start_year . '-01-01' : date('Y-01-01'); @@ -324,6 +326,16 @@ class CompanyController extends BaseController $statistics['company_invested_year_companies'] = $yearInvestedCompaniesCollection->pluck('company_name')->filter()->unique()->values()->toArray(); } + // 当前入学后被投企业数(与 courses-home 的 company_invested_after_enrollment_total 口径一致:被投时间在 yearStart-yearEnd 内且入学≤被投) + // companyInvestedAfterEnrollment 需传日期;yearStart/yearEnd 为空时用 CourseType::START_DATE 与 end_date 表示全周期 + $currentAfterStart = $yearStart ?? CourseType::START_DATE; + $currentAfterEnd = $yearEnd ?? $end_date; + $currentAfterEnrollmentCompanies = CourseSign::companyInvestedAfterEnrollment($currentAfterStart, $currentAfterEnd, $course_ids, true); + if ($currentAfterEnrollmentCompanies) { + $statistics['company_invested_after_enrollment_current_total'] = count($currentAfterEnrollmentCompanies); + $statistics['company_invested_after_enrollment_current_companies'] = collect($currentAfterEnrollmentCompanies)->pluck('company.company_name')->filter()->unique()->values()->toArray(); + } + // 入学后被投企业数量(与 courses-home 的 company_invested_after_enrollment_total_cumulative 口径一致) $afterEnrollmentCompanies = CourseSign::companyInvestedAfterEnrollment(CourseType::START_DATE, $end_date, $course_ids, true); if ($afterEnrollmentCompanies) {