作者 lyh

gx

1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :UpdateHtml.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2024/2/2 10:11  
8 - */  
9 -  
10 -namespace App\Http\Controllers\Html;  
11 -  
12 -use App\Http\Controllers\Controller;  
13 -use App\Models\Com\NoticeLog;  
14 -use App\Models\CustomModule\CustomModule;  
15 -use App\Models\Project\Project;  
16 -use App\Models\RouteMap\RouteMap;  
17 -use App\Models\Service\Service as ServiceSettingModel;  
18 -use App\Models\Template\BTemplate;  
19 -use App\Services\ProjectServer;  
20 -use Illuminate\Support\Facades\DB;  
21 -  
22 -class UpdateHtml extends Controller  
23 -{  
24 - protected $param;  
25 - protected $project_id;  
26 - public function __construct($data){  
27 - $this->param = $data;//Todo::传递的参数  
28 - $this->project_id = $data['project_id'];  
29 - }  
30 -  
31 - /**  
32 - * @remark :更新界面  
33 - * @name :updateHtml  
34 - * @author :lyh  
35 - * @method :post  
36 - * @time :2024/2/2 10:12  
37 - */  
38 - public function updateHtml(){  
39 - ProjectServer::useProject($this->project_id);  
40 - if(isset($this->param['route']) && $this->param['route'] == 'all'){  
41 - //TODO::更新所有界面  
42 - }else{  
43 - //TODO::更新单页  
44 - $routeMapModel = new RouteMap();  
45 - }  
46 - DB::disconnect('custom_mysql');  
47 - }  
48 -  
49 - /**  
50 - * @remark :获取页面是否为 定制/非定制 页面  
51 - * @name :getPageHtmlIsCustomized  
52 - * @param :source:类型;is_list:是否为列表页 1:列表页面  
53 - * @author :lyh  
54 - * @method :post  
55 - * @time :2024/2/2 11:03  
56 - */  
57 - public function getPageHtmlIsCustomized($source,$is_list,$is_custom){  
58 - if($is_custom == BTemplate::IS_CUSTOM){  
59 - $customModuleModel = new CustomModule();  
60 - $info = $customModuleModel->read(['id'=>$source]);  
61 - if($info === false){  
62 - $this->fail('当前扩展模块不存在或已被删除');  
63 - }  
64 - //扩展模块定制  
65 - if($is_list == BTemplate::IS_LIST && $info['list_customized'] == BTemplate::IS_VISUALIZATION){  
66 - return BTemplate::IS_VISUALIZATION;  
67 - }  
68 - if($is_list == BTemplate::IS_DETAIL && $info['detail_customized'] == BTemplate::IS_VISUALIZATION){  
69 - return BTemplate::IS_VISUALIZATION;  
70 - }  
71 - }else{  
72 - $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型  
73 - //查看当前页面是否定制,是否开启可视化  
74 - $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面  
75 - if (in_array($type, $page_array)) {//是定制界面  
76 - return BTemplate::IS_VISUALIZATION;  
77 - }  
78 - }  
79 - return BTemplate::IS_NO_VISUALIZATION;  
80 - }  
81 -  
82 - /**  
83 - * @remark :获取头部底部公共部分代码  
84 - * @name :getTemplateCommon  
85 - * @author :lyh  
86 - * @method :post  
87 - * @time :2024/2/2 11:02  
88 - */  
89 - public function getTemplateCommon(){  
90 -  
91 - }  
92 -  
93 - /**  
94 - * @remark :获取装修中间内容  
95 - * @name :getTemplateMainHtml  
96 - * @author :lyh  
97 - * @method :post  
98 - * @time :2024/2/2 11:01  
99 - */  
100 - public function getTemplateMainHtml(){  
101 -  
102 - }  
103 -  
104 - /**  
105 - * @remark :获取项目详情  
106 - * @name :getProjectInfo  
107 - * @author :lyh  
108 - * @method :post  
109 - * @time :2024/2/2 10:50  
110 - */  
111 - public function getProjectInfo($project_id){  
112 - $projectModel = new Project();  
113 - $info = $projectModel->read(['id'=>$project_id],['id','is_customized']);  
114 - return $info;  
115 - }  
116 -  
117 - /**  
118 - * @remark :拼接获取公共头部底部  
119 - * @name :getHeadFooter  
120 - * @author :lyh  
121 - * @method :post  
122 - * @time :2023/7/21 17:22  
123 - */  
124 - public function getHeadFooter($html){  
125 - //获取公共主题头部底部  
126 - $serviceSettingModel = new ServiceSettingModel();  
127 - $list = $serviceSettingModel->list(['type'=>2],'created_at');  
128 - //拼接html  
129 - foreach ($list as $v){  
130 - if($v['key'] == 'head'){  
131 - $html = $v['values'].$html;  
132 - }  
133 - if($v['key'] == 'footer'){  
134 - $html = $html.$v['values'];  
135 - }  
136 - }  
137 - return $html;  
138 - }  
139 -  
140 - /**  
141 - * @remark :定制页面头部类型---根据source获取type类型  
142 - * @name :getType  
143 - * @author :lyh  
144 - * @method :post  
145 - * @time :2023/11/16 11:20  
146 - */  
147 - public function getCustomizedType($source,$is_list){  
148 - $type = BTemplate::TYPE_HOME;  
149 - if($source == BTemplate::SOURCE_PRODUCT){  
150 - if($is_list == BTemplate::IS_LIST){  
151 - $type = BTemplate::TYPE_PRODUCT_LIST;  
152 - }else{  
153 - $type = BTemplate::TYPE_PRODUCT_DETAIL;  
154 - }  
155 - }  
156 - if($source == BTemplate::SOURCE_BLOG){  
157 - if($is_list == BTemplate::IS_LIST){  
158 - $type = BTemplate::TYPE_BLOG_LIST;  
159 - }else{  
160 - $type = BTemplate::TYPE_BLOG_DETAIL;  
161 - }  
162 - }  
163 - if($source == BTemplate::SOURCE_NEWS){  
164 - if($is_list == BTemplate::IS_LIST){  
165 - $type = BTemplate::TYPE_NEWS_LIST;  
166 - }else{  
167 - $type = BTemplate::TYPE_NEWS_DETAIL;  
168 - }  
169 - }  
170 - return $type;  
171 - }  
172 -}