|
...
|
...
|
@@ -4,6 +4,8 @@ namespace App\Http\Logic\Bside\Setting; |
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Project\Country as CountryModel;
|
|
|
|
use App\Models\Project\CountryCustom;
|
|
|
|
use App\Models\WebSetting\WebLanguage;
|
|
|
|
|
|
|
|
class ProjectCountryLogic extends BaseLogic
|
|
|
|
{
|
|
...
|
...
|
@@ -24,8 +26,11 @@ 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);
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -41,6 +46,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'])){
|
|
|
|
$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'];
|
|
...
|
...
|
@@ -51,9 +62,45 @@ class ProjectCountryLogic extends BaseLogic |
|
|
|
if($rs === false){
|
|
|
|
$this->fail('当前数据不存在');
|
|
|
|
}
|
|
|
|
|
|
|
|
$custom_model = new CountryCustom();
|
|
|
|
//将未勾选的设置了自定义跳转的语种,置为不可用
|
|
|
|
$custom_model->edit(['status'=>0],['project_id'=>$this->user['project_id'],'language_id'=>['not in',explode(',',$this->param['country_lists'])]]);
|
|
|
|
//将勾选的设置了自定义跳转的语种,置为可用
|
|
|
|
$custom_model->edit(['status'=>1],['project_id'=>$this->user['project_id'],'language_id'=>['in',explode(',',$this->param['country_lists'])]]);
|
|
|
|
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除语种自定义跳转
|
|
|
|
* @return array
|
|
|
|
* @author Akun
|
|
|
|
* @date 2024/03/05 10:18
|
|
|
|
*/
|
|
|
|
public function country_custom_del(){
|
|
|
|
$custom_model = new CountryCustom();
|
|
|
|
$rs = $custom_model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id']]);
|
|
|
|
if($rs === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 获取语种自定义跳转详情
|
|
|
|
* @return array|bool
|
|
|
|
* @author Akun
|
|
|
|
* @date 2024/03/06 14:38
|
|
|
|
*/
|
|
|
|
public function country_custom_info(){
|
|
|
|
$custom_model = new CountryCustom();
|
|
|
|
$info = $custom_model->read(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id']],['language_id','custom_domain','is_create','type','private_key','private_cert']);
|
|
|
|
|
|
|
|
return $this->success($info?:[]);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function countryListsFormat($country_lists)
|
|
|
|
{
|
|
|
|
if(empty($country_lists)){
|
|
...
|
...
|
@@ -68,4 +115,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;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|