作者 lyh

gx

... ... @@ -31,12 +31,16 @@ class ReplaceHtmlController extends BaseController
'type'=>'required',
'is_list'=>'required',
'is_custom'=>'required',
'project_id'=>'required',
'template_id'=>'required',
],[
'old_html.required' => '需替换的html不能为空',
'html.required' => 'html不能为空',
'type.required' => '类型type不能为空',
'is_custom.required' => '类型is_custom不能为空',
'is_list.required' => '类型is_list不能为空',
'project_id.required' => 'project_id不能为空',
'template_id.required' => '模版id不能为空',
]);
$logic->replaceHtml();
$this->response('success');
... ...
... ... @@ -26,6 +26,39 @@ class ReplaceHtmlLogic extends BaseLogic
}
/**
* @remark :定制页面头部类型---根据source获取type类型
* @name :getType
* @author :lyh
* @method :post
* @time :2023/11/16 11:20
*/
public function getCustomizedType($source,$is_list){
$type = BTemplate::TYPE_HOME;
if($source == BTemplate::SOURCE_PRODUCT){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_PRODUCT_LIST;
}else{
$type = BTemplate::TYPE_PRODUCT_DETAIL;
}
}
if($source == BTemplate::SOURCE_BLOG){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_BLOG_LIST;
}else{
$type = BTemplate::TYPE_BLOG_DETAIL;
}
}
if($source == BTemplate::SOURCE_NEWS){
if($is_list == BTemplate::IS_LIST){
$type = BTemplate::TYPE_NEWS_LIST;
}else{
$type = BTemplate::TYPE_NEWS_DETAIL;
}
}
return $type;
}
/**
* @remark :替换可视化的html代码(按类型)
* @name :replaceHtml
* @author :lyh
... ... @@ -34,15 +67,9 @@ class ReplaceHtmlLogic extends BaseLogic
*/
public function replaceHtml(){
ProjectServer::useProject($this->param['project_id']);
$type = $this->getCustomizedType($this->param['type'], $this->param['is_list']);//获取定制界面类型
//查看当前页面是否定制,是否开启可视化
$page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
if (in_array($type, $page_array)) {//当前页面是定制界面
$this->param['template_id'] = 0;
}
$replaceId = $this->saveReplaceHtml($this->param);
//TODO::生成一条任务记录
//查询当前所有装修的
$replaceId = $this->saveReplaceHtml($this->param);
//查询当前类型所有装修的记录
$condition = ['source'=>$this->param['type'],'is_custom'=>$this->param['is_custom'],'is_list'=>$this->param['is_list'],
'template_id'=>$this->param['template_id']];
$list = $this->model->list($condition);
... ...