作者 赵彬吉

update

@@ -25,6 +25,7 @@ class ProjectCountryLogic extends BaseLogic @@ -25,6 +25,7 @@ class ProjectCountryLogic extends BaseLogic
25 if (empty($lists)){ 25 if (empty($lists)){
26 $lists = []; 26 $lists = [];
27 } 27 }
  28 + $lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
28 return $this->success($lists); 29 return $this->success($lists);
29 } 30 }
30 31
@@ -39,6 +40,8 @@ class ProjectCountryLogic extends BaseLogic @@ -39,6 +40,8 @@ class ProjectCountryLogic extends BaseLogic
39 if(!isset($this->param['country_lists']) || empty($this->param['country_lists'])){ 40 if(!isset($this->param['country_lists']) || empty($this->param['country_lists'])){
40 $this->param['country_lists'] = ''; 41 $this->param['country_lists'] = '';
41 } 42 }
  43 +
  44 + $this->param['country_lists'] = $this->countryListsFormat($this->param['country_lists']);
42 $info = $this->model->read(['project_id'=>$this->user['project_id']]); 45 $info = $this->model->read(['project_id'=>$this->user['project_id']]);
43 if($info === false){ 46 if($info === false){
44 $this->param['project_id'] = $this->user['project_id']; 47 $this->param['project_id'] = $this->user['project_id'];
@@ -51,4 +54,15 @@ class ProjectCountryLogic extends BaseLogic @@ -51,4 +54,15 @@ class ProjectCountryLogic extends BaseLogic
51 } 54 }
52 return $this->success(); 55 return $this->success();
53 } 56 }
  57 +
  58 + protected function countryListsFormat($country_lists)
  59 + {
  60 + //默认选中主语种
  61 + $country_lists = explode(',', $country_lists);
  62 + $main_lang_id = $this->project['main_lang_id'] ?? 1;
  63 + if (!in_array($main_lang_id, $country_lists)) {
  64 + $country_lists[] = $main_lang_id;
  65 + }
  66 + return implode(',', $country_lists);
  67 + }
54 } 68 }