作者 lyh

gx

... ... @@ -28,7 +28,7 @@ class InitHtmlController extends BaseController
* @remark :获取可视化详情页模板数据
* @name :getDetailInfo
* @author :lyh
* @method :post
* @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
* @time :2023/10/24 11:27
*/
public function getDetailHtml(InitHtmlLogic $logic){
... ... @@ -45,7 +45,7 @@ class InitHtmlController extends BaseController
* @remark :保存详情页模板数据
* @name :saveDetail
* @author :lyh
* @method :post
* @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
* @time :2023/10/24 14:47
*/
public function saveDetailHtml(InitHtmlLogic $logic){
... ...
... ... @@ -28,7 +28,7 @@ class InitHtmlLogic extends BaseLogic
* @remark :获取非定制项目复合页数据
* @name :getDetailHtml
* @author :lyh
* @method :post
* @method :post $param (type:类型,2产品 3博客 4新闻 对应扩展模块的id)
* @time :2023/12/27 10:50
*/
public function getDetailHtml(){
... ... @@ -94,17 +94,18 @@ class InitHtmlLogic extends BaseLogic
* @method :post
* @time :2023/12/15 18:12
*/
public function saveDetailCommonHtml($html,$template_id,$is_custom,$is_list){
public function saveDetailCommonHtml($html,$type,$template_id,$is_custom,$is_list){
$publicData = $this->handleCommonParam($html);
$templateCommonModel = new BTemplateCommon();
if($is_custom == BTemplate::SOURCE_CUSTOM){//扩展模块
//更新首页头部底部
$templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
return $this->success();
}
//查看当前模板是否有独立头部,有独立头部,更新独立头部,无独立头部,更新公共头部
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
$templateCommonInfo = $templateCommonModel->read(['type'=>$type,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
$is_head = $this->user['configuration']['is_head'] ?? 0;
if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::扩展模块无独立头部底部
$is_head = BTemplate::IS_NO_HEADER;
}
if($is_head == BTemplate::IS_HEADER) {
//有独立头部,更新独立头部
$commonType = $this->getHeaderType($type,$is_list);
$templateCommonInfo = $templateCommonModel->read(['project_id'=>$this->user['project_id'],'template_id'=>$template_id,'type'=>$commonType]);
if($templateCommonInfo === false){
$publicData['type'] = $type;
$publicData['project_id'] = $this->user['project_id'];
... ... @@ -114,9 +115,10 @@ class InitHtmlLogic extends BaseLogic
$templateCommonModel->edit($publicData,['id'=>$templateCommonInfo['id']]);
}
}else{
//更新首页头部底部
$templateCommonModel->edit($publicData,['type'=>BTemplate::SOURCE_HOME,'project_id'=>$this->user['project_id'],'template_id'=>$template_id]);
}
return true;
return $this->success();
}
/**
... ... @@ -161,20 +163,20 @@ class InitHtmlLogic extends BaseLogic
* @time :2023/12/15 18:06
*/
public function getTypeCommonHtml($template_id,$type,$is_custom,$is_list){
//判断当前项目是否有设置独立头部的权限
$is_head = $this->user['configuration']['is_head'] ?? 0;
if($is_custom == BTemplate::SOURCE_CUSTOM){//todo::拓展模块默认取首页
$is_head = BTemplate::IS_NO_HEADER;
}
//获取首页公共部分
$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)) {
if($is_head == BTemplate::IS_HEADER) {
//有独立头部,获取独立头部
$commonType = $this->getHeaderType($type,$is_list);
$commonTypeInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType['type']]);
if($commonTypeInfo !== false){
$commonInfo = $commonTypeInfo;
}
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>$commonType]);
}else{
//首页头底
$commonInfo = $templateCommonModel->read(['template_id'=>$template_id,'project_id'=>$this->user['project_id'],'type'=>BTemplate::SOURCE_HOME]);
}
return $this->success($commonInfo);
}
... ... @@ -209,7 +211,7 @@ class InitHtmlLogic extends BaseLogic
$resultType = BTemplate::TYPE_SIX;
}
}
return $this->success(['type'=>$resultType]);
return $this->success($resultType);
}
/**
... ...
... ... @@ -38,6 +38,8 @@ class BTemplate extends Base
const TYPE_CUSTOM = 7;//扩展详情
const IS_LIST = 1;//列表页
const IS_HEADER = 1;//独立头部底部
const IS_NO_HEADER = 0;//非独立头部底部
protected $table = 'gl_web_template';
//连接数据库
... ...