作者 lyh

gx

@@ -60,6 +60,8 @@ class BTemplateLogLogic extends BaseLogic @@ -60,6 +60,8 @@ class BTemplateLogLogic extends BaseLogic
60 $commonData = $this->setCommonParam($info); 60 $commonData = $this->setCommonParam($info);
61 $commonTemplateModel = new BTemplateCommon(); 61 $commonTemplateModel = new BTemplateCommon();
62 $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]); 62 $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]);
  63 + //更新所有界面的other
  64 + $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]);
63 }catch (\Exception $e){ 65 }catch (\Exception $e){
64 $this->fail('系统错误,请联系管理员'); 66 $this->fail('系统错误,请联系管理员');
65 } 67 }
@@ -93,7 +95,7 @@ class BTemplateLogLogic extends BaseLogic @@ -93,7 +95,7 @@ class BTemplateLogLogic extends BaseLogic
93 'head_html'=>$info['head_html'], 95 'head_html'=>$info['head_html'],
94 'head_css'=>$info['head_css'], 96 'head_css'=>$info['head_css'],
95 'footer_html'=>$info['footer_html'], 97 'footer_html'=>$info['footer_html'],
96 - 'footer_css'=>$info['footer_css'], 98 + 'footer_css'=>$info['footer_css']
97 ]; 99 ];
98 return $this->success($data); 100 return $this->success($data);
99 } 101 }
@@ -110,12 +112,24 @@ class BTemplateLogLogic extends BaseLogic @@ -110,12 +112,24 @@ class BTemplateLogLogic extends BaseLogic
110 if($info === false){ 112 if($info === false){
111 $this->fail('当前数据不存在,或已被删除'); 113 $this->fail('当前数据不存在,或已被删除');
112 } 114 }
  115 + if(empty($info['other'])){
  116 + $commonTemplateModel = new BTemplateCommon();
  117 + $commonInfo = $commonTemplateModel->read(['template_id'=>$info['template_id'],'project_id'=>$this->user['project_id'],'type'=>1]);
  118 + $info['other'] = $commonInfo['other'];
  119 + }
  120 + $html = $info['head_css'].$info['main_css'].$info['footer_css'].$info['other'].
  121 + $info['head_html'].$info['main_html'].$info['footer_html'];
113 $serviceSettingModel = new ServiceSettingModel(); 122 $serviceSettingModel = new ServiceSettingModel();
114 $list = $serviceSettingModel->list(['type'=>2],'created_at'); 123 $list = $serviceSettingModel->list(['type'=>2],'created_at');
115 - $data = [  
116 - 'info' => $info,  
117 - 'header_footer'=>$list,  
118 - ];  
119 - return $this->success($data); 124 + //拼接html
  125 + foreach ($list as $v){
  126 + if($v['key'] == 'head'){
  127 + $html = $v['values'].$html;
  128 + }
  129 + if($v['key'] == 'footer'){
  130 + $html = $html.$v['values'];
  131 + }
  132 + }
  133 + return $this->success(['html'=>$html]);
120 } 134 }
121 } 135 }
@@ -335,6 +335,7 @@ class BTemplateLogic extends BaseLogic @@ -335,6 +335,7 @@ class BTemplateLogic extends BaseLogic
335 'main_css'=>$param['main_css'], 335 'main_css'=>$param['main_css'],
336 'footer_html'=>$param['footer_html'], 336 'footer_html'=>$param['footer_html'],
337 'footer_css'=>$param['footer_css'], 337 'footer_css'=>$param['footer_css'],
  338 + 'other'=> str_replace('<header','',characterTruncation($param['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s"))
338 ]; 339 ];
339 $bTemplateLogModel = new BTemplateLog(); 340 $bTemplateLogModel = new BTemplateLog();
340 return $bTemplateLogModel->add($data); 341 return $bTemplateLogModel->add($data);