|
|
|
|
@ -135,22 +135,33 @@ class OtherController extends CommonController
|
|
|
|
|
$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',
|
|
|
|
|
$suzhou = DB::table('companies')
|
|
|
|
|
->where('company_city', '苏州市')
|
|
|
|
|
->whereNotNull('company_area')
|
|
|
|
|
->whereNull('companies.deleted_at')
|
|
|
|
|
->leftJoin('users', function ($join) {
|
|
|
|
|
$join->on('companies.id', '=', 'users.company_id')
|
|
|
|
|
->whereNull('users.deleted_at');
|
|
|
|
|
})->select(
|
|
|
|
|
'companies.company_area',
|
|
|
|
|
DB::raw('count(distinct companies.id) as company_total'),
|
|
|
|
|
DB::raw('count(distinct users.id) as user_total')
|
|
|
|
|
)->groupBy('company_area')
|
|
|
|
|
)->groupBy('companies.company_area')
|
|
|
|
|
->get();
|
|
|
|
|
// 全国数据
|
|
|
|
|
$country = Company::leftJoin('users', 'companies.id', '=', 'users.company_id')
|
|
|
|
|
$country = DB::table('companies')
|
|
|
|
|
->whereNotNull('company_city')
|
|
|
|
|
->whereNull('companies.deleted_at')
|
|
|
|
|
->leftJoin('users', function ($join) {
|
|
|
|
|
$join->on('companies.id', '=', 'users.company_id')
|
|
|
|
|
->whereNull('users.deleted_at');
|
|
|
|
|
})
|
|
|
|
|
->select(
|
|
|
|
|
'company_city',
|
|
|
|
|
'companies.company_city',
|
|
|
|
|
DB::raw('count(distinct companies.id) as company_total'),
|
|
|
|
|
DB::raw('count(distinct users.id) as user_total')
|
|
|
|
|
)->groupBy('company_city')
|
|
|
|
|
)
|
|
|
|
|
->groupBy('companies.company_city')
|
|
|
|
|
->get();
|
|
|
|
|
return $this->success(compact('courseTypes', 'schoolmate', 'suzhou', 'country'));
|
|
|
|
|
}
|
|
|
|
|
|