|
|
|
|
@ -174,21 +174,21 @@ class OtherController extends CommonController
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 全国数据
|
|
|
|
|
// 全国数据(与 study 的 address 口径一致:company_address 或 company_city 的 like 匹配,含「市」的取前部如 上海市→上海 以同时匹配 上海/上海市)
|
|
|
|
|
$countryArea = Company::approvedStudents()->groupBy('company_city')->whereNotNull('company_city')->get(['company_city']);
|
|
|
|
|
$country = [];
|
|
|
|
|
foreach ($countryArea as $item) {
|
|
|
|
|
$total = User::whereHas('company', function ($query) use ($item) {
|
|
|
|
|
$query->where('company_city', $item->company_city);
|
|
|
|
|
$term = preg_replace('/市$/', '', $item->company_city) ?: $item->company_city;
|
|
|
|
|
$total = User::whereHas('company', function ($query) use ($term) {
|
|
|
|
|
$query->where('company_address', 'like', '%' . $term . '%')
|
|
|
|
|
->orWhere('company_city', 'like', '%' . $term . '%');
|
|
|
|
|
})->where('is_schoolmate', 1)->count();
|
|
|
|
|
if (empty($total)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$country[] = [
|
|
|
|
|
'area' => $item->company_city,
|
|
|
|
|
'total' => User::whereHas('company', function ($query) use ($item) {
|
|
|
|
|
$query->where('company_city', $item->company_city);
|
|
|
|
|
})->where('is_schoolmate', 1)->count()
|
|
|
|
|
'total' => $total,
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|