作者 刘锟

小语种排序

@@ -25,8 +25,10 @@ class ProjectCountryLogic extends BaseLogic @@ -25,8 +25,10 @@ class ProjectCountryLogic extends BaseLogic
25 $lists = $this->model->read(['project_id'=>$this->user['project_id']]); 25 $lists = $this->model->read(['project_id'=>$this->user['project_id']]);
26 if (empty($lists)){ 26 if (empty($lists)){
27 $lists['country_lists'] = ''; 27 $lists['country_lists'] = '';
  28 + $lists['country_sort'] = '';
28 } 29 }
29 $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']); 30 $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
  31 + $lists['country_sort'] = $this->countrySortFormat($lists['country_sort']);
30 return $this->success($lists); 32 return $this->success($lists);
31 } 33 }
32 34
@@ -42,11 +44,12 @@ class ProjectCountryLogic extends BaseLogic @@ -42,11 +44,12 @@ class ProjectCountryLogic extends BaseLogic
42 $this->param['country_lists'] = ''; 44 $this->param['country_lists'] = '';
43 } 45 }
44 $this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']); 46 $this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']);
  47 +
45 if(!isset($this->param['country_sort']) || empty($this->param['country_sort'])){ 48 if(!isset($this->param['country_sort']) || empty($this->param['country_sort'])){
46 - $webLanguageModel = new WebLanguage();  
47 - $all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');  
48 - $this->param['country_sort'] = implode(',',$all_language_ids); 49 + $this->param['country_sort'] = '';
49 } 50 }
  51 + $this->param['country_sort'] = $this->countrySortFormat($this->param['country_sort']);
  52 +
50 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 53 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
51 if($info === false){ 54 if($info === false){
52 $this->param['project_id'] = $this->user['project_id']; 55 $this->param['project_id'] = $this->user['project_id'];
@@ -74,4 +77,14 @@ class ProjectCountryLogic extends BaseLogic @@ -74,4 +77,14 @@ class ProjectCountryLogic extends BaseLogic
74 } 77 }
75 return implode(',', $country_lists); 78 return implode(',', $country_lists);
76 } 79 }
  80 +
  81 + protected function countrySortFormat($country_sort){
  82 + if(empty($country_sort)){
  83 + $webLanguageModel = new WebLanguage();
  84 + $all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');
  85 + $country_sort = implode(',',$all_language_ids);
  86 + }
  87 +
  88 + return $country_sort;
  89 + }
77 } 90 }