作者 lyh

gx

@@ -37,15 +37,17 @@ class GoogleSearchController extends BaseController @@ -37,15 +37,17 @@ class GoogleSearchController extends BaseController
37 $searchDetailModel = new GoogleSearchDetail(); 37 $searchDetailModel = new GoogleSearchDetail();
38 $this->map['project_id']= $this->user['project_id']; 38 $this->map['project_id']= $this->user['project_id'];
39 $data = $searchDetailModel->lists($this->map,$this->page,$this->row); 39 $data = $searchDetailModel->lists($this->map,$this->page,$this->row);
40 - if($this->param['type'] == 'country'){  
41 - $country = [];  
42 - foreach ($data as $val){  
43 - $country[] = Country::getCountryNameByAlpha3($val['keys']);  
44 - }  
45 - $zh_country = Translate::tran($country, 'zh');  
46 - foreach ($data as $key => $val){  
47 - $val['zh_country'] = $zh_country[$key];  
48 - $data[$key] = $val; 40 + if(!empty($data)){
  41 + if($this->param['type'] == 'country'){
  42 + $country = [];
  43 + foreach ($data as $val){
  44 + $country[] = Country::getCountryNameByAlpha3($val['keys']);
  45 + }
  46 + $zh_country = Translate::tran($country, 'zh');
  47 + foreach ($data as $key => $val){
  48 + $val['zh_country'] = $zh_country[$key];
  49 + $data[$key] = $val;
  50 + }
49 } 51 }
50 } 52 }
51 $this->response('success',Code::SUCCESS,$data); 53 $this->response('success',Code::SUCCESS,$data);