|
|
|
@ -101,6 +101,60 @@ class OtherController extends CommonController
|
|
|
|
return $this->success(compact('courseTypes', 'schoolmate', 'company', 'industryTotal', 'suzhou', 'country'));
|
|
|
|
return $this->success(compact('courseTypes', 'schoolmate', 'company', 'industryTotal', 'suzhou', 'country'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @OA\Get(
|
|
|
|
|
|
|
|
* path="/api/admin/other/home-v2",
|
|
|
|
|
|
|
|
* tags={"其他"},
|
|
|
|
|
|
|
|
* summary="驾驶舱V2",
|
|
|
|
|
|
|
|
* description="",
|
|
|
|
|
|
|
|
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
|
|
|
|
|
|
|
|
* @OA\Response(
|
|
|
|
|
|
|
|
* response="200",
|
|
|
|
|
|
|
|
* description="暂无"
|
|
|
|
|
|
|
|
* )
|
|
|
|
|
|
|
|
* )
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function homeV2()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 校友总数
|
|
|
|
|
|
|
|
$schoolmate['schoolmate_total'] = User::where('is_schoolmate', 1)->count();
|
|
|
|
|
|
|
|
// 2025年校友数
|
|
|
|
|
|
|
|
$schoolmate['schoolmate_year'] = User::where('is_schoolmate', 1)->where('created_at', 'like', '%' . date('Y') . '%')->count();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 课程统计
|
|
|
|
|
|
|
|
$courseTypes = CourseType::where('is_chart', 1)->get();
|
|
|
|
|
|
|
|
$start_date = '2020-01-01';
|
|
|
|
|
|
|
|
$end_date = date('Y-m-d');
|
|
|
|
|
|
|
|
foreach ($courseTypes as $courseType) {
|
|
|
|
|
|
|
|
// 课程
|
|
|
|
|
|
|
|
$courses = Course::whereIn('type', $courseType->id)
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
// 已开设期数
|
|
|
|
|
|
|
|
$courseType->course_periods_total = Course::where('type', $courseType->id)->count();
|
|
|
|
|
|
|
|
// 培养人数去重
|
|
|
|
|
|
|
|
$courseType->course_signs_total = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses->pluck('id'), null, $userIds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 苏州区域数据
|
|
|
|
|
|
|
|
$suzhou = Company::where('company_city', '苏州市')
|
|
|
|
|
|
|
|
// 根据company_area分组查询公司数量和用户数量
|
|
|
|
|
|
|
|
->leftJoin('users', 'companies.id', '=', 'users.company_id')
|
|
|
|
|
|
|
|
->select(
|
|
|
|
|
|
|
|
'company_area',
|
|
|
|
|
|
|
|
DB::raw('count(distinct companies.id) as company_total'),
|
|
|
|
|
|
|
|
DB::raw('count(distinct users.id) as user_total')
|
|
|
|
|
|
|
|
)->groupBy('company_area')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
// 全国数据
|
|
|
|
|
|
|
|
$country = Company::leftJoin('users', 'companies.id', '=', 'users.company_id')
|
|
|
|
|
|
|
|
->select(
|
|
|
|
|
|
|
|
'company_city',
|
|
|
|
|
|
|
|
DB::raw('count(distinct companies.id) as company_total'),
|
|
|
|
|
|
|
|
DB::raw('count(distinct users.id) as user_total')
|
|
|
|
|
|
|
|
)->groupBy('company_city')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
return $this->success(compact('courseTypes', 'schoolmate', 'suzhou', 'country'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @OA\Get(
|
|
|
|
* @OA\Get(
|
|
|
|
* path="/api/admin/other/courses-home",
|
|
|
|
* path="/api/admin/other/courses-home",
|
|
|
|
|