Merge branch 'master' of ssh://47.101.48.251:/data/git/wx.sstbc.com

master
lion 1 week ago
commit 4601fe1333

@ -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,16 +208,35 @@ 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) {
// 累计被投企业数(从起始日期到结束日期)
$statistics['course_signs_invested'] = Company::yhInvestedTotal($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['company_invested_year_total'] = Company::companyInvestedYear($start_date, $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_after_enrollment_total'] = CourseSign::companyInvestedAfterEnrollment($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();
}
}
// 将统计数据添加到返回结果中

@ -145,7 +145,9 @@ class OtherController extends CommonController
->where('start_time', 'like', '%' . date('Y-m') . '%')
->get();
// 课程统计
$courseTypes = CourseType::where('is_chart', 1)->where('is_history', 0)->get();
$courseTypes = CourseType::where('is_chart', 1)
->orderBy('sort', 'asc')
->where('is_history', 0)->get();
// 默认开始时间
$start_date = CourseType::START_DATE;
// 默认结束日期一年以后

@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('course_types', function (Blueprint $table) {
$table->integer('sort')->default(1)->comment('排序');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('course_types', function (Blueprint $table) {
$table->dropColumn('sort');
});
}
};
Loading…
Cancel
Save