作者 刘锟

小语种排序

... ... @@ -25,8 +25,10 @@ class ProjectCountryLogic extends BaseLogic
$lists = $this->model->read(['project_id'=>$this->user['project_id']]);
if (empty($lists)){
$lists['country_lists'] = '';
$lists['country_sort'] = '';
}
$lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
$lists['country_sort'] = $this->countrySortFormat($lists['country_sort']);
return $this->success($lists);
}
... ... @@ -42,11 +44,12 @@ class ProjectCountryLogic extends BaseLogic
$this->param['country_lists'] = '';
}
$this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']);
if(!isset($this->param['country_sort']) || empty($this->param['country_sort'])){
$webLanguageModel = new WebLanguage();
$all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');
$this->param['country_sort'] = implode(',',$all_language_ids);
$this->param['country_sort'] = '';
}
$this->param['country_sort'] = $this->countrySortFormat($this->param['country_sort']);
$info = $this->model->read(['project_id'=>$this->user['project_id']]);
if($info === false){
$this->param['project_id'] = $this->user['project_id'];
... ... @@ -74,4 +77,14 @@ class ProjectCountryLogic extends BaseLogic
}
return implode(',', $country_lists);
}
protected function countrySortFormat($country_sort){
if(empty($country_sort)){
$webLanguageModel = new WebLanguage();
$all_language_ids = array_column($webLanguageModel->list([],'id',['id'],'asc'),'id');
$country_sort = implode(',',$all_language_ids);
}
return $country_sort;
}
}
... ...