作者 lyh

gx

... ... @@ -60,6 +60,8 @@ class BTemplateLogLogic extends BaseLogic
$commonData = $this->setCommonParam($info);
$commonTemplateModel = new BTemplateCommon();
$commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]);
//更新所有界面的other
$commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]);
}catch (\Exception $e){
$this->fail('系统错误,请联系管理员');
}
... ... @@ -93,7 +95,7 @@ class BTemplateLogLogic extends BaseLogic
'head_html'=>$info['head_html'],
'head_css'=>$info['head_css'],
'footer_html'=>$info['footer_html'],
'footer_css'=>$info['footer_css'],
'footer_css'=>$info['footer_css']
];
return $this->success($data);
}
... ... @@ -110,12 +112,24 @@ class BTemplateLogLogic extends BaseLogic
if($info === false){
$this->fail('当前数据不存在,或已被删除');
}
if(empty($info['other'])){
$commonTemplateModel = new BTemplateCommon();
$commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
$info['other'] = $commonInfo['other'];
}
$html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
$info['head_html'].$info['main_html'].$info['footer_html'];
$serviceSettingModel = new ServiceSettingModel();
$list = $serviceSettingModel->list(['type'=>2],'created_at');
$data = [
'info' => $info,
'header_footer'=>$list,
];
return $this->success($data);
//拼接html
foreach ($list as $v){
if($v['key'] == 'head'){
$html = $v['values'].$html;
}
if($v['key'] == 'footer'){
$html = $html.$v['values'];
}
}
return $this->success(['html'=>$html]);
}
}
... ...
... ... @@ -335,6 +335,7 @@ class BTemplateLogic extends BaseLogic
'main_css'=>$param['main_css'],
'footer_html'=>$param['footer_html'],
'footer_css'=>$param['footer_css'],
'other'=> str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"))
];
$bTemplateLogModel = new BTemplateLog();
return $bTemplateLogModel->add($data);
... ...