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