正在显示
1 个修改的文件
包含
14 行增加
和
24 行删除
| @@ -6,7 +6,6 @@ use App\Http\Logic\Aside\BaseLogic; | @@ -6,7 +6,6 @@ use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | use App\Models\RouteMap\RouteMap; | 6 | use App\Models\RouteMap\RouteMap; |
| 7 | use App\Models\Service\Service as ServiceSettingModel; | 7 | use App\Models\Service\Service as ServiceSettingModel; |
| 8 | use App\Models\Template\BTemplate; | 8 | use App\Models\Template\BTemplate; |
| 9 | -use App\Models\Template\BTemplateCom; | ||
| 10 | use App\Models\Template\BTemplateCommon; | 9 | use App\Models\Template\BTemplateCommon; |
| 11 | use App\Models\Template\Template; | 10 | use App\Models\Template\Template; |
| 12 | use App\Models\Template\Setting; | 11 | use App\Models\Template\Setting; |
| @@ -204,34 +203,25 @@ class ATemplateLogic extends BaseLogic | @@ -204,34 +203,25 @@ class ATemplateLogic extends BaseLogic | ||
| 204 | $templateInfo = $this->model->read(['id'=>$template_id]); | 203 | $templateInfo = $this->model->read(['id'=>$template_id]); |
| 205 | ProjectServer::useProject($project_id); | 204 | ProjectServer::useProject($project_id); |
| 206 | $bTemplateModel = new BTemplate(); | 205 | $bTemplateModel = new BTemplate(); |
| 207 | - $info = $bTemplateModel->read(['source'=>BTemplate::SOURCE_HOME,'template_id'=>$template_id]); | 206 | + $info = $bTemplateModel->read(['source'=>1,'template_id'=>$template_id]); |
| 208 | if($info === false){ | 207 | if($info === false){ |
| 209 | $data = [ | 208 | $data = [ |
| 210 | - 'source'=>BTemplate::SOURCE_HOME, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'], | ||
| 211 | - 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id | 209 | + 'source'=>1, 'source_id'=>0, 'template_id'=>$template_id, 'main_html'=>$templateInfo['main_html'], |
| 210 | + 'main_css'=>$templateInfo['main_css'], 'project_id'=>$project_id, | ||
| 212 | ]; | 211 | ]; |
| 213 | $bTemplateModel->add($data); | 212 | $bTemplateModel->add($data); |
| 214 | } | 213 | } |
| 215 | - //保存一次公共头部+底部+other信息 | ||
| 216 | - $bComTemplateModel = new BTemplateCom(); | ||
| 217 | - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_HEAD,'source'=>BTemplate::SOURCE_COM]; | ||
| 218 | - $headInfo = $bComTemplateModel->read($condition); | ||
| 219 | - if($headInfo === false){ | ||
| 220 | - $headData = ['html'=>$templateInfo['head_html'], 'html_style'=>$templateInfo['head_css'], 'project_id'=>$project_id]; | ||
| 221 | - $bComTemplateModel->add(array_merge($condition,$headData)); | ||
| 222 | - } | ||
| 223 | - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_FOOTER,'source'=>BTemplate::SOURCE_COM]; | ||
| 224 | - $footerInfo = $bComTemplateModel->read($condition); | ||
| 225 | - if($footerInfo === false){ | ||
| 226 | - $footerData = ['html'=>$templateInfo['footer_html'], 'html_style'=>$templateInfo['footer_css'], 'project_id'=>$project_id]; | ||
| 227 | - $bComTemplateModel->add(array_merge($condition,$footerData)); | ||
| 228 | - } | ||
| 229 | - $condition = ['template_id'=>$template_id,'common_type'=>BTemplate::COMMON_OTHER,'source'=>BTemplate::SOURCE_COM]; | ||
| 230 | - $footerInfo = $bComTemplateModel->read($condition); | ||
| 231 | - if($footerInfo === false){ | ||
| 232 | - $other = str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")); | ||
| 233 | - $otherData = ['html'=>$other, 'html_style'=>'', 'project_id'=>$project_id]; | ||
| 234 | - $bComTemplateModel->add(array_merge($condition,$otherData)); | 214 | + //保存一次公共头部信息 |
| 215 | + $bCommonTemplateModel = new BTemplateCommon(); | ||
| 216 | + $commonInfo = $bCommonTemplateModel->read(['template_id'=>$template_id,'type'=>1]); | ||
| 217 | + if($commonInfo === false){ | ||
| 218 | + $commonData = [ | ||
| 219 | + 'type'=>1, 'template_id'=>$template_id, 'head_html'=>$templateInfo['head_html'], | ||
| 220 | + 'head_css'=>$templateInfo['head_css'], 'footer_html'=>$templateInfo['footer_html'], | ||
| 221 | + 'footer_css'=>$templateInfo['footer_css'],'project_id'=>$project_id, | ||
| 222 | + 'other'=>str_replace('<header','',characterTruncation($templateInfo['html'],"/<link id=\"google-fonts-link\"(.*?)<header/s")) | ||
| 223 | + ]; | ||
| 224 | + $bCommonTemplateModel->add($commonData); | ||
| 235 | } | 225 | } |
| 236 | RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id); | 226 | RouteMap::setRoute('index', RouteMap::SOURCE_PAGE, 0, $project_id); |
| 237 | DB::disconnect('custom_mysql'); | 227 | DB::disconnect('custom_mysql'); |
-
请 注册 或 登录 后发表评论