正在显示
2 个修改的文件
包含
0 行增加
和
59 行删除
| @@ -4,10 +4,8 @@ namespace App\Http\Logic\Aside\Template; | @@ -4,10 +4,8 @@ namespace App\Http\Logic\Aside\Template; | ||
| 4 | 4 | ||
| 5 | use App\Http\Logic\Aside\BaseLogic; | 5 | use App\Http\Logic\Aside\BaseLogic; |
| 6 | use App\Models\Service\Service as ServiceSettingModel; | 6 | use App\Models\Service\Service as ServiceSettingModel; |
| 7 | -use App\Models\Template\BCommonTemplate; | ||
| 8 | use App\Models\Template\Template; | 7 | use App\Models\Template\Template; |
| 9 | use App\Models\Template\Setting; | 8 | use App\Models\Template\Setting; |
| 10 | -use App\Services\ProjectServer; | ||
| 11 | use Illuminate\Support\Facades\DB; | 9 | use Illuminate\Support\Facades\DB; |
| 12 | 10 | ||
| 13 | class ATemplateLogic extends BaseLogic | 11 | class ATemplateLogic extends BaseLogic |
| @@ -185,49 +183,6 @@ class ATemplateLogic extends BaseLogic | @@ -185,49 +183,6 @@ class ATemplateLogic extends BaseLogic | ||
| 185 | if($rs === false){ | 183 | if($rs === false){ |
| 186 | $this->fail('error'); | 184 | $this->fail('error'); |
| 187 | } | 185 | } |
| 188 | - $html = Template::where('id', $this->param['template_id'])->value('html'); | ||
| 189 | - | ||
| 190 | - $this->splitTemplate($html); | ||
| 191 | - | ||
| 192 | return $this->success(); | 186 | return $this->success(); |
| 193 | } | 187 | } |
| 194 | - | ||
| 195 | - /** | ||
| 196 | - * 保存拆分模板 | ||
| 197 | - * @author zbj | ||
| 198 | - * @date 2023/10/11 | ||
| 199 | - */ | ||
| 200 | - public function splitTemplate($html){ | ||
| 201 | - $data['main_html'] = characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'); | ||
| 202 | - $data['main_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); | ||
| 203 | - | ||
| 204 | - $common['head_html'] = characterTruncation($html,'/<header\b[^>]*>(.*?)<\/header>/s'); | ||
| 205 | - $common['footer_html'] = characterTruncation($html,'/<footer\b[^>]*>(.*?)<\/footer>/s'); | ||
| 206 | - $common['head_style'] = characterTruncation($html,'/<style id="globalsojs-header">(.*?)<\/style>/s'); | ||
| 207 | - $common['footer_style'] = characterTruncation($html,'/<style id="globalsojs-footer">(.*?)<\/style>/s'); | ||
| 208 | - $common['other_html'] = str_replace('<header', '', characterTruncation($html,'/<link id="google-fonts-link"(.*?)<header/s')); | ||
| 209 | - | ||
| 210 | - //保存公共部门 | ||
| 211 | - ProjectServer::useProject($this->param['project_id']); | ||
| 212 | - $common_info = DB::connection('custom_mysql')->table('gl_web_common_template') | ||
| 213 | - ->where('project_id', $this->param['project_id']) | ||
| 214 | - ->where('template_id', $this->param['template_id']) | ||
| 215 | - ->first(); | ||
| 216 | - | ||
| 217 | - $common['updated_at'] = date('Y-m-d H:i:s'); | ||
| 218 | - if(!$common){ | ||
| 219 | - $common['project_id'] = $this->param['project_id']; | ||
| 220 | - $common['template_id'] = $this->param['template_id']; | ||
| 221 | - $common['created_at'] = date('Y-m-d H:i:s'); | ||
| 222 | - DB::connection('custom_mysql')->table('gl_web_common_template')->insert($common); | ||
| 223 | - }else{ | ||
| 224 | - DB::connection('custom_mysql')->table('gl_web_common_template') | ||
| 225 | - ->where('project_id', $this->param['project_id']) | ||
| 226 | - ->where('template_id', $this->param['template_id']) | ||
| 227 | - ->update($common); | ||
| 228 | - } | ||
| 229 | - | ||
| 230 | - //返回main | ||
| 231 | - return $data; | ||
| 232 | - } | ||
| 233 | } | 188 | } |
-
请 注册 或 登录 后发表评论