作者 lyh

gx

... ... @@ -248,164 +248,23 @@ class BTemplateLogic extends BaseLogic
* @time :2023/10/21 16:55
*/
public function getCommonHtml($source,$is_list,$template_id){
$is_head = $this->user['configuration']['is_head'] ?? 0;
$type = $this->getType($source,$is_list,$template_id);
$data = [
'template_id' => $template_id,
'project_id' => $this->user['project_id']
'project_id' => $this->user['project_id'],
'type'=>$type
];
if($template_id == 0){
$is_head = BTemplate::IS_HEADER;
}
if($is_head != BTemplate::IS_NO_HEADER) {
//查看页面是否设置自定义头部底部
$pageSettingModel = new PageSetting();
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
if($pageInfo !== false){
$commonInfo = [];
if ($source == BTemplate::SOURCE_BLOG) {//产品页
$commonInfo = $this->getProductCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_BLOG) {//博客页
$commonInfo = $this->getBlogCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_NEWS) {//新闻页
$commonInfo = $this->getNewsCommonHtml($data,$is_list,$pageInfo);
}
if ($source == BTemplate::SOURCE_KEYWORD) {//聚合页
$commonInfo = $this->getKeywordCommonHtml($data,$pageInfo);
}
if(!empty($commonInfo)){
return $this->success($commonInfo);
}
}
}
//获取首页公共的头部和底部
$commonInfo = $this->getHomeCommonHtml($data);
return $commonInfo;
}
/**
* @remark :获取首页头部底部
* @name :getHomeCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:11
*/
public function getHomeCommonHtml($data){
$data['type'] = BTemplate::SOURCE_HOME;
$commonTemplateModel = new BTemplateCommon();
return $commonTemplateModel->read($data);
}
/**
* @remark :聚合页
* @name :getKeywordCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:09
*/
public function getKeywordCommonHtml($data,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
$data['type'] = BTemplate::TYPE_EIGHT;
if ($pageInfo['polymerization'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$data['type'] = BTemplate::SOURCE_HOME;
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
return $this->success($commonInfo);
}
/**
* @remark :产品头部底部
* @name :getProductCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:01
*/
public function getProductCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if($is_list == BTemplate::IS_LIST){
$data['type'] = BTemplate::TYPE_THREE;
if ($pageInfo['product_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_TWO;
if ($pageInfo['product_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :博客头部
* @name :getBlogCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:05
*/
public function getBlogCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if ($is_list == BTemplate::IS_LIST) {
$data['type'] = BTemplate::TYPE_SEVEN;
if ($pageInfo['blog_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_SIX;
if ($pageInfo['blog_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :新闻头部
* @name :getNewsCommonHtml
* @author :lyh
* @method :post
* @time :2023/12/27 16:07
*/
public function getNewsCommonHtml($data,$is_list,$pageInfo){
$commonInfo = [];
$commonTemplateModel = new BTemplateCommon();
if ($is_list == BTemplate::IS_LIST) {
$data['type'] = BTemplate::TYPE_SEVEN;
if ($pageInfo['news_list'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
} else {
$data['type'] = BTemplate::TYPE_SIX;
if ($pageInfo['news_details'] != 0) {
$commonInfo = $commonTemplateModel->read($data);
if($commonInfo === false){
$commonInfo = [];
}
}
}
return $this->success($commonInfo);
}
/**
* @remark :保存修改后的模版
... ...