|
...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
|
namespace App\Http\Logic\Bside\BTemplate;
|
|
|
|
|
|
|
|
use App\Http\Logic\Bside\BaseLogic;
|
|
|
|
use App\Models\Service\Service as ServiceSettingModel;
|
|
|
|
use App\Models\Template\BCustomTemplate;
|
|
|
|
|
|
|
|
class CustomTemplateLogic extends BaseLogic
|
|
...
|
...
|
@@ -37,6 +38,7 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateInfo(){
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
$info['html'] = $this->getHeadFooter();
|
|
|
|
if($info === false){
|
|
|
|
$this->fail('error');
|
|
|
|
}
|
|
...
|
...
|
@@ -52,6 +54,9 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
*/
|
|
|
|
public function customTemplateSave(){
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
if(isset($this->param['html']) && !empty($this->param['html'])){
|
|
|
|
$this->param['html'] = $this->getHeadFooter(characterTruncation($this->param['html'],'/<style id="vvvebjs-header">(.*?)<\/footer>/s'));
|
|
|
|
}
|
|
|
|
$rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->param['project_id'] = $this->user['project_id'];
|
|
...
|
...
|
@@ -77,4 +82,27 @@ class CustomTemplateLogic extends BaseLogic |
|
|
|
}
|
|
|
|
return $this->success();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :拼接获取公共头部底部
|
|
|
|
* @name :getHeadFooter
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/21 17:22
|
|
|
|
*/
|
|
|
|
public function getHeadFooter($html = ''){
|
|
|
|
//获取公共主题头部底部
|
|
|
|
$serviceSettingModel = new ServiceSettingModel();
|
|
|
|
$list = $serviceSettingModel->list(['type'=>2],'created_at');
|
|
|
|
//拼接html
|
|
|
|
foreach ($list as $v){
|
|
|
|
if($v['key'] == 'head'){
|
|
|
|
$html = $v['values'].$html;
|
|
|
|
}
|
|
|
|
if($v['key'] == 'footer'){
|
|
|
|
$html = $html.$v['values'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|