作者 lyh

gx

... ... @@ -215,7 +215,7 @@ class BTemplateLogic extends BaseLogic
public function getCommonMain($source,$source_id,$is_custom){
$data = [];
if($is_custom == BTemplate::SOURCE_CUSTOM){
if($source_id != 0){$type = BTemplate::TYPE_SIX;}else{$type = BTemplate::TYPE_SEVEN;}
if($source_id != 0){$type = BTemplate::TYPE_CUSTOM_DETAIL;}else{$type = BTemplate::TYPE_CUSTOM_LIST;}
}else{
if ($source == BTemplate::SOURCE_PRODUCT) {if ($source_id != 0) {$type = BTemplate::TYPE_TWO;} else {$type = BTemplate::TYPE_THREE;}}
if ($source == BTemplate::SOURCE_BLOG) {if ($source_id != 0) {$type = BTemplate::TYPE_FOUR;} else {$type = BTemplate::TYPE_FIVE;}}
... ... @@ -284,8 +284,8 @@ class BTemplateLogic extends BaseLogic
public function templateSave(){
//演示项目不允许修改
$this->showProjectNoEdit($this->param['source']);
// DB::beginTransaction();
// try {
DB::beginTransaction();
try {
$this->param = $this->handleDefaultString($this->param);//设置默认字符
$templateInfo = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],
$this->param['source_id'],$this->param['is_custom']);
... ... @@ -299,11 +299,11 @@ class BTemplateLogic extends BaseLogic
//更新头部信息
$this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id']);
$this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']);
// DB::commit();
// }catch (\Exception $e){
// DB::rollBack();
// $this->fail('系统错误,请联系管理员');
// }
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('系统错误,请联系管理员');
}
//通知更新
$this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom']);
return $this->success();
... ... @@ -541,7 +541,7 @@ class BTemplateLogic extends BaseLogic
public function homeOrProduct($source,$source_id = 0,$is_custom = 0){
if($is_custom == 0){
if($source == BTemplate::SOURCE_HOME){
RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
$route = RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $this->user['project_id']);
$type = RouteMap::SOURCE_PAGE;
}elseif($source == BTemplate::SOURCE_PRODUCT){
$type = RouteMap::SOURCE_PRODUCT;
... ... @@ -552,7 +552,6 @@ class BTemplateLogic extends BaseLogic
}else{
$type = 'all';
}
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
}else{
$type = RouteMap::SOURCE_MODULE;
$route = RouteMap::getRoute($type,$source_id,$this->user['project_id']);
... ... @@ -721,7 +720,7 @@ class BTemplateLogic extends BaseLogic
$this->fail('请先设置模板');
}
$is_custom = $this->param['is_custom'] ?? 0;//扩展模块详情模版
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$is_custom);
$commonInfo = $this->getTypeCommonHtml($bSettingInfo['template_id'],$this->param['type'],$is_custom);
//获取设置的默认中间部分
$bTemplateMainModel = new BTemplateMain();
$mainInfo = $bTemplateMainModel->read(['project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
... ... @@ -745,17 +744,17 @@ class BTemplateLogic extends BaseLogic
* @method :post
* @time :2023/12/15 18:06
*/
public function getTypeCommonHtml($template_id,$is_custom){
public function getTypeCommonHtml($template_id,$type,$is_custom){
//获取首页公共部分
$templateCommonModel = new BTemplateCommon();
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
//判断当前项目是否有设置独立头部的权限
if($is_custom == BTemplate::SOURCE_CUSTOM){
return $this->success($commonInfo);
}
//判断当前项目是否有设置独立头部的权限
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
//有权限时,获取独立头部
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$type]);
if($commonTypeInfo !== false){
$commonInfo = $commonTypeInfo;
}
... ...
... ... @@ -23,7 +23,7 @@ class ProjectCountryLogic extends BaseLogic
public function country_info(){
$lists = $this->model->read(['project_id'=>$this->user['project_id']]);
if (empty($lists)){
return [];
$lists['country_lists'] = '';
}
$lists['country_lists'] = $this->countryListsFormat($lists['country_lists']);
return $this->success($lists);
... ...
... ... @@ -36,6 +36,9 @@ class BTemplate extends Base
const TYPE_SEVEN = 7;//新闻列表
const TYPE_EIGHT = 8;//自定义页面
const TYPE_CUSTOM_DETAIL = 11;//扩展详情
const TYPE_CUSTOM_LIST = 12;//扩展列表
protected $table = 'gl_web_template';
//连接数据库
protected $connection = 'custom_mysql';
... ...