|
...
|
...
|
@@ -7,6 +7,7 @@ use App\Models\Blog\BlogCategory; |
|
|
|
use App\Models\News\NewsCategory;
|
|
|
|
use App\Models\Product\Category;
|
|
|
|
use App\Models\Product\Product;
|
|
|
|
use App\Models\Project\PageSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Service\Service as ServiceSettingModel;
|
|
|
|
use App\Models\Template\BTemplateCommon;
|
|
...
|
...
|
@@ -61,12 +62,10 @@ class BTemplateLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先选择模版');
|
|
|
|
}
|
|
|
|
$TemplateInfo = [];
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_HOME){//首页
|
|
|
|
$TemplateInfo = $this->homeHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
if($this->param['source'] == $this->model::SOURCE_PRODUCT){//产品页
|
|
|
|
$TemplateInfo = $this->productHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}else{
|
|
|
|
$TemplateInfo = $this->otherHtml($info,$this->param['source'],$this->param['source_id']);
|
|
|
|
}
|
|
|
|
return $this->success($TemplateInfo);
|
|
|
|
}
|
|
...
|
...
|
@@ -105,7 +104,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
$TemplateInfo = $ATemplateModel->read(['id'=>$info['template_id']]);
|
|
|
|
}else{
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>$source]);
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$TemplateInfo['html'] = $commonInfo['head_css'].$TemplateInfo['main_css'].$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$TemplateInfo['main_html'].$commonInfo['footer_html'];
|
|
...
|
...
|
@@ -126,7 +125,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/25 16:40
|
|
|
|
*/
|
|
|
|
public function productHtml($info,$source,$source_id){
|
|
|
|
public function otherHtml($info,$source,$source_id){
|
|
|
|
$homeTemplateInfo = $this->webTemplateInfo($info['template_id'],1,0);
|
|
|
|
if($homeTemplateInfo === false){
|
|
|
|
$this->fail('请先装修首页');
|
|
...
|
...
|
@@ -140,9 +139,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
$main_html = $TemplateInfo['main_html'];
|
|
|
|
$main_style = $TemplateInfo['main_css'];
|
|
|
|
}
|
|
|
|
//兼容老数据
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>$source]);
|
|
|
|
$commonInfo = $this->getCommonPage($source,$source_id,$info['template_id']);
|
|
|
|
if($commonInfo !== false){
|
|
|
|
$html = $commonInfo['head_css'].$main_style.$commonInfo['footer_css'].$commonInfo['other'].
|
|
|
|
$commonInfo['head_html'].$main_html.$commonInfo['footer_html'];
|
|
...
|
...
|
@@ -155,6 +152,72 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :根据类型获取公共头和底
|
|
|
|
* @name :getCommonPage
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/21 16:55
|
|
|
|
*/
|
|
|
|
public function getCommonPage($source,$source_id,$template_id){
|
|
|
|
//获取首页公共的头部和底部
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
//查看页面是否设置自定义头部底部
|
|
|
|
$pageSettingModel = new PageSetting();
|
|
|
|
$pageInfo = $pageSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($pageInfo != false){
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
if($source == 2){//产品页
|
|
|
|
if($source_id != 0){//产品详情页
|
|
|
|
if($pageInfo['product_list'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>3]);
|
|
|
|
}
|
|
|
|
}else{//产品列表页
|
|
|
|
if($pageInfo['product_details'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 3){//博客页
|
|
|
|
if($source_id != 0){//博客详情页
|
|
|
|
if($pageInfo['blog_lists'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>4]);
|
|
|
|
}
|
|
|
|
}else{//产品列表页
|
|
|
|
if($pageInfo['blog_details'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>5]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 4){//新闻页
|
|
|
|
if($source_id != 0){//新闻详情页
|
|
|
|
if($pageInfo['news_lists'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>6]);
|
|
|
|
}
|
|
|
|
}else{//新闻列表页
|
|
|
|
if($pageInfo['news_details'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>7]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 5){//聚合页
|
|
|
|
if($pageInfo['polymerization'] != 0){
|
|
|
|
//使用独立头和底
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>8]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $commonInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :设置模板
|
|
|
|
* @name :setTemplate
|
|
|
|
* @author :lyh
|
|
...
|
...
|
@@ -197,6 +260,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
$info = $this->webTemplateInfo($this->param['template_id'],$this->param['source'],$this->param['source_id']);
|
|
|
|
//字符串截取
|
|
|
|
$this->param = $this->stringProcessing($this->param);
|
|
|
|
//保存头部信息
|
|
|
|
$this->saveCommonTemplate($this->param);
|
|
|
|
$this->param = $this->templateSaveParam($this->param);//组装数据
|
|
|
|
if($info === false){
|
|
...
|
...
|
@@ -224,8 +288,9 @@ class BTemplateLogic extends BaseLogic |
|
|
|
* @time :2023/10/13 14:27
|
|
|
|
*/
|
|
|
|
public function saveCommonTemplate($param){
|
|
|
|
$type = $this->getType($param['source'],$param['source_id']);
|
|
|
|
$templateCommonModel = new BTemplateCommon();
|
|
|
|
$info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
$info = $templateCommonModel->read(['template_id'=>$param['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
$data = [
|
|
|
|
'head_html'=>$param['head_html'],
|
|
|
|
'head_css'=>$param['head_css'],
|
|
...
|
...
|
@@ -236,7 +301,7 @@ class BTemplateLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$data['template_id'] = $param['template_id'];
|
|
|
|
$data['project_id'] = $this->user['project_id'];
|
|
|
|
$data['type'] = 1;
|
|
|
|
$data['type'] = $type;
|
|
|
|
$templateCommonModel->add($data);
|
|
|
|
}else{
|
|
|
|
$templateCommonModel->edit($data,['id'=>$info['id']]);
|
|
...
|
...
|
@@ -245,6 +310,61 @@ class BTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取设置的类型
|
|
|
|
* @name :getType
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/21 17:29
|
|
|
|
*/
|
|
|
|
public function getType($source,$source_id){
|
|
|
|
$type = 1;//首页公共头部底部
|
|
|
|
//查看页面是否设置自定义头部底部
|
|
|
|
$pageSettingModel = new PageSetting();
|
|
|
|
$pageInfo = $pageSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
|
|
if($pageInfo !== false){
|
|
|
|
if($source == 2){
|
|
|
|
if($source_id != 0){
|
|
|
|
if($pageInfo['product_list'] != 0){
|
|
|
|
$type = 3;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($pageInfo['product_details'] != 0){
|
|
|
|
$type = 2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 3){
|
|
|
|
if($source_id != 0){
|
|
|
|
if($pageInfo['blog_list'] != 0){
|
|
|
|
$type = 4;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($pageInfo['blog_details'] != 0){
|
|
|
|
$type = 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 4){
|
|
|
|
if($source_id != 0){
|
|
|
|
if($pageInfo['news_list'] != 0){
|
|
|
|
$type = 6;
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($pageInfo['news_details'] != 0){
|
|
|
|
$type = 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if($source == 5){
|
|
|
|
if($pageInfo['polymerization'] != 0){
|
|
|
|
$type = 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :生成记录
|
|
|
|
* @name :setTemplateLog
|
|
|
|
* @author :lyh
|
...
|
...
|
|