|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Http\Logic\Bside\BTemplate;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Project\PageSetting;
|
|
|
|
use App\Models\RouteMap\RouteMap;
|
|
|
|
use App\Models\Service\Service as ServiceSettingModel;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
...
|
...
|
@@ -110,6 +111,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
* @time :2023/10/13 14:27
|
|
|
|
*/
|
|
|
|
public function saveCommonTemplate($html){
|
|
|
|
$type = $this->getType();
|
|
|
|
//获取设置的默认模版
|
|
|
|
$bSettingModel = new Setting();
|
|
|
|
$settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
|
|
...
|
...
|
@@ -118,7 +120,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
//查看当前
|
|
|
|
$templateCommonModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id']]);
|
|
|
|
$commonInfo = $templateCommonModel->read(['template_id'=>$settingInfo['template_id'],'project_id'=>$this->user['project_id'],'type'=>$type]);
|
|
|
|
if($commonInfo === false){
|
|
|
|
$this->fail('请先装修首页');
|
|
|
|
}
|
|
...
|
...
|
@@ -128,11 +130,33 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
'footer_html'=>characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'),
|
|
|
|
'footer_css'=>characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'),
|
|
|
|
'other'=>str_replace('<header','',characterTruncation($html,"/<link id=\"google-fonts-link\"(.*?)<header/s")),
|
|
|
|
'type'=>$type
|
|
|
|
];
|
|
|
|
$templateCommonModel->edit($data,['id'=>$commonInfo['id']]);
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :获取设置的类型
|
|
|
|
* @name :getType
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/10/21 17:29
|
|
|
|
*/
|
|
|
|
public function getType(){
|
|
|
|
$type = 1;//首页公共头部底部
|
|
|
|
//查看页面是否设置自定义头部底部
|
|
|
|
if(isset($this->user['configuration']['is_head']) && ($this->user['configuration']['is_head'] != 0)) {
|
|
|
|
$pageSettingModel = new PageSetting();
|
|
|
|
$pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
|
|
|
|
if ($pageInfo !== false) {
|
|
|
|
if ($pageInfo['page_list'] != 0) {
|
|
|
|
$type = 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $type;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :查看路由是否更新
|
|
...
|
...
|
@@ -224,7 +248,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
if($info === false){
|
|
|
|
$this->fail('请先设置模版');
|
|
|
|
}
|
|
|
|
|
|
|
|
//获取type类型
|
|
|
|
$commonTemplateModel = new BTemplateCommon();
|
|
|
|
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
|
|
|
|
$html = '';
|
...
|
...
|
|