作者 lyh

变更数据

@@ -133,7 +133,7 @@ class HrController extends BaseController @@ -133,7 +133,7 @@ class HrController extends BaseController
133 public function getGeoManagerList() 133 public function getGeoManagerList()
134 { 134 {
135 $geoConfModel = new GeoConf(); 135 $geoConfModel = new GeoConf();
136 - $geo_manage_list = $geoConfModel->geoManage(); 136 + $geo_manage_list = $geoConfModel->geoManage($this->param['name'] ?? '');
137 $this->response('success',Code::SUCCESS,$geo_manage_list); 137 $this->response('success',Code::SUCCESS,$geo_manage_list);
138 } 138 }
139 } 139 }
@@ -24,15 +24,11 @@ class GeoConf extends Base @@ -24,15 +24,11 @@ class GeoConf extends Base
24 protected $table = 'gl_project_geo_conf'; 24 protected $table = 'gl_project_geo_conf';
25 25
26 26
27 - /**  
28 - * GEO 负责人集合  
29 - * TODO 负责人:优化师 + 陶婵 + 艾媛媛  
30 - * @return array  
31 - */  
32 - public function geoManage() 27 + public function geoManage($name = '')
33 { 28 {
34 $key = 'geo_manage_list_' . date('Ymd'); 29 $key = 'geo_manage_list_' . date('Ymd');
35 $optimize = Cache::get($key); 30 $optimize = Cache::get($key);
  31 +
36 if (empty($optimize)) { 32 if (empty($optimize)) {
37 $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray(); 33 $optimize = ManageHr::where(['status' => ManageHr::STATUS_ONE, 'entry_position' => 46])->pluck('name', 'id')->toArray();
38 $optimize[11] = '陶婵'; 34 $optimize[11] = '陶婵';
@@ -42,6 +38,15 @@ class GeoConf extends Base @@ -42,6 +38,15 @@ class GeoConf extends Base
42 ksort($optimize); 38 ksort($optimize);
43 Cache::put($key, $optimize, 3600); 39 Cache::put($key, $optimize, 3600);
44 } 40 }
  41 + // 如果传入了name,则返回对应的id+name
  42 + if ($name !== null) {
  43 + $id = array_search($name, $optimize);
  44 + if ($id !== false) {
  45 + // 按照原有格式返回,即 [id => name] 的数组格式
  46 + return [$id => $name];
  47 + }
  48 + return [];
  49 + }
45 return $optimize; 50 return $optimize;
46 } 51 }
47 } 52 }