作者 lyh

修复可视化bug

... ... @@ -531,7 +531,7 @@ class ImageController extends Controller
'is_image.required'=>'请设置文本水印还是图片水印',
]);
$cos = new CosService();
$url = $cos->setWatermark($this->param['url'], $this->param['data'],true);
$url = $cos->setWatermark($this->param['url'], $this->param['data'],$this->param['is_image']);
$this->response('success',Code::SUCCESS,['url'=>$url]);
}
... ...
... ... @@ -51,33 +51,50 @@ class CustomTemplateLogic extends BaseLogic
$this->fail('当前数据不存在');
}
if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
$html = $this->getTemplateComHtml($info['html'],$info['html_style']);
$template_id = $this->getTemplateId();
$html = $this->getTemplateComHtml($info['html'],$info['html_style'],$template_id);
$info['html'] = $this->getHeadFooter($html);
}
return $this->success($info);
}
/**
* @remark :获取模版id
* @name :getTemplateId
* @author :lyh
* @method :post
* @time :2023/12/27 10:51
*/
public function getTemplateId(){
$bSettingModel = new Setting();
$bSettingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']],['id','template_id']);
if($bSettingInfo === false){
$this->fail('请先设置模板');
}
return $this->success($bSettingInfo['template_id']);
}
/**
* @remark :非定制获取头部+底部
* @name :getTemplateComHtml
* @author :lyh
* @method :post
* @time :2024/4/29 16:53
*/
public function getTemplateComHtml($html,$html_style){
public function getTemplateComHtml($html,$html_style,$template_id){
if(empty($html)){
$html = "<main></main>";
$html_style = "<style id='globalsojs-styles'></style>";
}
$headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD]);
$headComInfo = $this->getHeadComHtml(['common_type'=>BTemplate::COMMON_HEAD,'template_id'=>$template_id]);
$bTemplateComModel = new BTemplateCom();
$condition['common_type'] = BTemplate::COMMON_OTHER;
$condition['source'] = $headComInfo['source'];
$condition['template_id'] = $template_id;
$otherInfo = $bTemplateComModel->read($condition);
if($otherInfo === false){
$this->fail('获取失败,请联系管理员');
}
$footerComInfo = $this->getFooterComHtml();
$footerComInfo = $this->getFooterComHtml($template_id);
$commonInfo = ['head_html'=>$headComInfo['html'] ?? '', 'head_style'=>$headComInfo['html_style'] ?? '', 'other'=>$otherInfo['html'] ?? '',
'footer_html'=>$footerComInfo['html'] ?? '','footer_style'=>$footerComInfo['html_style'] ?? ''];
$html = $commonInfo['head_style'].$html_style.$commonInfo['footer_style'].$commonInfo['other']. $commonInfo['head_html'].$html.$commonInfo['footer_html'];
... ... @@ -98,6 +115,7 @@ class CustomTemplateLogic extends BaseLogic
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
//取默认公共的
$template_id = $this->getTemplateId();
$condition['source'] = BTemplate::SOURCE_COM;
$headComInfo = $bTemplateComModel->read($condition);
if($headComInfo === false){
... ... @@ -113,12 +131,14 @@ class CustomTemplateLogic extends BaseLogic
* @method :post
* @time :2024/4/29 17:18
*/
public function getFooterComHtml(){
public function getFooterComHtml($template_id){
$bTemplateComModel = new BTemplateCom();
$condition['template_id'] = $template_id;
$condition['common_type'] = BTemplate::COMMON_FOOTER;
$condition['source'] = $this->getType(BTemplate::COMMON_FOOTER);
$footerComInfo = $bTemplateComModel->read($condition);
if($footerComInfo === false){
$template_id = $this->getTemplateId();
//取默认首页的
$condition['source'] = BTemplate::SOURCE_COM;
$footerComInfo = $bTemplateComModel->read($condition);
... ...