Actual prod

This commit is contained in:
mac 2026-07-10 18:36:26 +03:00
parent 72297c6644
commit 25b02a903c

View File

@ -1378,6 +1378,46 @@ class CommonController extends ApiController
}
}
// Отдельные города субъекта (separate_city, напр. Новокузнецк): их районы — своей группой,
// как в десктопном «Поиске»; иначе на мобилке эти районы недоступны вовсе.
// separate_city.region_id ссылается на РЕБЁНКА субъекта (мета-регион, напр. 1483), а не на сам субъект —
// поэтому матчим по id из $region (дети переданного субъекта), как getRaionByRegion по $region[0]['id'].
$sep_region_ids = [];
foreach ($region as $rg) {
if (!empty($rg['id'])) $sep_region_ids[] = (int)$rg['id'];
}
// плюс сам переданный region_id (форма может слать субъект ИЛИ мету — матчим по обоим)
if (is_array($region_rf_id)) {
foreach ($region_rf_id as $rid) $sep_region_ids[] = (int)$rid;
} elseif ($region_rf_id) {
$sep_region_ids[] = (int)$region_rf_id;
}
$sep_region_ids = array_values(array_unique(array_filter($sep_region_ids)));
if (!empty($sep_region_ids)) {
$sql = "SELECT * FROM separate_city WHERE region_id IN (" . implode(',', $sep_region_ids) . ")";
if ($rez = mysql_query($sql)) {
while ($city = mysql_fetch_assoc($rez)) {
// id группы города — отрицательный, чтобы не пересекаться с id rf_regions
$city_group_id = -(int)$city['id'];
$groups[] = ['id' => $city_group_id, 'name' => $city['name']];
$sql_rayon = "SELECT r.* FROM rayon r JOIN separate_city_rayons scr ON scr.rayon_id = r.id
WHERE scr.sep_city_id = " . (int)$city['id'] . " ORDER BY r.rayon";
if ($rez_rayon = mysql_query($sql_rayon)) {
while ($rayon = mysql_fetch_assoc($rez_rayon)) {
$list[] = ['id' => (int)$rayon['id'], 'name' => $rayon['rayon'], 'group_id' => $city_group_id];
}
}
}
}
}
// фронт читает groups как мапу id→имя (groups[group_id]) — приводим к форме остальных эндпоинтов
$groups_map = [];
foreach ($groups as $g)
$groups_map[(int)$g['id']] = $g['name'];
$groups = $groups_map;
if (!$error) {
$app->response->header('Content-Type', 'application/json');
$app->response->setStatus(200);
@ -3981,6 +4021,10 @@ class CommonController extends ApiController
$errors[] = mysql_error();
}
// синхронный ES-реиндекс: сменился владелец (id_add_user) — объект сразу у нового агента (как Sphinx-синк выше)
require_once($_SERVER['DOCUMENT_ROOT'] . "/engine/helpers/search_es_bridge.php");
es_reindex_objects(array((int)$object_id));
//перенос событий объектов
$sql = "UPDATE user_object_events SET user_id = $new_user->id WHERE object_id = $object_id";
if (!mysql_query($sql)) {
@ -15018,7 +15062,7 @@ class CommonController extends ApiController
$user->get($user_id);
$user->checkPermissions($user_id, false);
$agency_id = $user->agencyId;
if(in_array($agency_id, [4, 8257, 7384, 11082, 12556, 13154, 14134, 11417, 12028, 18237, 19111,19794, 22666])){
if(in_array($agency_id, [4, 8257, 7384, 11082, 12556, 13154, 14134, 11417, 12028, 18237, 19111,19794, 22666, 20189])){
$required_type = false;
$required_role = false;
}