作者 zhl

Merge remote-tracking branch 'origin/master' into zhl

正在显示 53 个修改的文件 包含 494 行增加798 行删除
@@ -164,24 +164,6 @@ class Count extends Command @@ -164,24 +164,6 @@ class Count extends Command
164 } 164 }
165 165
166 /** 166 /**
167 - * @param $yesterday  
168 - * @name :(服务达标天数)compliance_day  
169 - * @author :lyh  
170 - * @method :post  
171 - * @time :2023/6/14 15:48  
172 - */  
173 - public function compliance_day($project_id){  
174 - //服务达标天数  
175 - $rank_info = DB::table('gl_rank_data')->where(['project_id'=>$project_id,'lang'=>''])->select(['compliance_day'])->first();  
176 - if(empty($rank_info)){  
177 - $compliance_day = 0;  
178 - }else{  
179 - $compliance_day = $rank_info->compliance_day;  
180 - }  
181 - return $compliance_day;  
182 - }  
183 -  
184 - /**  
185 * @name :(查询参数设置)selectParam 167 * @name :(查询参数设置)selectParam
186 * @author :lyh 168 * @author :lyh
187 * @method :post 169 * @method :post
@@ -67,7 +67,6 @@ class InitProject extends Command @@ -67,7 +67,6 @@ class InitProject extends Command
67 if(!empty($project['serve_id'])){ 67 if(!empty($project['serve_id'])){
68 $project_logic->updateServe($project['serve_id']); 68 $project_logic->updateServe($project['serve_id']);
69 } 69 }
70 -  
71 $item->status = NoticeLog::STATUS_SUCCESS; 70 $item->status = NoticeLog::STATUS_SUCCESS;
72 $item->save(); 71 $item->save();
73 echo 'success:' . $item['id'] . PHP_EOL; 72 echo 'success:' . $item['id'] . PHP_EOL;
@@ -38,7 +38,7 @@ abstract class BaseCommands extends Command @@ -38,7 +38,7 @@ abstract class BaseCommands extends Command
38 if($error){ 38 if($error){
39 echo 'error'; 39 echo 'error';
40 } 40 }
41 - $error && sleep(60); 41 + $error && sleep(10);
42 }while($error); 42 }while($error);
43 } 43 }
44 44
@@ -47,7 +47,7 @@ class ExternalLinks extends BaseCommands @@ -47,7 +47,7 @@ class ExternalLinks extends BaseCommands
47 continue; 47 continue;
48 } 48 }
49 $model = ExternalLinksModel::where('project_id', $project_id)->first(); 49 $model = ExternalLinksModel::where('project_id', $project_id)->first();
50 - if ($model && $model->updated_date == getThisWeekStarDate()) { 50 + if ($model && $model->updated_date >= getThisWeekStarDate()) {
51 continue; 51 continue;
52 } 52 }
53 if (!$model) { 53 if (!$model) {
@@ -42,7 +42,7 @@ class IndexedPages extends BaseCommands @@ -42,7 +42,7 @@ class IndexedPages extends BaseCommands
42 LogUtils::info('start rank_data_indexed_pages:' . count($list)); 42 LogUtils::info('start rank_data_indexed_pages:' . count($list));
43 foreach ($list as $project_id => $api_no) { 43 foreach ($list as $project_id => $api_no) {
44 $model = IndexedPagesModel::where('project_id', $project_id)->first(); 44 $model = IndexedPagesModel::where('project_id', $project_id)->first();
45 - if($model && $model->updated_date == getThisWeekStarDate()){ 45 + if($model && $model->updated_date >= getThisWeekStarDate()){
46 continue; 46 continue;
47 } 47 }
48 48
@@ -59,7 +59,7 @@ class RankDataTask extends Command @@ -59,7 +59,7 @@ class RankDataTask extends Command
59 $api = new QuanqiusouApi(); 59 $api = new QuanqiusouApi();
60 $site_res = $api->getSiteRes(); 60 $site_res = $api->getSiteRes();
61 61
62 - (new RankDataLogic())->syncRankData($item['data']['api_no'], $site_res); 62 + (new RankDataLogic())->syncRankData($item['data']['api_no'], $site_res, true);
63 63
64 $item->status = NoticeLog::STATUS_SUCCESS; 64 $item->status = NoticeLog::STATUS_SUCCESS;
65 $item->save(); 65 $item->save();
@@ -53,7 +53,7 @@ class RankWeek extends BaseCommands @@ -53,7 +53,7 @@ class RankWeek extends BaseCommands
53 LogUtils::info('start rank_data_week:' . count($list)); 53 LogUtils::info('start rank_data_week:' . count($list));
54 foreach ($list as $project_id => $api_no) { 54 foreach ($list as $project_id => $api_no) {
55 $rank_week = RankWeekModel::where('project_id', $project_id)->first(); 55 $rank_week = RankWeekModel::where('project_id', $project_id)->first();
56 - if ($rank_week && $rank_week->updated_date == getThisWeekStarDate()) { 56 + if ($rank_week && $rank_week->updated_date >= getThisWeekStarDate()) {
57 //本周数据已更新 57 //本周数据已更新
58 continue; 58 continue;
59 } 59 }
@@ -46,7 +46,7 @@ class RecommDomain extends BaseCommands @@ -46,7 +46,7 @@ class RecommDomain extends BaseCommands
46 continue; 46 continue;
47 } 47 }
48 $model = RecommDomainModel::where('project_id', $project_id)->first(); 48 $model = RecommDomainModel::where('project_id', $project_id)->first();
49 - if ($model && $model->updated_date == getThisWeekStarDate()) { 49 + if ($model && $model->updated_date >= getThisWeekStarDate()) {
50 continue; 50 continue;
51 } 51 }
52 if (!$model) { 52 if (!$model) {
@@ -47,7 +47,7 @@ class Speed extends BaseCommands @@ -47,7 +47,7 @@ class Speed extends BaseCommands
47 LogUtils::info('start rank_data_speed:' . count($list)); 47 LogUtils::info('start rank_data_speed:' . count($list));
48 foreach ($list as $project_id => $domain) { 48 foreach ($list as $project_id => $domain) {
49 $model = GoogleSpeedModel::where('project_id', $project_id)->first(); 49 $model = GoogleSpeedModel::where('project_id', $project_id)->first();
50 - if ($model && $model->updated_date == getThisWeekStarDate()) { 50 + if ($model && $model->updated_date >= getThisWeekStarDate()) {
51 //今周已更新 跳过 51 //今周已更新 跳过
52 continue; 52 continue;
53 } 53 }
@@ -83,7 +83,7 @@ class HtmlCollect extends Command @@ -83,7 +83,7 @@ class HtmlCollect extends Command
83 //采集html页面,下载资源到本地并替换 83 //采集html页面,下载资源到本地并替换
84 try { 84 try {
85 $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false); 85 $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);
86 - if ($html == '0' || strpos($html,'404 Not Found') !== false) { 86 + if ($html == '0' || strpos($html, '404 Not Found') !== false) {
87 $collect_info->status = CollectTask::STATUS_FAIL; 87 $collect_info->status = CollectTask::STATUS_FAIL;
88 $collect_info->save(); 88 $collect_info->save();
89 89
@@ -138,7 +138,7 @@ class HtmlCollect extends Command @@ -138,7 +138,7 @@ class HtmlCollect extends Command
138 } 138 }
139 139
140 140
141 - $update_log = UpdateLog::whereNotIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first(); 141 + $update_log = UpdateLog::where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->orderBy('project_id', 'asc')->first();
142 if (!$update_log) { 142 if (!$update_log) {
143 return false; 143 return false;
144 } 144 }
@@ -286,7 +286,7 @@ class HtmlCollect extends Command @@ -286,7 +286,7 @@ class HtmlCollect extends Command
286 return [ 286 return [
287 'download' => true, 287 'download' => true,
288 'url' => $url, 288 'url' => $url,
289 - 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '') 289 + 'url_complete' => ($scheme ?: 'https') . '://' . $domain . $path . ($query ? '?' . $query : '')
290 ]; 290 ];
291 } else { 291 } else {
292 return [ 292 return [
@@ -302,7 +302,7 @@ class HtmlLanguageCollect extends Command @@ -302,7 +302,7 @@ class HtmlLanguageCollect extends Command
302 return [ 302 return [
303 'download' => true, 303 'download' => true,
304 'url' => $url, 304 'url' => $url,
305 - 'url_complete' => ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path . ($query ? '?' . $query : '') 305 + 'url_complete' => ($scheme ?: 'https') . '://' . $domain . $path . ($query ? '?' . $query : '')
306 ]; 306 ];
307 } else { 307 } else {
308 return [ 308 return [
1 -<?php  
2 -  
3 -namespace App\Console\Commands\Update;  
4 -  
5 -use App\Models\Collect\CollectSource;  
6 -use App\Models\Collect\CollectTask;  
7 -use App\Models\Com\UpdateLog;  
8 -use App\Models\Com\UpdateOldInfo;  
9 -use App\Models\RouteMap\RouteMap;  
10 -use App\Services\CosService;  
11 -use App\Services\ProjectServer;  
12 -use Illuminate\Console\Command;  
13 -use Illuminate\Support\Facades\Cache;  
14 -use Illuminate\Support\Facades\DB;  
15 -use Illuminate\Support\Facades\Redis;  
16 -  
17 -/**  
18 - * 4.0,5.0升级到6.0,小语种页面采集  
19 - * Class ProjectImport  
20 - * @package App\Console\Commands  
21 - * @author Akun  
22 - * @date 2023/11/20 14:04  
23 - */  
24 -class HtmlLanguageSpecialCollect extends Command  
25 -{  
26 - /**  
27 - * The name and signature of the console command.  
28 - *  
29 - * @var string  
30 - */  
31 - protected $signature = 'project_html_language_special_collect';  
32 -  
33 - /**  
34 - * The console command description.  
35 - *  
36 - * @var string  
37 - */  
38 - protected $description = '执行项目html页面采集';  
39 -  
40 -  
41 - public function handle()  
42 - {  
43 - ini_set('memory_limit', '512M');  
44 - while (true) {  
45 - $this->start_collect();  
46 - }  
47 - }  
48 -  
49 - protected function start_collect()  
50 - {  
51 - $task_id = $this->get_task();  
52 - if ($task_id === false) {  
53 - //所有项目采集完成  
54 - sleep(60);  
55 - return true;  
56 - } elseif ($task_id === 0) {  
57 - //当前项目采集完成  
58 - sleep(2);  
59 - return true;  
60 - }  
61 -  
62 - $task_arr = explode('_', $task_id);  
63 - $project_id = $task_arr[0];  
64 - $collect_id = $task_arr[1];  
65 -  
66 - //设置数据库  
67 - $project = ProjectServer::useProject($project_id);  
68 - if ($project) {  
69 - $collect_info = CollectTask::select(['id', 'domain', 'route', 'language'])->where('id', $collect_id)->where('status', CollectTask::STATUS_UN)->where('language', '=', '')->first();  
70 -  
71 - if (!$collect_info) {  
72 - sleep(2);  
73 - return true;  
74 - }  
75 -  
76 - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', collect start' . PHP_EOL;  
77 -  
78 - $collect_info->status = CollectTask::STATUS_ING;  
79 - $collect_info->save();  
80 -  
81 - //获取站点正式和测试域名  
82 - $domain_en = $this->get_domain_en($project_id);  
83 - $old_info = UpdateOldInfo::getOldDomain($project_id, $domain_en);  
84 -  
85 - //采集html页面,下载资源到本地并替换  
86 - try {  
87 - $html = curl_c('https://' . $collect_info->domain . $collect_info->route, false);  
88 - if ($html == '0' || strpos($html,'404 Not Found') !== false) {  
89 - $collect_info->status = CollectTask::STATUS_FAIL;  
90 - $collect_info->save();  
91 -  
92 - $error = $html == '0' ? 'no html' : '404 not found';  
93 - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $error . PHP_EOL;  
94 - sleep(2);  
95 - return true;  
96 - }  
97 -  
98 - //如果有base64图片,先替换掉,再进行资源匹配  
99 - $new_html = $html;  
100 - preg_match_all("/data:([^;]*);base64,(.*)?\"/", $new_html, $result_img);  
101 - $img_base64 = $result_img[2] ?? [];  
102 - foreach ($img_base64 as $v64) {  
103 - $new_html = str_replace($v64, '', $new_html);  
104 - }  
105 -  
106 - $source_list = $this->html_preg($new_html, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);  
107 -  
108 - if ($source_list) {  
109 - $html = $this->upload_source($html, $source_list, $project_id, $domain_en, $old_info['web_url_domain'], $old_info['home_url']);  
110 - }  
111 - } catch (\Exception $e) {  
112 - $collect_info->status = CollectTask::STATUS_FAIL;  
113 - $collect_info->save();  
114 -  
115 - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', error: ' . $e->getMessage() . PHP_EOL;  
116 - sleep(2);  
117 - return true;  
118 - }  
119 -  
120 - $collect_info->html = $html;  
121 - $collect_info->status = CollectTask::STATUS_COM;  
122 - $collect_info->save();  
123 -  
124 - echo 'date:' . date('Y-m-d H:i:s') . ', project_id: ' . $project_id . ', collect_id: ' . $collect_id . ', collect end' . PHP_EOL;  
125 - }  
126 - //关闭数据库  
127 - DB::disconnect('custom_mysql');  
128 -  
129 - sleep(2);  
130 - return true;  
131 - }  
132 -  
133 - //获取任务  
134 - protected function get_task()  
135 - {  
136 - $key = 'console_html_language_special_collect_task';  
137 - $task_id = Redis::rpop($key);  
138 - if ($task_id) {  
139 - return $task_id;  
140 - }  
141 -  
142 -  
143 - $update_log = UpdateLog::whereIn('project_id', [555, 626])->where('status', UpdateLog::STATUS_COM)->where('collect_status', UpdateLog::COLLECT_STATUS_UN)->first();  
144 - if (!$update_log) {  
145 - return false;  
146 - }  
147 -  
148 - switch ($update_log->api_type) {  
149 - case 'page':  
150 - $source = RouteMap::SOURCE_PAGE;  
151 - break;  
152 - case 'news':  
153 - $source = RouteMap::SOURCE_NEWS;  
154 - break;  
155 - case 'blog':  
156 - $source = RouteMap::SOURCE_BLOG;  
157 - break;  
158 - default:  
159 - $source = RouteMap::SOURCE_PRODUCT;  
160 - break;  
161 - }  
162 -  
163 - $complete = false;  
164 - //设置数据库  
165 - $project = ProjectServer::useProject($update_log->project_id);  
166 - if ($project) {  
167 - $collect_list = CollectTask::select(['id', 'project_id'])->where('project_id', $update_log['project_id'])->where('source', $source)->where('language', '=', '')->where('status', CollectTask::STATUS_UN)->orderBy('id', 'asc')->limit(50)->get();  
168 -  
169 - if ($collect_list->count() == 0) {  
170 - $complete = true;  
171 - } else {  
172 - foreach ($collect_list as $collect) {  
173 - Redis::lpush($key, $collect['project_id'] . '_' . $collect['id']);  
174 - }  
175 - }  
176 - }  
177 - //关闭数据库  
178 - DB::disconnect('custom_mysql');  
179 -  
180 - if ($complete) {  
181 - $update_log->collect_status = UpdateLog::COLLECT_STATUS_COM;  
182 - $update_log->save();  
183 - return 0;  
184 - }  
185 -  
186 - $task_id = Redis::rpop($key);  
187 - return $task_id;  
188 - }  
189 -  
190 - //获取英文站域名  
191 - protected function get_domain_en($project_id)  
192 - {  
193 - $key = 'console_html_language_domain_en';  
194 - $domain = Cache::get($key);  
195 - if (!$domain) {  
196 - $domain = CollectTask::where('project_id', $project_id)->where('language', '')->value('domain');  
197 -  
198 - Cache::add($key, $domain, 3600);  
199 - }  
200 -  
201 - return $domain;  
202 - }  
203 -  
204 - //正则匹配html资源  
205 - protected function html_preg($html, $project_id, $domain, $web_url_domain, $home_url)  
206 - {  
207 - $source = [];  
208 -  
209 - if (!$html) {  
210 - return $source;  
211 - }  
212 -  
213 - //image  
214 - preg_match_all('/<img\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_img);  
215 - $img = $result_img[2] ?? [];  
216 - foreach ($img as $vi) {  
217 - $check_vi = $this->url_check($vi, $project_id, $domain, $web_url_domain, $home_url);  
218 - if ($check_vi && (!in_array($check_vi, $source))) {  
219 - $check_vi && $source[] = $check_vi;  
220 - }  
221 - }  
222 -  
223 - //js  
224 - preg_match_all('/<script\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_js);  
225 - $js = $result_js[2] ?? [];  
226 - foreach ($js as $vj) {  
227 - $check_vj = $this->url_check($vj, $project_id, $domain, $web_url_domain, $home_url);  
228 - if ($check_vj && (!in_array($check_vj, $source))) {  
229 - $check_vj && $source[] = $check_vj;  
230 - }  
231 - }  
232 -  
233 - //video  
234 - preg_match_all('/<source\s+[^>]*?src\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_video);  
235 - $video = $result_video[2] ?? [];  
236 - foreach ($video as $vv) {  
237 - $check_vv = $this->url_check($vv, $project_id, $domain, $web_url_domain, $home_url);  
238 - if ($check_vv && (!in_array($check_vv, $source))) {  
239 - $check_vv && $source[] = $check_vv;  
240 - }  
241 - }  
242 -  
243 - //css  
244 - preg_match_all('/<link\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_css);  
245 - $css = $result_css[2] ?? [];  
246 - foreach ($css as $vc) {  
247 - $check_vc = $this->url_check($vc, $project_id, $domain, $web_url_domain, $home_url);  
248 - if ($check_vc && (!in_array($check_vc, $source))) {  
249 - $check_vc && $source[] = $check_vc;  
250 - }  
251 - }  
252 -  
253 - //css background  
254 - preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $html, $result_css_b);  
255 - $css_b = $result_css_b[1] ?? [];  
256 - foreach ($css_b as $vc_b) {  
257 - $check_vc_b = $this->url_check($vc_b, $project_id, $domain, $web_url_domain, $home_url);  
258 - if ($check_vc_b && (!in_array($check_vc_b, $source))) {  
259 - $check_vc_b && $source[] = $check_vc_b;  
260 - }  
261 - }  
262 -  
263 - //a标签下载资源  
264 - preg_match_all('/<a\s+[^>]*?href\s*=\s*(\'|\")(.*?)\\1[^>]*?\/?\s*>/i', $html, $result_a);  
265 - $down = $result_a[2] ?? [];  
266 - foreach ($down as $vd) {  
267 - $check_vd = $this->url_check($vd, $project_id, $domain, $web_url_domain, $home_url);  
268 - if ($check_vd && (!in_array($check_vd, $source))) {  
269 - $check_vd && $source[] = $check_vd;  
270 - }  
271 - }  
272 -  
273 - return $source;  
274 - }  
275 -  
276 - //判断资源是否需要下载  
277 - protected function url_check($url, $project_id, $domain, $web_url_domain, $home_url)  
278 - {  
279 - if ($url) {  
280 - $url = str_replace('&quot;', '', $url);  
281 - $arr = parse_url($url);  
282 - $scheme = $arr['scheme'] ?? '';  
283 - $host = $arr['host'] ?? '';  
284 - $path = $arr['path'] ?? '';  
285 - $query = $arr['query'] ?? '';  
286 -  
287 - $path_arr = explode('.', $path);  
288 - $path_end = end($path_arr);  
289 - if (  
290 - (empty($scheme) || $scheme == 'https' || $scheme == 'http')  
291 - && (empty($host) || (strpos($web_url_domain, $host) !== false) || (strpos($home_url, $host) !== false))  
292 - && $path  
293 - && (substr($path, 0, 1) == '/')  
294 - && (strpos($path, '.') !== false)  
295 - && (strpos($path_end, 'html') === false)  
296 - && (strpos($path_end, 'php') === false)  
297 - && (strpos($path_end, 'com') === false)  
298 - && (strpos($path_end, 'xml') === false)  
299 - ) {  
300 - $source = CollectSource::where('project_id', $project_id)->where('origin', $url)->first();  
301 - if (!$source) {  
302 - $new_url = str_replace($web_url_domain, $home_url, $url);  
303 - $source_new = CollectSource::where('project_id', $project_id)->where('origin', $new_url)->first();  
304 - if (!$source_new) {  
305 - return [  
306 - 'download' => true,  
307 - 'url' => $url,  
308 - 'url_complete' => ($scheme ?: 'https') . '://' . $home_url . $path . ($query ? '?' . $query : '')  
309 - ];  
310 - } else {  
311 - return [  
312 - 'download' => false,  
313 - 'url' => $url,  
314 - 'url_complete' => $source_new['target']  
315 - ];  
316 - }  
317 - } else {  
318 - return [  
319 - 'download' => false,  
320 - 'url' => $url,  
321 - 'url_complete' => $source['target']  
322 - ];  
323 - }  
324 - } else {  
325 - return false;  
326 - }  
327 - } else {  
328 - return false;  
329 - }  
330 - }  
331 -  
332 - //下载并替换资源  
333 - protected function upload_source($html, $source, $project_id, $domain, $web_url_domain, $home_url)  
334 - {  
335 - foreach ($source as $vs) {  
336 -  
337 - if ($vs['download']) {  
338 - $new_source = CosService::uploadRemote($project_id, 'source', $vs['url_complete']);  
339 - if ($new_source) {  
340 - CollectSource::insert([  
341 - 'project_id' => $project_id,  
342 - 'origin' => $vs['url'],  
343 - 'target' => $new_source,  
344 - 'created_at' => date('Y-m-d H:i:s'),  
345 - 'updated_at' => date('Y-m-d H:i:s'),  
346 - ]);  
347 - $html = str_replace($vs['url'], getImageUrl($new_source), $html);  
348 -  
349 - if (substr($new_source, -3, 3) == 'css' || substr($new_source, -2, 2) == 'js') {  
350 -  
351 - $source_html = curl_c(getImageUrl($new_source), false);  
352 -  
353 - if (substr($new_source, -3, 3) == 'css') {  
354 - preg_match_all("/url\(['\"]?(\s*[^>]+?)['\"]?\)/i", $source_html, $result_source);  
355 - } else {  
356 - preg_match_all("/[large|thumb]+URL:['\"]+(\s*[^>]+?)['\"]+,/i", $source_html, $result_source);  
357 - }  
358 -  
359 - $js_css_source = $result_source[1] ?? [];  
360 - if ($js_css_source) {  
361 - foreach ($js_css_source as $vjs) {  
362 - if (strpos($vjs, 'URL:"') !== false) {  
363 - $vjs = substr($vjs, strpos($vjs, 'URL:"') + 5);  
364 - }  
365 -  
366 - $vjs_down = str_replace('&quot;', '', $vjs);  
367 - if (strpos($vjs_down, 'data:') !== false) {  
368 - //过滤二进制文件  
369 - continue;  
370 - }  
371 - if (strlen($vjs_down) > 255) {  
372 - //过滤太长文件  
373 - continue;  
374 - }  
375 -  
376 - $vjs_down_arr = parse_url($vjs_down);  
377 - $vjs_down_host = $vjs_down_arr['host'] ?? '';  
378 -  
379 - $cos = config('filesystems.disks.cos');  
380 - $cosCdn = $cos['cdn'];  
381 -  
382 - if ($vjs_down_host && $vjs_down_host == $cosCdn) {  
383 - //过滤已经下载的  
384 - continue;  
385 - }  
386 -  
387 - if (empty($vjs_down_host) && substr($vjs_down, 0, 1) != '/') {  
388 - //相对路径  
389 - $url_arr = explode('/', $vs['url']);  
390 - $url_arr[count($url_arr) - 1] = $vjs_down;  
391 - $vjs_down = implode('/', $url_arr);  
392 - }  
393 -  
394 - $vjs_result = $this->url_check($vjs_down, $project_id, $domain, $web_url_domain, $home_url);  
395 - if (!$vjs_result) {  
396 - continue;  
397 - }  
398 -  
399 - if ($vjs_result['download']) {  
400 - $new_vjs = CosService::uploadRemote($project_id, 'source', $vjs_result['url_complete']);  
401 - if ($new_vjs) {  
402 - CollectSource::insert([  
403 - 'project_id' => $project_id,  
404 - 'origin' => $vjs_result['url'],  
405 - 'target' => $new_vjs,  
406 - 'created_at' => date('Y-m-d H:i:s'),  
407 - 'updated_at' => date('Y-m-d H:i:s'),  
408 - ]);  
409 - $source_html = str_replace($vjs, getImageUrl($new_vjs), $source_html);  
410 - }  
411 - } else {  
412 - $source_html = str_replace($vjs, getImageUrl($vjs_result['url_complete']), $source_html);  
413 - }  
414 - }  
415 -  
416 - CosService::uploadRemote($project_id, 'source', $new_source, $new_source, $source_html);  
417 - }  
418 - }  
419 - }  
420 - } else {  
421 - $html = str_replace($vs['url'], getImageUrl($vs['url_complete']), $html);  
422 - }  
423 - }  
424 -  
425 - return $html;  
426 - }  
427 -}  
@@ -312,7 +312,7 @@ class ProjectUpdate extends Command @@ -312,7 +312,7 @@ class ProjectUpdate extends Command
312 } 312 }
313 313
314 //关联分类 314 //关联分类
315 - if($category_arr){ 315 + if ($category_arr) {
316 CategoryRelated::saveRelated($id, array_column($category_arr, 'id')); 316 CategoryRelated::saveRelated($id, array_column($category_arr, 'id'));
317 } 317 }
318 318
@@ -689,7 +689,7 @@ class ProjectUpdate extends Command @@ -689,7 +689,7 @@ class ProjectUpdate extends Command
689 $host = $arr['host'] ?? ''; 689 $host = $arr['host'] ?? '';
690 $path = $arr['path'] ?? ''; 690 $path = $arr['path'] ?? '';
691 691
692 - $url_complete = ($scheme ?: 'https') . '://' . ($host ?: $domain) . $path; 692 + $url_complete = ($scheme ?: 'https') . '://' . $domain . $path;
693 693
694 if ( 694 if (
695 (empty($scheme) || $scheme == 'https' || $scheme == 'http') 695 (empty($scheme) || $scheme == 'https' || $scheme == 'http')
@@ -54,12 +54,13 @@ class UpdateRoute extends Command @@ -54,12 +54,13 @@ class UpdateRoute extends Command
54 */ 54 */
55 public function handle(){ 55 public function handle(){
56 $projectModel = new Project(); 56 $projectModel = new Project();
57 - $list = $projectModel->list(['id'=>['in',[221]],'is_upgrade'=>0]); 57 + $list = $projectModel->list(['id'=>['in',[627]]]);
58 foreach ($list as $v){ 58 foreach ($list as $v){
59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
60 ProjectServer::useProject($v['id']); 60 ProjectServer::useProject($v['id']);
61 - $this->getProduct(); 61 +// $this->getProduct();
62 // $this->setProductKeyword(); 62 // $this->setProductKeyword();
  63 + $this->getRouteMap();
63 DB::disconnect('custom_mysql'); 64 DB::disconnect('custom_mysql');
64 } 65 }
65 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 66 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
@@ -138,7 +139,22 @@ class UpdateRoute extends Command @@ -138,7 +139,22 @@ class UpdateRoute extends Command
138 } 139 }
139 } 140 }
140 141
141 - 142 + /**
  143 + * @remark :升级项目同步路由
  144 + * @name :getRouteMap
  145 + * @author :lyh
  146 + * @method :post
  147 + * @time :2024/1/4 11:53
  148 + */
  149 + public function getRouteMap(){
  150 + $routeMapModel = new RouteMap();
  151 + $list = $routeMapModel->list(['source'=>'product','project_id'=>627]);
  152 + foreach ($list as $k => $v){
  153 + $product = new Product();
  154 + $product->edit(['route'=>$v['route']],['id'=>$v['source_id']]);
  155 + echo date('Y-m-d H:i:s') . '产品id:'.$v['source_id'] . PHP_EOL;
  156 + }
  157 + }
142 158
143 /** 159 /**
144 * @remark :删除路由通知C端 160 * @remark :删除路由通知C端
@@ -154,4 +170,6 @@ class UpdateRoute extends Command @@ -154,4 +170,6 @@ class UpdateRoute extends Command
154 curlGet($url); 170 curlGet($url);
155 return true; 171 return true;
156 } 172 }
  173 +
  174 +
157 } 175 }
@@ -19,11 +19,11 @@ class Kernel extends ConsoleKernel @@ -19,11 +19,11 @@ class Kernel extends ConsoleKernel
19 $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长 19 $schedule->command('remain_day')->dailyAt('03:00')->withoutOverlapping(1); // 项目剩余服务时长
20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 20 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
21 $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次 21 $schedule->command('rank_data')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每天凌晨执行一次
22 - $schedule->command('rank_data_speed')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次  
23 - $schedule->command('rank_data_external_links')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次  
24 - $schedule->command('rank_data_indexed_pages')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次  
25 - $schedule->command('rank_data_recomm_domain')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次  
26 - $schedule->command('rank_data_week')->weeklyOn(1, '01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次 22 + $schedule->command('rank_data_speed')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-测速数据,每周一凌晨执行一次
  23 + $schedule->command('rank_data_external_links')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-外链,每周一凌晨执行一次
  24 + $schedule->command('rank_data_indexed_pages')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-页面收录,每周一凌晨执行一次
  25 + $schedule->command('rank_data_recomm_domain')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据-引荐域名,每周一凌晨执行一次
  26 + $schedule->command('rank_data_week')->dailyAt('01:00')->withoutOverlapping(1); // 排名数据,每周一凌晨执行一次
27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次 27 // $schedule->command('share_user')->dailyAt('01:00')->withoutOverlapping(1); // 清除用户ayr_share数据,每天凌晨1点执行一次
28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次 28 $schedule->command('count')->dailyAt('01:00')->withoutOverlapping(1); //每天凌晨1点执行一次
29 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次 29 $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
@@ -34,7 +34,7 @@ class QuanqiusouApi @@ -34,7 +34,7 @@ class QuanqiusouApi
34 $res = HttpUtils::get($api_url, []); 34 $res = HttpUtils::get($api_url, []);
35 if($res){ 35 if($res){
36 $res = Arr::s2a($res); 36 $res = Arr::s2a($res);
37 - Cache::put($key, $res, 24 * 3600); 37 + Cache::put($key, $res, 2 * 3600);
38 } 38 }
39 } catch (\Exception | GuzzleException $e) { 39 } catch (\Exception | GuzzleException $e) {
40 errorLog('获取站点收录页面数', [], $e); 40 errorLog('获取站点收录页面数', [], $e);
@@ -60,7 +60,7 @@ class QuanqiusouApi @@ -60,7 +60,7 @@ class QuanqiusouApi
60 $res = HttpUtils::get($api_url, ['apino' => $api_no]); 60 $res = HttpUtils::get($api_url, ['apino' => $api_no]);
61 if($res){ 61 if($res){
62 $res = Arr::s2a($res); 62 $res = Arr::s2a($res);
63 - Cache::put($key, $res, 24 * 3600); 63 + Cache::put($key, $res, 2 * 3600);
64 } 64 }
65 } catch (\Exception | GuzzleException $e) { 65 } catch (\Exception | GuzzleException $e) {
66 errorLog('获取站点收录页面数', [], $e); 66 errorLog('获取站点收录页面数', [], $e);
@@ -80,11 +80,11 @@ class QuanqiusouApi @@ -80,11 +80,11 @@ class QuanqiusouApi
80 * @author zbj 80 * @author zbj
81 * @date 2023/5/11 81 * @date 2023/5/11
82 */ 82 */
83 - public function getGoogleRank($api_no, int $lang = 0, int $day = 7) 83 + public function getGoogleRank($api_no, int $lang = 0, int $day = 7, $force = true)
84 { 84 {
85 $key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d'); 85 $key = "quanqiusou_api_rank_{$api_no}_{$lang}_{$day}_" . date('Y-m-d');
86 $res = Cache::get($key); 86 $res = Cache::get($key);
87 - if (!$res) { 87 + if (!$res || $force) {
88 $param = [ 88 $param = [
89 'key' => '289c1fc81c89d79c04ed4fd72822948e', 89 'key' => '289c1fc81c89d79c04ed4fd72822948e',
90 'w' => $api_no, 90 'w' => $api_no,
@@ -100,7 +100,7 @@ class QuanqiusouApi @@ -100,7 +100,7 @@ class QuanqiusouApi
100 $res = HttpUtils::get($api_url, $param); 100 $res = HttpUtils::get($api_url, $param);
101 if($res){ 101 if($res){
102 $res = Arr::s2a($res); 102 $res = Arr::s2a($res);
103 - Cache::put($key, $res, 24 * 3600); 103 + Cache::put($key, $res, 2 * 3600);
104 } 104 }
105 } catch (\Exception | GuzzleException $e) { 105 } catch (\Exception | GuzzleException $e) {
106 errorLog('获取谷歌排名数据失败', $api_no, $e); 106 errorLog('获取谷歌排名数据失败', $api_no, $e);
@@ -127,7 +127,7 @@ class QuanqiusouApi @@ -127,7 +127,7 @@ class QuanqiusouApi
127 $res = HttpUtils::get($api_url, []); 127 $res = HttpUtils::get($api_url, []);
128 if($res){ 128 if($res){
129 $res = Arr::s2a($res); 129 $res = Arr::s2a($res);
130 - Cache::put($key, $res, 24 * 3600); 130 + Cache::put($key, $res, 2 * 3600);
131 } 131 }
132 } catch (\Exception | GuzzleException $e) { 132 } catch (\Exception | GuzzleException $e) {
133 errorLog('获取每周谷歌排名数据失败', [], $e); 133 errorLog('获取每周谷歌排名数据失败', [], $e);
@@ -162,7 +162,7 @@ class QuanqiusouApi @@ -162,7 +162,7 @@ class QuanqiusouApi
162 $res = HttpUtils::get($api_url, $param); 162 $res = HttpUtils::get($api_url, $param);
163 if($res){ 163 if($res){
164 $res = Arr::s2a($res); 164 $res = Arr::s2a($res);
165 - Cache::put($key, $res, 24 * 3600); 165 + Cache::put($key, $res, 2 * 3600);
166 } 166 }
167 } catch (\Exception | GuzzleException $e) { 167 } catch (\Exception | GuzzleException $e) {
168 errorLog('获取历史排名统计数据失败', [], $e); 168 errorLog('获取历史排名统计数据失败', [], $e);
@@ -221,7 +221,7 @@ class QuanqiusouApi @@ -221,7 +221,7 @@ class QuanqiusouApi
221 $res = HttpUtils::get($api_url, $param); 221 $res = HttpUtils::get($api_url, $param);
222 if($res){ 222 if($res){
223 $res = Arr::s2a($res); 223 $res = Arr::s2a($res);
224 - Cache::put($key, $res, 24 * 3600); 224 + Cache::put($key, $res, 2 * 3600);
225 } 225 }
226 } catch (\Exception | GuzzleException $e) { 226 } catch (\Exception | GuzzleException $e) {
227 errorLog('获取项目小语种数据失败', [], $e); 227 errorLog('获取项目小语种数据失败', [], $e);
@@ -249,7 +249,7 @@ class QuanqiusouApi @@ -249,7 +249,7 @@ class QuanqiusouApi
249 $res = HttpUtils::get($api_url, $param); 249 $res = HttpUtils::get($api_url, $param);
250 if($res){ 250 if($res){
251 $res = Arr::s2a($res); 251 $res = Arr::s2a($res);
252 - Cache::put($key, $res, 24 * 3600); 252 + Cache::put($key, $res, 2 * 3600);
253 } 253 }
254 } catch (\Exception | GuzzleException $e) { 254 } catch (\Exception | GuzzleException $e) {
255 errorLog('获取项目API_NO数据失败', [], $e); 255 errorLog('获取项目API_NO数据失败', [], $e);
@@ -35,9 +35,9 @@ class SemrushApi @@ -35,9 +35,9 @@ class SemrushApi
35 ]; 35 ];
36 try { 36 try {
37 $res = HttpUtils::get($url, $params); 37 $res = HttpUtils::get($url, $params);
38 - return $this->data($res)[0]; 38 + return $this->data($res)[0] ?? [];
39 }catch (\Exception|GuzzleException $e){ 39 }catch (\Exception|GuzzleException $e){
40 - errorLog('获取站点外链数据', $params, $e); 40 + errorLog('获取站点外链数据失败', $params, $e);
41 return false; 41 return false;
42 } 42 }
43 } 43 }
@@ -63,7 +63,7 @@ class SemrushApi @@ -63,7 +63,7 @@ class SemrushApi
63 $res = HttpUtils::get($url, $params); 63 $res = HttpUtils::get($url, $params);
64 return $this->data($res); 64 return $this->data($res);
65 }catch (\Exception|GuzzleException $e){ 65 }catch (\Exception|GuzzleException $e){
66 - errorLog('获取站点外链数据', $params, $e); 66 + errorLog('获取站点外链数据失败', $params, $e);
67 return false; 67 return false;
68 } 68 }
69 } 69 }
@@ -65,7 +65,7 @@ if (!function_exists('http_post')) { @@ -65,7 +65,7 @@ if (!function_exists('http_post')) {
65 curl_setopt($ch, CURLOPT_URL, $url); 65 curl_setopt($ch, CURLOPT_URL, $url);
66 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); 66 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
67 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 67 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
68 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 68 + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
69 curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 69 curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
70 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)'); 70 curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
71 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 71 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
@@ -74,6 +74,8 @@ if (!function_exists('http_post')) { @@ -74,6 +74,8 @@ if (!function_exists('http_post')) {
74 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 74 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
75 $res = curl_exec($ch); 75 $res = curl_exec($ch);
76 if (curl_errno($ch)) { 76 if (curl_errno($ch)) {
  77 + $error_message = curl_error($ch);
  78 + @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
77 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND); 79 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($res, true) . PHP_EOL, FILE_APPEND);
78 } 80 }
79 curl_close($ch); 81 curl_close($ch);
@@ -124,27 +124,4 @@ class BaseController extends Controller @@ -124,27 +124,4 @@ class BaseController extends Controller
124 $response = response($result,$result_code,$this->header); 124 $response = response($result,$result_code,$this->header);
125 throw new HttpResponseException($response); 125 throw new HttpResponseException($response);
126 } 126 }
127 -  
128 - /**  
129 - * @remark :返回json  
130 - * @name :success  
131 - * @author :lyh  
132 - * @method :post  
133 - * @time :2023/8/28 10:18  
134 - */  
135 - function success(array $data = [], string $code = Code::SUCCESS, bool $objectData = false): JsonResponse  
136 - {  
137 - if ($objectData) {  
138 - $data = (object)$data;  
139 - }  
140 - $code = Code::fromValue($code);  
141 - $response = [  
142 - 'code' => $code->value,  
143 - 'data' => $data,  
144 - 'message' => $code->description,  
145 - ];  
146 - $this->header['token'] = $this->token;  
147 - return response()->json($response,200,$this->header);  
148 - }  
149 -  
150 } 127 }
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Controllers\Aside\Collect; 3 namespace App\Http\Controllers\Aside\Collect;
4 4
  5 +use App\Enums\Common\Code;
5 use App\Http\Controllers\Aside\BaseController; 6 use App\Http\Controllers\Aside\BaseController;
6 use App\Http\Logic\Aside\CollectLogic; 7 use App\Http\Logic\Aside\CollectLogic;
7 8
@@ -22,6 +23,6 @@ class CollectController extends BaseController @@ -22,6 +23,6 @@ class CollectController extends BaseController
22 public function index(CollectLogic $collectLogic) 23 public function index(CollectLogic $collectLogic)
23 { 24 {
24 $data = $collectLogic->collect_data(); 25 $data = $collectLogic->collect_data();
25 - return $this->success($data); 26 + $this->response('success',Code::SUCCESS,$data);
26 } 27 }
27 } 28 }
@@ -87,9 +87,9 @@ class UpdateController extends BaseController @@ -87,9 +87,9 @@ class UpdateController extends BaseController
87 DB::disconnect('custom_mysql'); 87 DB::disconnect('custom_mysql');
88 88
89 $update = ['collect_status' => 0]; 89 $update = ['collect_status' => 0];
90 - if ($this->param['type'] == 2) {  
91 - $update['status'] = 0;  
92 - } 90 +// if ($this->param['type'] == 2) {
  91 +// $update['status'] = 0;
  92 +// }
93 93
94 UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update); 94 UpdateLog::where('project_id', $this->param['project_id'])->whereIn('api_type', ['post', 'page', 'news', 'blog'])->update($update);
95 95
1 <?php 1 <?php
2 2
3 -namespace App\Http\Controllers\Bside\ProjectAssociation; 3 +namespace App\Http\Controllers\Aside\ProjectAssociation;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Exceptions\BsideGlobalException; 6 use App\Exceptions\BsideGlobalException;
7 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
8 -use App\Http\Logic\Aside\ProjectAssociation\ProjectAssociationLogic;  
9 use App\Models\ProjectAssociation\ProjectAssociation; 8 use App\Models\ProjectAssociation\ProjectAssociation;
10 -use Illuminate\Http\Request;  
11 -use Illuminate\Support\Facades\DB;  
12 -use Psr\Container\ContainerExceptionInterface;  
13 -use Psr\Container\NotFoundExceptionInterface; 9 +use App\Services\Aside\ProjectAssociation\ProjectAssociationServices;
14 10
15 class ProjectAssociationController extends BaseController 11 class ProjectAssociationController extends BaseController
16 { 12 {
17 - private $ProjectAssociationLogic;  
18 -  
19 - public function __construct(Request $request)  
20 - {  
21 - $this->ProjectAssociationLogic = new ProjectAssociationLogic();  
22 - parent::__construct($request);  
23 - }  
24 13
25 /** 14 /**
26 * V6与AICC数据关联 15 * V6与AICC数据关联
27 * @return void 16 * @return void
28 * @throws BsideGlobalException 17 * @throws BsideGlobalException
29 */ 18 */
30 - public function saveWeChatData() 19 + public function save()
31 { 20 {
32 $project_id = (int)request()->post('project_id', 0); 21 $project_id = (int)request()->post('project_id', 0);
33 if (empty($project_id)) { 22 if (empty($project_id)) {
34 - $this->fail('请选择项目!', Code::USER_PARAMS_ERROE); 23 + $this->response('请选择项目!', Code::USER_PARAMS_ERROE);
35 } 24 }
36 $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用 25 $status = (bool)request()->post('status', 1); # 1 - 正常, 0 - 禁用
37 26
38 $user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0; 27 $user_id = (int)env('AICC_WECHAT_USER_ID') ?? 0;
39 if (empty($user_id) && $status) { 28 if (empty($user_id) && $status) {
40 - $this->fail('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE); 29 + $this->response('请选择要绑定的AICC用户!', Code::USER_PARAMS_ERROE);
41 } 30 }
42 $friend_id = (int)request()->post('friend_id', 0); 31 $friend_id = (int)request()->post('friend_id', 0);
43 if (empty($friend_id) && $status) { 32 if (empty($friend_id) && $status) {
44 - $this->fail('请选择要绑定的AICC用户列表!', Code::USER_PARAMS_ERROE); 33 + $this->response('请选择要绑定的AICC用户列表!', Code::USER_PARAMS_ERROE);
45 } 34 }
  35 + $app = (int)request()->post('app', ProjectAssociation::ENTERPRISE_WECHAT);
  36 + $app = ProjectAssociation::getApplicationID($app);
46 $nickname = request()->post('nickname', ''); 37 $nickname = request()->post('nickname', '');
47 $user_name = request()->post('user_name', ''); 38 $user_name = request()->post('user_name', '');
48 $image = request()->post('image', ''); 39 $image = request()->post('image', '');
49 - $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image');  
50 - $this->ProjectAssociationLogic->saveWeChatData($data); 40 + $data = compact('project_id', 'user_id', 'friend_id', 'nickname', 'user_name', 'image', 'app');
  41 + ProjectAssociationServices::getInstance()->save($data);
51 $this->response('绑定成功'); 42 $this->response('绑定成功');
52 } 43 }
53 44
@@ -58,27 +49,34 @@ class ProjectAssociationController extends BaseController @@ -58,27 +49,34 @@ class ProjectAssociationController extends BaseController
58 public function check() 49 public function check()
59 { 50 {
60 $project_id = (int)request()->input('project_id', 0); 51 $project_id = (int)request()->input('project_id', 0);
61 - $status = request()->input('status'); 52 + if (empty($project_id)) {
  53 + $this->response('请输入项目信息!', Code::SERVER_ERROR);
  54 + }
  55 + // 项目绑定状态
  56 + $app = (int)request()->input('app', ProjectAssociation::ENTERPRISE_WECHAT);
  57 + $app = ProjectAssociation::getApplicationID($app);
  58 + $status = request()->input('status');
62 // 重载redis缓存 59 // 重载redis缓存
63 $cache = request()->input('cache'); 60 $cache = request()->input('cache');
64 if (isset($status)) { 61 if (isset($status)) {
65 $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED; 62 $status = (int)$status ? ProjectAssociation::STATUS_NORMAL : ProjectAssociation::STATUS_DISABLED;
66 } 63 }
67 - $isRes = $this->ProjectAssociationLogic->normal($project_id); 64 + $isRes = ProjectAssociationServices::getInstance()->normal($project_id, $app);
68 // 当数据不存在时并开启状态,自动添加一条数据 65 // 当数据不存在时并开启状态,自动添加一条数据
69 if (is_null($isRes) && (!is_null($status) && $status)) { 66 if (is_null($isRes) && (!is_null($status) && $status)) {
70 - $isRes = $this->ProjectAssociationLogic->saveProject($project_id, $status);  
71 - if (is_null($isRes)) { 67 + $value = ProjectAssociationServices::getInstance()->saveProject($project_id, $status, $app);
  68 + if (empty($value['bool'])) {
72 // 保存数据失败 69 // 保存数据失败
73 $this->response('绑定AICC数据失败!', Code::SERVER_ERROR); 70 $this->response('绑定AICC数据失败!', Code::SERVER_ERROR);
74 } 71 }
  72 + $isRes = $value['isRes'];
75 } // 关闭状态 73 } // 关闭状态
76 elseif (!is_null($isRes) && (!is_null($status) && empty($status))) { 74 elseif (!is_null($isRes) && (!is_null($status) && empty($status))) {
77 - $bool = $this->ProjectAssociationLogic->closedState($isRes, $status); 75 + $bool = ProjectAssociationServices::getInstance()->closedState($isRes, $status);
78 if ($bool) { 76 if ($bool) {
79 // 关闭aicc绑定成功 77 // 关闭aicc绑定成功
80 $this->response('关闭aicc绑定 - 成功!'); 78 $this->response('关闭aicc绑定 - 成功!');
81 - }else{ 79 + } else {
82 // 关闭aicc绑定失败 80 // 关闭aicc绑定失败
83 $this->response('关闭aicc绑定 - 失败!'); 81 $this->response('关闭aicc绑定 - 失败!');
84 } 82 }
@@ -88,7 +86,7 @@ class ProjectAssociationController extends BaseController @@ -88,7 +86,7 @@ class ProjectAssociationController extends BaseController
88 $this->response('success', Code::SERVER_ERROR); 86 $this->response('success', Code::SERVER_ERROR);
89 } 87 }
90 $cache = isset($cache); 88 $cache = isset($cache);
91 - $result = $this->ProjectAssociationLogic->getAiccWechatLists($isRes, $cache); 89 + $result = ProjectAssociationServices::getInstance()->getAiccWechatLists($isRes, $app, $cache);
92 $this->response('success', Code::SUCCESS, $result); 90 $this->response('success', Code::SUCCESS, $result);
93 } 91 }
94 } 92 }
@@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException; @@ -7,6 +7,8 @@ use App\Exceptions\BsideGlobalException;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Controller; 8 use App\Http\Controllers\Controller;
9 use App\Http\Requests\Scene; 9 use App\Http\Requests\Scene;
  10 +use App\Models\Template\BTemplate;
  11 +use App\Models\Template\Setting;
10 use Illuminate\Http\JsonResponse; 12 use Illuminate\Http\JsonResponse;
11 use Illuminate\Http\Request; 13 use Illuminate\Http\Request;
12 use Illuminate\Http\Exceptions\HttpResponseException; 14 use Illuminate\Http\Exceptions\HttpResponseException;
@@ -127,7 +129,7 @@ class BaseController extends Controller @@ -127,7 +129,7 @@ class BaseController extends Controller
127 * @param bool $objectData 129 * @param bool $objectData
128 * @return JsonResponse 130 * @return JsonResponse
129 */ 131 */
130 - function success($data) :array 132 + function success($data)
131 { 133 {
132 return $data; 134 return $data;
133 } 135 }
@@ -170,4 +172,85 @@ class BaseController extends Controller @@ -170,4 +172,85 @@ class BaseController extends Controller
170 return \Illuminate\Support\Facades\Request::isMethod('post'); 172 return \Illuminate\Support\Facades\Request::isMethod('post');
171 } 173 }
172 174
  175 +
  176 + /**
  177 + * @remark :获取当前用户选择的模版
  178 + * @name :getTemplateId
  179 + * @author :lyh
  180 + * @method :post
  181 + * @time :2024/1/3 10:52
  182 + */
  183 + public function getTemplateId($source,$is_list){
  184 + $template_id = 0;
  185 + if($this->user['is_customized'] == BTemplate::IS_VISUALIZATION) {//定制项目
  186 + $type = $this->getCustomizedType($source, $is_list);//获取定制界面类型
  187 + //查看当前页面是否定制,是否开启可视化
  188 + $page_array = (array)$this->user['is_visualization']->page_array;//获取所有定制界面
  189 + if (in_array($type, $page_array)) {//是定制界面
  190 + return $this->success($template_id);
  191 + }
  192 + }
  193 + $bSettingModel = new Setting();
  194 + $info = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
  195 + if($info === false){
  196 + return $this->success($template_id);
  197 + }
  198 + $template_id = $info['template_id'];
  199 + return $this->success($template_id);
  200 + }
  201 +
  202 + /**
  203 + * @remark :定制页面头部类型---根据source获取type类型
  204 + * @name :getType
  205 + * @author :lyh
  206 + * @method :post
  207 + * @time :2023/11/16 11:20
  208 + */
  209 + public function getCustomizedType($source,$is_list){
  210 + $type = BTemplate::TYPE_HOME;
  211 + if($source == BTemplate::SOURCE_PRODUCT){
  212 + if($is_list == BTemplate::IS_LIST){
  213 + $type = BTemplate::TYPE_PRODUCT_LIST;
  214 + }else{
  215 + $type = BTemplate::TYPE_PRODUCT_DETAIL;
  216 + }
  217 + }
  218 + if($source == BTemplate::SOURCE_BLOG){
  219 + if($is_list == BTemplate::IS_LIST){
  220 + $type = BTemplate::TYPE_BLOG_LIST;
  221 + }else{
  222 + $type = BTemplate::TYPE_BLOG_DETAIL;
  223 + }
  224 + }
  225 + if($source == BTemplate::SOURCE_NEWS){
  226 + if($is_list == BTemplate::IS_LIST){
  227 + $type = BTemplate::TYPE_NEWS_LIST;
  228 + }else{
  229 + $type = BTemplate::TYPE_NEWS_DETAIL;
  230 + }
  231 + }
  232 + return $type;
  233 + }
  234 + /**
  235 + * @remark :查看是否已装修
  236 + * @name :getIsRenovation
  237 + * @author :lyh
  238 + * @method :post
  239 + * @time :2023/9/13 14:02
  240 + */
  241 + public function getIsRenovation($source,$is_list,$template_id,$id){
  242 + $webTemplateModel = new BTemplate();
  243 + $param = [
  244 + 'source'=>$source,
  245 + 'project_id'=>$this->user['project_id'],
  246 + 'source_id'=>$id,
  247 + 'template_id'=>$template_id,
  248 + 'is_list'=>$is_list
  249 + ];
  250 + $templateInfo = $webTemplateModel->read($param);
  251 + if($templateInfo !== false){
  252 + return 1;
  253 + }
  254 + return 0;
  255 + }
173 } 256 }
@@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest; @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\Blog\BlogCategoryRequest;
9 use App\Models\Blog\Blog as BlogModel; 9 use App\Models\Blog\Blog as BlogModel;
10 use App\Models\Blog\BlogCategory as BlogCategoryModel; 10 use App\Models\Blog\BlogCategory as BlogCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
12 13
13 class BlogCategoryController extends BaseController 14 class BlogCategoryController extends BaseController
14 { 15 {
@@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController @@ -25,9 +26,11 @@ class BlogCategoryController extends BaseController
25 $data = []; 26 $data = [];
26 if(!empty($lists)){ 27 if(!empty($lists)){
27 $blogModel = new BlogModel(); 28 $blogModel = new BlogModel();
  29 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
28 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
29 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $blogModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']); 32 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG_CATE,$v['id']);
  33 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST,$template_id,$v['id']);
31 $lists[$k] = $v; 34 $lists[$k] = $v;
32 } 35 }
33 if(!isset($this->map['name'])){ 36 if(!isset($this->map['name'])){
@@ -32,18 +32,15 @@ class BlogController extends BaseController @@ -32,18 +32,15 @@ class BlogController extends BaseController
32 $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page); 32 $lists = $query->select($filed)->paginate($this->row, ['*'], 'page', $this->page);
33 if(!empty($lists)){ 33 if(!empty($lists)){
34 $lists = $lists->toArray(); 34 $lists = $lists->toArray();
35 -// //获取当前项目的所有分类  
36 $data = $this->getCategoryList(); 35 $data = $this->getCategoryList();
37 - //获取当前用户选择的模版  
38 - $templateSettingModel = new Setting();  
39 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 36 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL);
40 $user = new User(); 37 $user = new User();
41 foreach ($lists['list'] as $k => $v){ 38 foreach ($lists['list'] as $k => $v){
42 $v['category_name'] = $this->categoryName($v['category_id'],$data); 39 $v['category_name'] = $this->categoryName($v['category_id'],$data);
43 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']); 40 $v['url'] = $this->user['domain'] . getRouteMap(RouteMap::SOURCE_BLOG,$v['id']);
44 $v['image_link'] = getImageUrl($v['image']); 41 $v['image_link'] = getImageUrl($v['image']);
45 $v['operator_name'] = $user->getName($v['operator_id']); 42 $v['operator_name'] = $user->getName($v['operator_id']);
46 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 43 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_BLOG,BTemplate::IS_DETAIL,$template_id,$v['id']);
47 $lists['list'][$k] = $v; 44 $lists['list'][$k] = $v;
48 } 45 }
49 } 46 }
@@ -51,31 +48,6 @@ class BlogController extends BaseController @@ -51,31 +48,6 @@ class BlogController extends BaseController
51 } 48 }
52 49
53 /** 50 /**
54 - * @remark :查看产品是否已装修  
55 - * @name :getProductIsRenovation  
56 - * @author :lyh  
57 - * @method :post  
58 - * @time :2023/9/13 14:02  
59 - */  
60 - public function getProductIsRenovation($info,$id){  
61 - if($info !== false){  
62 - $webTemplateModel = new BTemplate();  
63 - $param = [  
64 - 'source'=>BTemplate::SOURCE_BLOG,  
65 - 'project_id'=>$this->user['project_id'],  
66 - 'source_id'=>$id,  
67 - 'template_id'=>$info['template_id'],  
68 - 'is_list'=>0  
69 - ];  
70 - $templateInfo = $webTemplateModel->read($param);  
71 - if($templateInfo !== false){  
72 - return 1;  
73 - }  
74 - }  
75 - return 0;  
76 - }  
77 -  
78 - /**  
79 * @remark :处理列表返回参数 51 * @remark :处理列表返回参数
80 * @name :handleReturnParam 52 * @name :handleReturnParam
81 * @author :lyh 53 * @author :lyh
@@ -32,7 +32,7 @@ class CustomModuleCategoryController extends BaseController @@ -32,7 +32,7 @@ class CustomModuleCategoryController extends BaseController
32 ]); 32 ]);
33 $this->map['project_id'] = $this->user['project_id']; 33 $this->map['project_id'] = $this->user['project_id'];
34 $this->map['status'] = 0; 34 $this->map['status'] = 0;
35 - $list = $customModuleCategory->list($this->map); 35 + $list = $customModuleCategory->list($this->map,'sort');
36 if(!empty($list)){ 36 if(!empty($list)){
37 foreach ($list as $k => $v){ 37 foreach ($list as $k => $v){
38 $v['url'] = $this->user['domain'].$v['route']; 38 $v['url'] = $this->user['domain'].$v['route'];
@@ -130,4 +130,23 @@ class CustomModuleCategoryController extends BaseController @@ -130,4 +130,23 @@ class CustomModuleCategoryController extends BaseController
130 $logic->categoryDel(); 130 $logic->categoryDel();
131 $this->response('success'); 131 $this->response('success');
132 } 132 }
  133 +
  134 + /**
  135 + * @remark :排序
  136 + * @name :sort
  137 + * @author :lyh
  138 + * @method :post
  139 + * @time :2024/1/3 14:18
  140 + */
  141 + public function sort(CustomModuleCategoryLogic $logic){
  142 + $this->request->validate([
  143 + 'id'=>['required'],
  144 + 'sort'=>['required'],
  145 + ],[
  146 + 'id.required' => 'ID不能为空',
  147 + 'sort.required' => '排序字段不能为空',
  148 + ]);
  149 + $logic->categorySort();
  150 + $this->response('success');
  151 + }
133 } 152 }
@@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest; @@ -9,6 +9,7 @@ use App\Http\Requests\Bside\News\NewsCategoryRequest;
9 use App\Models\News\News as NewsModel; 9 use App\Models\News\News as NewsModel;
10 use App\Models\News\NewsCategory as NewsCategoryModel; 10 use App\Models\News\NewsCategory as NewsCategoryModel;
11 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
  12 +use App\Models\Template\BTemplate;
12 13
13 class NewsCategoryController extends BaseController 14 class NewsCategoryController extends BaseController
14 { 15 {
@@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController @@ -25,9 +26,11 @@ class NewsCategoryController extends BaseController
25 $data = []; 26 $data = [];
26 if(!empty($lists)){ 27 if(!empty($lists)){
27 $newsModel = new NewsModel(); 28 $newsModel = new NewsModel();
  29 + $template_id = $this->getTemplateId(BTemplate::SOURCE_BLOG,BTemplate::IS_LIST);
28 foreach ($lists as $k => $v){ 30 foreach ($lists as $k => $v){
29 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count(); 31 $v['num'] = $newsModel->formatQuery(['category_id'=>['like','%,' . $v['id'] . ',%']])->count();
30 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']); 32 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS_CATE,$v['id']);
  33 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_LIST,$template_id,$v['id']);
31 $lists[$k] = $v; 34 $lists[$k] = $v;
32 } 35 }
33 if(!isset($this->map['name'])){ 36 if(!isset($this->map['name'])){
@@ -36,15 +36,14 @@ class NewsController extends BaseController @@ -36,15 +36,14 @@ class NewsController extends BaseController
36 // //获取当前项目的所有分类 36 // //获取当前项目的所有分类
37 $data = $this->getCategoryList(); 37 $data = $this->getCategoryList();
38 //获取当前用户选择的模版 38 //获取当前用户选择的模版
39 - $templateSettingModel = new Setting();  
40 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 39 + $template_id = $this->getTemplateId(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL);//获取模版id
41 $user = new User(); 40 $user = new User();
42 foreach ($lists['list'] as $k => $v){ 41 foreach ($lists['list'] as $k => $v){
43 $v['category_name'] = $this->categoryName($v['category_id'],$data); 42 $v['category_name'] = $this->categoryName($v['category_id'],$data);
44 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']); 43 $v['url'] = $this->user['domain'].getRouteMap(RouteMap::SOURCE_NEWS,$v['id']);
45 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
46 $v['operator_name'] = $user->getName($v['operator_id']); 45 $v['operator_name'] = $user->getName($v['operator_id']);
47 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 46 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_NEWS,BTemplate::IS_DETAIL,$template_id,$v['id']);
48 $lists['list'][$k] = $v; 47 $lists['list'][$k] = $v;
49 } 48 }
50 } 49 }
@@ -52,31 +51,6 @@ class NewsController extends BaseController @@ -52,31 +51,6 @@ class NewsController extends BaseController
52 } 51 }
53 52
54 /** 53 /**
55 - * @remark :查看产品是否已装修  
56 - * @name :getProductIsRenovation  
57 - * @author :lyh  
58 - * @method :post  
59 - * @time :2023/9/13 14:02  
60 - */  
61 - public function getProductIsRenovation($info,$id){  
62 - if($info !== false){  
63 - $webTemplateModel = new BTemplate();  
64 - $param = [  
65 - 'source'=>4,  
66 - 'project_id'=>$this->user['project_id'],  
67 - 'source_id'=>$id,  
68 - 'template_id'=>$info['template_id'],  
69 - 'is_list'=>0  
70 - ];  
71 - $templateInfo = $webTemplateModel->read($param);  
72 - if($templateInfo !== false){  
73 - return 1;  
74 - }  
75 - }  
76 - return 0;  
77 - }  
78 -  
79 - /**  
80 * @remark :处理列表返回参数 54 * @remark :处理列表返回参数
81 * @name :handleReturnParam 55 * @name :handleReturnParam
82 * @author :lyh 56 * @author :lyh
@@ -10,6 +10,7 @@ use App\Models\Product\Category; @@ -10,6 +10,7 @@ use App\Models\Product\Category;
10 use App\Models\Product\CategoryRelated; 10 use App\Models\Product\CategoryRelated;
11 use App\Models\Product\Product; 11 use App\Models\Product\Product;
12 use App\Models\RouteMap\RouteMap; 12 use App\Models\RouteMap\RouteMap;
  13 +use App\Models\Template\BTemplate;
13 use App\Rules\Ids; 14 use App\Rules\Ids;
14 use Illuminate\Http\Request; 15 use Illuminate\Http\Request;
15 16
@@ -36,10 +37,12 @@ class CategoryController extends BaseController @@ -36,10 +37,12 @@ class CategoryController extends BaseController
36 $list = $category->list($this->map,['sort','id'],$filed); 37 $list = $category->list($this->map,['sort','id'],$filed);
37 $data = []; 38 $data = [];
38 if(!empty($list)){ 39 if(!empty($list)){
  40 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST);//获取模版id
39 foreach ($list as $k =>$v){ 41 foreach ($list as $k =>$v){
40 $v['url'] = $this->user['domain'] . $v['route'].'/'; 42 $v['url'] = $this->user['domain'] . $v['route'].'/';
41 $v['product_num'] = Category::getProductNum($v['id']); 43 $v['product_num'] = Category::getProductNum($v['id']);
42 $v['image_link'] = getImageUrl($v['image']); 44 $v['image_link'] = getImageUrl($v['image']);
  45 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
43 $list[$k] = $v; 46 $list[$k] = $v;
44 } 47 }
45 if(!isset($this->map['title'])){ 48 if(!isset($this->map['title'])){
@@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException; @@ -7,6 +7,7 @@ use App\Exceptions\BsideGlobalException;
7 use App\Helper\Arr; 7 use App\Helper\Arr;
8 use App\Helper\Common; 8 use App\Helper\Common;
9 use App\Http\Controllers\Bside\BaseController; 9 use App\Http\Controllers\Bside\BaseController;
  10 +use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
10 use App\Http\Logic\Bside\Product\ProductLogic; 11 use App\Http\Logic\Bside\Product\ProductLogic;
11 use App\Http\Requests\Bside\Product\ProductRequest; 12 use App\Http\Requests\Bside\Product\ProductRequest;
12 use App\Models\Product\Category; 13 use App\Models\Product\Category;
@@ -52,15 +53,13 @@ class ProductController extends BaseController @@ -52,15 +53,13 @@ class ProductController extends BaseController
52 $lists = $lists->toArray(); 53 $lists = $lists->toArray();
53 $cate_data = $this->getCategoryList();//分类 54 $cate_data = $this->getCategoryList();//分类
54 $key_data = $this->getKeywordsList();//关键字 55 $key_data = $this->getKeywordsList();//关键字
55 - //获取当前用户选择的模版  
56 - $templateSettingModel = new Setting();  
57 - $info = $templateSettingModel->read(['project_id'=>$this->user['project_id']]); 56 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);//获取模版id
58 $userModel = new User(); 57 $userModel = new User();
59 foreach ($lists['list'] as $k=>$v){ 58 foreach ($lists['list'] as $k=>$v){
60 $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data); 59 $v['category_id_text'] = $this->categoryName($v['category_id'],$cate_data);
61 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data); 60 $v['keyword_id_text'] = $this->keywordName($v['keyword_id'],$key_data);
62 $v['created_uid_text'] = $userModel->getName($v['created_uid']); 61 $v['created_uid_text'] = $userModel->getName($v['created_uid']);
63 - $v['is_renovation'] = $this->getProductIsRenovation($info,$v['id']); 62 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
64 $v['url'] = $this->user['domain'].$v['route'].'/'; 63 $v['url'] = $this->user['domain'].$v['route'].'/';
65 $lists['list'][$k] = $v; 64 $lists['list'][$k] = $v;
66 } 65 }
@@ -119,31 +118,6 @@ class ProductController extends BaseController @@ -119,31 +118,6 @@ class ProductController extends BaseController
119 } 118 }
120 119
121 /** 120 /**
122 - * @remark :查看产品是否已装修  
123 - * @name :getProductIsRenovation  
124 - * @author :lyh  
125 - * @method :post  
126 - * @time :2023/9/13 14:02  
127 - */  
128 - public function getProductIsRenovation($info,$id){  
129 - if($info !== false){  
130 - $webTemplateModel = new BTemplate();  
131 - $param = [  
132 - 'source'=>2,  
133 - 'project_id'=>$this->user['project_id'],  
134 - 'source_id'=>$id,  
135 - 'template_id'=>$info['template_id'],  
136 - 'is_list'=>0  
137 - ];  
138 - $templateInfo = $webTemplateModel->read($param);  
139 - if($templateInfo !== false){  
140 - return 1;  
141 - }  
142 - }  
143 - return 0;  
144 - }  
145 -  
146 - /**  
147 * @remark :获取所有分类 121 * @remark :获取所有分类
148 * @name :getCategoryList 122 * @name :getCategoryList
149 * @author :lyh 123 * @author :lyh
@@ -266,9 +240,8 @@ class ProductController extends BaseController @@ -266,9 +240,8 @@ class ProductController extends BaseController
266 } 240 }
267 $v['status_text'] = Product::statusMap()[$v['status']] ?? ''; 241 $v['status_text'] = Product::statusMap()[$v['status']] ?? '';
268 //获取当前用户选择的模版 242 //获取当前用户选择的模版
269 - $templateSettingModel = new Setting();  
270 - $templateInfo = $templateSettingModel->read(['project_id'=>$this->user['project_id']]);  
271 - $v['is_renovation'] = $this->getProductIsRenovation($templateInfo,$v['id']); 243 + $template_id = $this->getTemplateId(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL);
  244 + $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_DETAIL,$template_id,$v['id']);
272 $v['url'] = $this->user['domain'].$v['route']; 245 $v['url'] = $this->user['domain'].$v['route'];
273 //获取当前数据扩展字段及值 246 //获取当前数据扩展字段及值
274 $v['extend'] = $this->getExtendInfo($v['id']); 247 $v['extend'] = $this->getExtendInfo($v['id']);
@@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController; @@ -7,9 +7,7 @@ use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\BTemplateLogic; 7 use App\Http\Logic\Bside\BTemplate\BTemplateLogic;
8 use App\Http\Requests\Bside\Template\TemplateRequest; 8 use App\Http\Requests\Bside\Template\TemplateRequest;
9 use App\Models\Template\BTemplate; 9 use App\Models\Template\BTemplate;
10 -use App\Models\Template\BTemplateMain;  
11 use App\Models\Template\Setting; 10 use App\Models\Template\Setting;
12 -use App\Models\Template\Template;  
13 11
14 class BTemplateController extends BaseController 12 class BTemplateController extends BaseController
15 { 13 {
@@ -160,4 +158,16 @@ class BTemplateController extends BaseController @@ -160,4 +158,16 @@ class BTemplateController extends BaseController
160 $this->response('模板保存成功'); 158 $this->response('模板保存成功');
161 } 159 }
162 160
  161 + /**
  162 + * @remark :获取source类型
  163 + * @name :getSource
  164 + * @author :lyh
  165 + * @method :post
  166 + * @time :2024/1/3 9:06
  167 + */
  168 + public function getSource(){
  169 + $bTemplateModel = new BTemplate();
  170 + $info = $bTemplateModel->sourceMap();
  171 + $this->response('success',Code::SUCCESS,$info);
  172 + }
163 } 173 }
@@ -94,4 +94,16 @@ class InitHtmlController extends BaseController @@ -94,4 +94,16 @@ class InitHtmlController extends BaseController
94 $logic->saveCustomizedHtml(); 94 $logic->saveCustomizedHtml();
95 $this->response('success'); 95 $this->response('success');
96 } 96 }
  97 +
  98 + /**
  99 + * @remark :前端获取初始设置模块
  100 + * @name :getDetailInfo
  101 + * @author :lyh
  102 + * @method :post
  103 + * @time :2024/1/3 14:27
  104 + */
  105 + public function getDetailInfo(InitHtmlLogic $logic){
  106 + $data = $logic->getInitModuleMain();
  107 + $this->response('success',Code::SUCCESS,$data);
  108 + }
97 } 109 }
@@ -81,8 +81,11 @@ class CreateKeywordLogic extends BaseLogic @@ -81,8 +81,11 @@ class CreateKeywordLogic extends BaseLogic
81 $prefix_keyword_suffix = $this->prefixKeywordSuffix($this->param['prefix'] ?? [],$this->param['suffix'] ?? [],$this->param['keyword']); 81 $prefix_keyword_suffix = $this->prefixKeywordSuffix($this->param['prefix'] ?? [],$this->param['suffix'] ?? [],$this->param['keyword']);
82 $data = [ 82 $data = [
83 'prefix_keyword'=>$prefix_keyword, 83 'prefix_keyword'=>$prefix_keyword,
  84 + 'prefix_keyword_count'=>count($prefix_keyword),
84 'keyword_suffix'=>$keyword_suffix, 85 'keyword_suffix'=>$keyword_suffix,
85 - 'prefix_keyword_suffix'=>$prefix_keyword_suffix 86 + 'keyword_suffix_count'=>count($keyword_suffix),
  87 + 'prefix_keyword_suffix'=>$prefix_keyword_suffix,
  88 + 'prefix_keyword_suffix_count'=>count($prefix_keyword_suffix)
86 ]; 89 ];
87 return $this->success($data); 90 return $this->success($data);
88 } 91 }
@@ -5,9 +5,9 @@ namespace App\Http\Logic\Aside\Project; @@ -5,9 +5,9 @@ namespace App\Http\Logic\Aside\Project;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Exceptions\AsideGlobalException; 6 use App\Exceptions\AsideGlobalException;
7 use App\Models\Com\NoticeLog; 7 use App\Models\Com\NoticeLog;
  8 +use App\Models\Com\UpdateLog;
8 use App\Models\Devops\ServerConfig; 9 use App\Models\Devops\ServerConfig;
9 use App\Models\Project\ProjectRenew; 10 use App\Models\Project\ProjectRenew;
10 -use App\Models\Template\BSettingTemplate;  
11 use App\Models\Template\Setting; 11 use App\Models\Template\Setting;
12 use App\Models\User\ProjectMenu; 12 use App\Models\User\ProjectMenu;
13 use App\Models\User\ProjectRole; 13 use App\Models\User\ProjectRole;
@@ -15,7 +15,6 @@ use App\Services\SyncService; @@ -15,7 +15,6 @@ use App\Services\SyncService;
15 use App\Utils\HttpUtils; 15 use App\Utils\HttpUtils;
16 use App\Utils\LogUtils; 16 use App\Utils\LogUtils;
17 use GuzzleHttp\Exception\GuzzleException; 17 use GuzzleHttp\Exception\GuzzleException;
18 -use Illuminate\Support\Arr as SupArr;  
19 use App\Helper\Arr; 18 use App\Helper\Arr;
20 use App\Helper\Common; 19 use App\Helper\Common;
21 use App\Helper\FormGlobalsoApi; 20 use App\Helper\FormGlobalsoApi;
@@ -37,9 +36,7 @@ use Hashids\Hashids; @@ -37,9 +36,7 @@ use Hashids\Hashids;
37 use App\Models\User\User as UserModel; 36 use App\Models\User\User as UserModel;
38 use Illuminate\Support\Facades\DB; 37 use Illuminate\Support\Facades\DB;
39 use Illuminate\Support\Facades\Http; 38 use Illuminate\Support\Facades\Http;
40 -use Illuminate\Support\Facades\Log;  
41 use Illuminate\Support\Facades\Schema; 39 use Illuminate\Support\Facades\Schema;
42 -use Illuminate\Support\Str;  
43 use App\Http\Logic\Aside\Domain\DomainInfoLogic; 40 use App\Http\Logic\Aside\Domain\DomainInfoLogic;
44 41
45 /** 42 /**
@@ -90,6 +87,15 @@ class ProjectLogic extends BaseLogic @@ -90,6 +87,15 @@ class ProjectLogic extends BaseLogic
90 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ 87 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
91 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); 88 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
92 } 89 }
  90 + //升级项目采集完成时间
  91 + $collect_time = '';
  92 + if($info['is_upgrade'] == 1){
  93 + $collect_info = UpdateLog::where('project_id',$id)->where('api_type','blog')->first();
  94 + if($collect_info){
  95 + $collect_time = $collect_info->collect_status == 0 ? '采集中' : $collect_info->updated_at->format('Y-m-d H:i:s');
  96 + }
  97 + }
  98 + $info['collect_time'] = $collect_time;
93 return $this->success($info); 99 return $this->success($info);
94 } 100 }
95 101
@@ -418,8 +424,8 @@ class ProjectLogic extends BaseLogic @@ -418,8 +424,8 @@ class ProjectLogic extends BaseLogic
418 'role_menu'=>implode(',',$ids), 424 'role_menu'=>implode(',',$ids),
419 'project_id'=>$project_id, 425 'project_id'=>$project_id,
420 'type'=>1, 426 'type'=>1,
421 - 'operator_id'=>$this->manager['id'],  
422 - 'create_id'=>$this->manager['id'], 427 + 'operator_id'=>0,
  428 + 'create_id'=>0,
423 ]; 429 ];
424 $roleModel->add($data); 430 $roleModel->add($data);
425 } 431 }
@@ -62,14 +62,14 @@ class AyrReleaseLogic extends BaseLogic @@ -62,14 +62,14 @@ class AyrReleaseLogic extends BaseLogic
62 if($k == 'images'){ 62 if($k == 'images'){
63 $images = $v; 63 $images = $v;
64 $imageModel = new Image(); 64 $imageModel = new Image();
65 - $list = $imageModel->list(['hash'=>['in',$images]],'id'); 65 + $list = $imageModel->list(['path'=>['in',$images]],'id');
66 foreach ($list as $v1){ 66 foreach ($list as $v1){
67 - $arr[] = url('/upload'.$v1['path']); 67 + $arr[] = getImageUrl($v1['path']);
68 } 68 }
69 }else{ 69 }else{
70 $fileModel = new File(); 70 $fileModel = new File();
71 - $info = $fileModel->read(['hash'=>$v]);  
72 - $arr[] = url('/upload'.$info['path']); 71 + $info = $fileModel->read(['path'=>$v]);
  72 + $arr[] = getFileUrl($info['path']);
73 } 73 }
74 } 74 }
75 return $this->success($arr); 75 return $this->success($arr);
@@ -39,6 +39,10 @@ class BTemplateLogLogic extends BaseLogic @@ -39,6 +39,10 @@ class BTemplateLogLogic extends BaseLogic
39 $this->fail('error'); 39 $this->fail('error');
40 } 40 }
41 $bTemplateModel = new BTemplate(); 41 $bTemplateModel = new BTemplate();
  42 + if($info['template_id'] == 0){//定制项目
  43 + $bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);
  44 + return $this->success();
  45 + }
42 //演示项目,不允许其他号码编辑 46 //演示项目,不允许其他号码编辑
43 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ 47 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
44 $this->fail('演示项目仅支持演示功能,无法更改首页'); 48 $this->fail('演示项目仅支持演示功能,无法更改首页');
@@ -604,10 +604,6 @@ class BTemplateLogic extends BaseLogic @@ -604,10 +604,6 @@ class BTemplateLogic extends BaseLogic
604 $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s'); 604 $param['head_css'] = characterTruncation($param['html'],'/<style id="globalsojs-header">(.*?)<\/style>/s');
605 $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 605 $param['main_css'] = characterTruncation($param['html'],'/<style id="globalsojs-styles">(.*?)<\/style>/s');
606 $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s'); 606 $param['footer_css'] = characterTruncation($param['html'],'/<style id="globalsojs-footer">(.*?)<\/style>/s');
607 - if(!isset($param['is_custom'])){  
608 - $param['is_custom'] = BTemplate::IS_NO_CUSTOM;  
609 - }  
610 - $param['type'] = BTemplate::PAGE_HTML;//不显示整个HTML  
611 return $this->success($param); 607 return $this->success($param);
612 } 608 }
613 609
@@ -297,4 +297,20 @@ class InitHtmlLogic extends BaseLogic @@ -297,4 +297,20 @@ class InitHtmlLogic extends BaseLogic
297 } 297 }
298 return $this->success(); 298 return $this->success();
299 } 299 }
  300 +
  301 + /**
  302 + * @remark :前端获取设置模块(侧边栏)
  303 + * @name :getInitModuleMain
  304 + * @author :lyh
  305 + * @method :post
  306 + * @time :2024/1/3 14:30
  307 + */
  308 + public function getInitModuleMain(){
  309 + $mainModel = new TemplateTypeMain();
  310 + $info = $mainModel->read(['type'=>$this->param['type']]);
  311 + if($info === false){
  312 + $this->fail('当前类型数据不存在');
  313 + }
  314 + return $this->success(['html'=>$info['main_html']]);
  315 + }
300 } 316 }
@@ -219,4 +219,19 @@ class CustomModuleCategoryLogic extends BaseLogic @@ -219,4 +219,19 @@ class CustomModuleCategoryLogic extends BaseLogic
219 $this->curlDelRoute(['route'=>$info['route']]); 219 $this->curlDelRoute(['route'=>$info['route']]);
220 return $this->success(); 220 return $this->success();
221 } 221 }
  222 +
  223 + /**
  224 + * @remark :排序
  225 + * @name :categorySort
  226 + * @author :lyh
  227 + * @method :post
  228 + * @time :2023/9/26 17:38
  229 + */
  230 + public function categorySort(){
  231 + $rs = $this->model->edit(['sort'=>$this->param['sort']],['id'=>$this->param['id']]);
  232 + if($rs === false){
  233 + $this->fail('系统错误,请联系管理员');
  234 + }
  235 + return $this->success();
  236 + }
222 } 237 }
@@ -88,7 +88,7 @@ class CountLogic extends BaseLogic @@ -88,7 +88,7 @@ class CountLogic extends BaseLogic
88 * @time :2023/5/24 14:03 88 * @time :2023/5/24 14:03
89 */ 89 */
90 public function keyword_data_count(){ 90 public function keyword_data_count(){
91 - $yesterday = Carbon::yesterday()->toDateString(); 91 + $yesterday = date('Y-m-d');
92 $rankDataModel = new RankDataModel(); 92 $rankDataModel = new RankDataModel();
93 $param = [ 93 $param = [
94 'updated_date' => $yesterday, 94 'updated_date' => $yesterday,
@@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic @@ -202,7 +202,7 @@ class CategoryLogic extends BaseLogic
202 * 产品导入:分类处理 202 * 产品导入:分类处理
203 * @param $project_id 203 * @param $project_id
204 * @param $category 204 * @param $category
205 - * @return string 205 + * @return array
206 * @throws \Exception 206 * @throws \Exception
207 * @author Akun 207 * @author Akun
208 * @date 2023/09/21 14:55 208 * @date 2023/09/21 14:55
@@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic @@ -227,7 +227,9 @@ class CategoryLogic extends BaseLogic
227 } 227 }
228 //清除缓存 228 //清除缓存
229 Common::del_user_cache('product_category',$project_id); 229 Common::del_user_cache('product_category',$project_id);
230 - return $this->getLastCategory($return); 230 + $category_id = $this->getLastCategory($return);
  231 +
  232 + return ['category_id'=>$category_id,'category_arr'=>$return];
231 } 233 }
232 234
233 /** 235 /**
@@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic @@ -616,10 +616,13 @@ class ProductLogic extends BaseLogic
616 if (!$product) { 616 if (!$product) {
617 617
618 $category_id = ''; 618 $category_id = '';
  619 + $category_arr = [];
619 if ($data[2]??'') { 620 if ($data[2]??'') {
620 //处理分类 621 //处理分类
621 $categoryLogic = new CategoryLogic(); 622 $categoryLogic = new CategoryLogic();
622 - $category_id = $categoryLogic->importProductCategory($project_id, $data[2]); 623 + $category_info = $categoryLogic->importProductCategory($project_id, $data[2]);
  624 + $category_id = $category_info['category_id'];
  625 + $category_arr = $category_info['category_arr'];
623 } 626 }
624 627
625 $keyword_id = ''; 628 $keyword_id = '';
@@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic @@ -805,6 +808,11 @@ class ProductLogic extends BaseLogic
805 808
806 $this->edit(['route' => $route], ['id' => $id]); 809 $this->edit(['route' => $route], ['id' => $id]);
807 810
  811 + //关联分类
  812 + if($category_arr){
  813 + CategoryRelated::saveRelated($id, $category_arr);
  814 + }
  815 +
808 return true; 816 return true;
809 } 817 }
810 818
@@ -65,8 +65,8 @@ class RankDataLogic extends BaseLogic @@ -65,8 +65,8 @@ class RankDataLogic extends BaseLogic
65 'cert_info' => $domain_info['cert_info'] ?? '', 65 'cert_info' => $domain_info['cert_info'] ?? '',
66 'plan' => Project::planMap()[$project['deploy_build']['plan']], 66 'plan' => Project::planMap()[$project['deploy_build']['plan']],
67 'keyword_num' => $project['deploy_build']['keyword_num'], 67 'keyword_num' => $project['deploy_build']['keyword_num'],
68 - 'compliance_day' => $rank['compliance_day'] ?? 0,  
69 - 'remain_day' => $project['deploy_build']['service_duration'] - ($rank['compliance_day'] ?? 0), 68 + 'compliance_day' => $project['finish_remain_day'] ?? 0,
  69 + 'remain_day' => $project['deploy_build']['service_duration'] - ($project['finish_remain_day'] ?? 0),
70 ]; 70 ];
71 71
72 //小语种列表 72 //小语种列表
@@ -357,41 +357,43 @@ class RankDataLogic extends BaseLogic @@ -357,41 +357,43 @@ class RankDataLogic extends BaseLogic
357 * @author zbj 357 * @author zbj
358 * @date 2023/9/20 358 * @date 2023/9/20
359 */ 359 */
360 - public function syncRankData($api_no, $site_res){  
361 - $project_id = DeployOptimize::where('api_no', $api_no)->value('project_id');  
362 - $project = Project::find($project_id);  
363 - if(!$project){  
364 - throw new \Exception($api_no . '关联的项目不存在');  
365 - } 360 + public function syncRankData($api_no, $site_res, $force=false){
  361 + $project_ids = DeployOptimize::where('api_no', $api_no)->pluck('project_id');
  362 + foreach ($project_ids as $project_id) {
  363 + $project = Project::find($project_id);
  364 + if (!$project) {
  365 + throw new \Exception($api_no . '关联的项目不存在');
  366 + }
366 367
367 - $api = new QuanqiusouApi(); 368 + $api = new QuanqiusouApi();
368 369
369 - $model = RankData::where('project_id', $project_id)->where('lang', '')->first();  
370 - if (!$model || $model->updated_date != date('Y-m-d')) {  
371 - $res = $api->getGoogleRank($api_no);  
372 - if(!$res){  
373 - throw new \Exception('接口数据获取失败');  
374 - }  
375 - //收录数  
376 - $indexed_pages_num = $site_res[$api_no] ?? 0;  
377 - $this->save_rank($project_id, $res, $indexed_pages_num);  
378 - }  
379 - //有小语种的  
380 - $lang_list = $api->getLangList();  
381 - if(!empty($lang_list[$api_no])){  
382 - $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();  
383 - if (!$model || $model->updated_date != date('Y-m-d')) {  
384 - $res = $api->getGoogleRank($api_no, 1);  
385 - if(!$res){ 370 + $model = RankData::where('project_id', $project_id)->where('lang', '')->first();
  371 + if (!$model || $model->updated_date != date('Y-m-d') || $force) {
  372 + $res = $api->getGoogleRank($api_no, 0, 7, $force);
  373 + if (!$res) {
386 throw new \Exception('接口数据获取失败'); 374 throw new \Exception('接口数据获取失败');
387 } 375 }
388 - $data = [];  
389 - //不同的小语种取出来  
390 - foreach ($res as $keyword => $v){  
391 - $data[Arr::last($v)['lang']][$keyword] = $v;  
392 - }  
393 - foreach ($data as $lang => $rank){  
394 - $this->save_rank($project_id, $rank, 0, $lang); 376 + //收录数
  377 + $indexed_pages_num = $site_res[$api_no] ?? 0;
  378 + $this->save_rank($project_id, $res, $indexed_pages_num);
  379 + }
  380 + //有小语种的
  381 + $lang_list = $api->getLangList();
  382 + if (!empty($lang_list[$api_no])) {
  383 + $model = RankData::where('project_id', $project_id)->where('lang', '<>', '')->first();
  384 + if (!$model || $model->updated_date != date('Y-m-d') || $force) {
  385 + $res = $api->getGoogleRank($api_no, 1, 7, $force);
  386 + if (!$res) {
  387 + throw new \Exception('接口数据获取失败');
  388 + }
  389 + $data = [];
  390 + //不同的小语种取出来
  391 + foreach ($res as $keyword => $v) {
  392 + $data[Arr::last($v)['lang']][$keyword] = $v;
  393 + }
  394 + foreach ($data as $lang => $rank) {
  395 + $this->save_rank($project_id, $rank, 0, $lang);
  396 + }
395 } 397 }
396 } 398 }
397 } 399 }
@@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware @@ -27,19 +27,5 @@ class EnableCrossRequestMiddleware
27 exit; 27 exit;
28 } 28 }
29 return $response; 29 return $response;
30 - // 指定允许其他域名访问  
31 -// $http_origin = "*";  
32 -// if(isset($_SERVER['HTTP_ORIGIN'])){  
33 -// $http_origin = $_SERVER['HTTP_ORIGIN'];  
34 -// }  
35 -// header("Access-Control-Allow-Origin:".$http_origin);  
36 -// header('Access-Control-Allow-Methods:POST,GET'); //支持的http 动作  
37 -// header('Access-Control-Allow-Credentials: true');  
38 -// header('Access-Control-Max-Age: 1000');  
39 -// header('Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept, Authorization, token'); //响应头 请按照自己需求添加。  
40 -// if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') {  
41 -// exit;  
42 -// }  
43 -// return $next($request);  
44 } 30 }
45 } 31 }
@@ -5,6 +5,7 @@ namespace App\Models\ProjectAssociation; @@ -5,6 +5,7 @@ namespace App\Models\ProjectAssociation;
5 use Illuminate\Database\Eloquent\Builder; 5 use Illuminate\Database\Eloquent\Builder;
6 use Illuminate\Database\Eloquent\Model; 6 use Illuminate\Database\Eloquent\Model;
7 7
  8 +
8 /** 9 /**
9 * App\Models\ProjectAssociation\ProjectAssociation 10 * App\Models\ProjectAssociation\ProjectAssociation
10 * 11 *
@@ -17,11 +18,13 @@ use Illuminate\Database\Eloquent\Model; @@ -17,11 +18,13 @@ use Illuminate\Database\Eloquent\Model;
17 * @property string|null $image AICC朋友头像 18 * @property string|null $image AICC朋友头像
18 * @property int|null $status 1 - 正常, 0 - 禁用 19 * @property int|null $status 1 - 正常, 0 - 禁用
19 * @property int|null $m_status 统计当月是否生成数据 20 * @property int|null $m_status 统计当月是否生成数据
  21 + * @property int|null $binding_app 1 - 企业微信 2 - 个人微信
20 * @property \Illuminate\Support\Carbon|null $created_at 22 * @property \Illuminate\Support\Carbon|null $created_at
21 * @property \Illuminate\Support\Carbon|null $updated_at 23 * @property \Illuminate\Support\Carbon|null $updated_at
22 * @method Builder|ProjectAssociation newModelQuery() 24 * @method Builder|ProjectAssociation newModelQuery()
23 * @method Builder|ProjectAssociation newQuery() 25 * @method Builder|ProjectAssociation newQuery()
24 * @method static Builder|ProjectAssociation query() 26 * @method static Builder|ProjectAssociation query()
  27 + * @method Builder|ProjectAssociation whereBindingApp($value)
25 * @method Builder|ProjectAssociation whereCreatedAt($value) 28 * @method Builder|ProjectAssociation whereCreatedAt($value)
26 * @method Builder|ProjectAssociation whereFriendId($value) 29 * @method Builder|ProjectAssociation whereFriendId($value)
27 * @method Builder|ProjectAssociation whereId($value) 30 * @method Builder|ProjectAssociation whereId($value)
@@ -46,60 +49,30 @@ class ProjectAssociation extends Model @@ -46,60 +49,30 @@ class ProjectAssociation extends Model
46 /** @var int 数据状态 - 禁用 */ 49 /** @var int 数据状态 - 禁用 */
47 const STATUS_DISABLED = 0; 50 const STATUS_DISABLED = 0;
48 51
49 - /**  
50 - * 保存|修改数据  
51 - * @param array $data  
52 - * @return bool  
53 - */  
54 - public function saveData(array $data): bool  
55 - {  
56 - # V6项目ID  
57 - $project_id = (int)$data['project_id'] ?? 0;  
58 - $isRes = self::query()->where('project_id', $project_id)->first();  
59 - if (!$isRes) {  
60 - $isRes = new self();  
61 - $isRes->project_id = $project_id;  
62 - }  
63 - # AICC朋友ID  
64 - $isRes->friend_id = $data['friend_id'] ?? 0;  
65 - # AICC朋友昵称  
66 - $isRes->nickname = $data['nickname'] ?? 0;  
67 - # AICC用户ID  
68 - $isRes->user_id = $data['user_id'] ?? 0;  
69 - # AICC用户姓名  
70 - $isRes->user_name = $data['user_name'] ?? '';  
71 - # AICC朋友头像  
72 - $isRes->image = $data['image'] ?? '';  
73 - return $isRes->save();  
74 - } 52 + /** @var int 企业微信 */
  53 + const ENTERPRISE_WECHAT = 1;
75 54
76 - /**  
77 - * 检查项目是否存在  
78 - * @param $project_id  
79 - * @return Builder|Model|object|null  
80 - */  
81 - public function check($project_id) 55 + /** @var int 个人微信 */
  56 + const PERSONAL_WECHAT = 2;
  57 +
  58 + public static function getApplicationApiUrl($app)
82 { 59 {
83 - return self::query()->where('project_id', $project_id)->first(); 60 + return [
  61 + 1 => env('AICC_ENTERPRISE_WECHAT_FRIEND_API_URL'),
  62 + 2 => env('AICC_WECHAT_FRIEND_API_URL'),
  63 + ][$app] ?? env('AICC_ENTERPRISE_WECHAT_FRIEND_API_URL');
84 } 64 }
85 65
86 /** 66 /**
87 - * @param int $page  
88 - * @param int $perPage  
89 - * @return array 67 + * 返回绑定的APP应用类型
  68 + * @param $app
  69 + * @return int
90 */ 70 */
91 - public function allData(int $page = 1, int $perPage = 15) 71 + public static function getApplicationID($app)
92 { 72 {
93 - $status = 1; # 1 - 正常, 0 - 禁用  
94 - $lists = self::query()->where('status', $status)  
95 - ->where('project_id', '!=', 0)  
96 - ->where('friend_id', '!=', 0)  
97 - ->where('user_id', '!=', 0)  
98 - ->paginate($perPage, ['project_id', 'friend_id', 'user_id'], 'page', $page);  
99 - $items = $lists->Items();  
100 - $totalPage = $lists->lastPage();  
101 - $total = $lists->total();  
102 - $currentPage = $lists->currentPage();  
103 - return compact('total', 'items', 'totalPage', 'currentPage'); 73 + return [
  74 + 1 => self::ENTERPRISE_WECHAT,
  75 + 2 => self::PERSONAL_WECHAT,
  76 + ][$app] ?? self::ENTERPRISE_WECHAT;
104 } 77 }
105 } 78 }
@@ -45,6 +45,7 @@ class BTemplate extends Base @@ -45,6 +45,7 @@ class BTemplate extends Base
45 * 其他相关定义 45 * 其他相关定义
46 */ 46 */
47 const IS_LIST = 1;//列表页 47 const IS_LIST = 1;//列表页
  48 + const IS_DETAIL = 0;//详情页
48 const IS_HEADER = 1;//独立头部底部 49 const IS_HEADER = 1;//独立头部底部
49 const IS_NO_HEADER = 0;//非独立头部底部 50 const IS_NO_HEADER = 0;//非独立头部底部
50 const IS_CUSTOM = 1;//为扩展模块 51 const IS_CUSTOM = 1;//为扩展模块
@@ -131,7 +132,7 @@ class BTemplate extends Base @@ -131,7 +132,7 @@ class BTemplate extends Base
131 * @method :post 132 * @method :post
132 * @time :2023/12/29 10:57 133 * @time :2023/12/29 10:57
133 */ 134 */
134 - public function typeMap() 135 + public function sourceMap()
135 { 136 {
136 return [ 137 return [
137 'SOURCE_HOME'=>self::SOURCE_HOME, 138 'SOURCE_HOME'=>self::SOURCE_HOME,
1 <?php 1 <?php
2 2
3 -namespace App\Http\Logic\Aside\ProjectAssociation; 3 +namespace App\Services\Aside\ProjectAssociation;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 -use App\Http\Logic\Logic; 6 +use App\Exceptions\BsideGlobalException;
7 use App\Models\ProjectAssociation\ProjectAssociation; 7 use App\Models\ProjectAssociation\ProjectAssociation;
  8 +use App\Services\BaseService;
8 use Illuminate\Database\Eloquent\Builder; 9 use Illuminate\Database\Eloquent\Builder;
9 use Illuminate\Database\Eloquent\Model; 10 use Illuminate\Database\Eloquent\Model;
10 use Illuminate\Support\Facades\DB; 11 use Illuminate\Support\Facades\DB;
11 12
12 -class ProjectAssociationLogic extends Logic 13 +class ProjectAssociationServices extends BaseService
13 { 14 {
14 - public function saveWeChatData($data) 15 + /**
  16 + * 保存aicc与项目关系数据
  17 + * @param array $data
  18 + * @return bool
  19 + * @throws BsideGlobalException
  20 + */
  21 + public function save(array $data)
15 { 22 {
16 - $wx = new ProjectAssociation(); 23 + $bool = false;
17 DB::beginTransaction(); 24 DB::beginTransaction();
18 try { 25 try {
19 - $status = $wx->saveData($data); 26 + # V6项目ID
  27 + $project_id = (int)$data['project_id'] ?? 0;
  28 + $isRes = ProjectAssociation::query()->where('project_id', $project_id)->first();
  29 + if (!$isRes) {
  30 + $isRes = new ProjectAssociation();
  31 + $isRes->project_id = $project_id;
  32 + }
  33 + # AICC朋友ID
  34 + $isRes->friend_id = $data['friend_id'] ?? 0;
  35 + # AICC朋友昵称
  36 + $isRes->nickname = $data['nickname'] ?? 0;
  37 + # AICC用户ID
  38 + $isRes->user_id = $data['user_id'] ?? 0;
  39 + # AICC用户姓名
  40 + $isRes->user_name = $data['user_name'] ?? '';
  41 + # AICC朋友头像
  42 + $isRes->image = $data['image'] ?? '';
  43 + $isRes->binding_app = $data['app'] ?? 1;
  44 + $bool = $isRes->save();
20 DB::commit(); 45 DB::commit();
21 } catch (\Exception $e) { 46 } catch (\Exception $e) {
22 DB::rollBack(); 47 DB::rollBack();
23 $e->getMessage(); 48 $e->getMessage();
24 - errorLog('V6与AICC关联失败', $wx, $e); 49 + errorLog('V6与AICC关联失败', $data, $e);
25 $this->fail('请检查操作是否正确!', Code::SERVER_MYSQL_ERROR); 50 $this->fail('请检查操作是否正确!', Code::SERVER_MYSQL_ERROR);
26 } 51 }
27 - return $status; 52 + return $bool;
28 } 53 }
29 54
30 /** 55 /**
31 * status - 正常 56 * status - 正常
32 * @param $project_id 57 * @param $project_id
  58 + * @param $app
33 * @return ProjectAssociation|Builder|Model|object|null 59 * @return ProjectAssociation|Builder|Model|object|null
34 */ 60 */
35 - public function normal($project_id) 61 + public function normal($project_id, $app)
36 { 62 {
37 - return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->first(); 63 + return ProjectAssociation::query()->whereProjectId($project_id)->whereStatus(ProjectAssociation::STATUS_NORMAL)->whereBindingApp($app)->first();
38 } 64 }
39 65
40 -  
41 /** 66 /**
42 * status - 禁用 67 * status - 禁用
43 * @param $project_id 68 * @param $project_id
@@ -50,11 +75,12 @@ class ProjectAssociationLogic extends Logic @@ -50,11 +75,12 @@ class ProjectAssociationLogic extends Logic
50 75
51 /** 76 /**
52 * 初始化数据/修改数据 77 * 初始化数据/修改数据
53 - * @param int $project_id  
54 - * @param int $status  
55 - * @return Builder|Model|object|ProjectAssociation|null 78 + * @param $project_id
  79 + * @param $status
  80 + * @param $app
  81 + * @return array
56 */ 82 */
57 - public function saveProject($project_id, $status) 83 + public function saveProject($project_id, $status, $app)
58 { 84 {
59 $bool = false; 85 $bool = false;
60 DB::beginTransaction(); 86 DB::beginTransaction();
@@ -62,32 +88,58 @@ class ProjectAssociationLogic extends Logic @@ -62,32 +88,58 @@ class ProjectAssociationLogic extends Logic
62 if (is_null($isRes)) { 88 if (is_null($isRes)) {
63 $isRes = new ProjectAssociation(); 89 $isRes = new ProjectAssociation();
64 } 90 }
65 - $isRes->project_id = $project_id;  
66 - $isRes->user_id = (int)env('AICC_WECHAT_USER_ID');  
67 - $isRes->status = $status; 91 + $isRes->project_id = $project_id;
  92 + $isRes->user_id = (int)env('AICC_WECHAT_USER_ID');
  93 + $isRes->status = $status;
  94 + $isRes->binding_app = $app;
  95 + try {
  96 + $bool = $isRes->save();
  97 + DB::commit();
  98 + } catch (\Exception $exception) {
  99 + DB::rollBack();
  100 + }
  101 + return compact('bool', 'isRes');
  102 + }
  103 +
  104 +
  105 + /**
  106 + * 关闭状态
  107 + * @param ProjectAssociation $res
  108 + * @param int $status 1 - 正常, 0 - 禁用
  109 + * @return bool
  110 + */
  111 + public function closedState($res, $status)
  112 + {
  113 + DB::beginTransaction();
  114 + $bool = false;
68 try { 115 try {
69 - $isRes->save(); 116 + $res->status = $status;
  117 + $bool = $res->save();
70 DB::commit(); 118 DB::commit();
71 } catch (\Exception $exception) { 119 } catch (\Exception $exception) {
72 DB::rollBack(); 120 DB::rollBack();
73 } 121 }
74 - return $isRes; 122 + return $bool;
75 } 123 }
76 124
77 /** 125 /**
78 * 获取AICC微信列表数据 126 * 获取AICC微信列表数据
79 * @param ProjectAssociation $res 127 * @param ProjectAssociation $res
80 - * @param bool $cache 128 + * @param int $type 绑定app应用类型
  129 + * @param bool $cache 是否缓存
81 * @return mixed 130 * @return mixed
82 */ 131 */
83 - public function getAiccWechatLists($res, $cache = false) 132 + public function getAiccWechatLists($res, $type = ProjectAssociation::PERSONAL_WECHAT, $cache = false)
84 { 133 {
85 - $redis_key = 'aicc_friend_lists_' . (int)env('AICC_WECHAT_USER_ID'); 134 + $redis_key = 'aicc_friend_lists_' . $type . '_' . (int)env('AICC_WECHAT_USER_ID');
86 $result = $cache ? false : redis_get($redis_key); 135 $result = $cache ? false : redis_get($redis_key);
87 if (empty($result)) { 136 if (empty($result)) {
88 - $url = env('AICC_URL') . env('AICC_WECHAT_FRIEND_API_URL'); 137 + $apiUrl = ProjectAssociation::getApplicationApiUrl($type);
  138 + $url = env('AICC_URL') . $apiUrl;
89 $result = curlGet($url); 139 $result = curlGet($url);
90 - redis_set($redis_key, json_encode($result), 60); 140 + if (!empty($result['data'])) {
  141 + redis_set($redis_key, json_encode($result), 60);
  142 + }
91 } else { 143 } else {
92 $result = json_decode($result, true); 144 $result = json_decode($result, true);
93 } 145 }
@@ -99,24 +151,4 @@ class ProjectAssociationLogic extends Logic @@ -99,24 +151,4 @@ class ProjectAssociationLogic extends Logic
99 ]; 151 ];
100 return $result; 152 return $result;
101 } 153 }
102 -  
103 - /**  
104 - * 关闭状态  
105 - * @param ProjectAssociation $res  
106 - * @param int $status 1 - 正常, 0 - 禁用  
107 - * @return bool  
108 - */  
109 - public function closedState($res, $status)  
110 - {  
111 - DB::beginTransaction();  
112 - $bool = false;  
113 - try {  
114 - $res->status = $status;  
115 - $bool = $res->save();  
116 - DB::commit();  
117 - } catch (\Exception $exception) {  
118 - DB::rollBack();  
119 - }  
120 - return $bool;  
121 - }  
122 } 154 }
@@ -8,10 +8,56 @@ namespace App\Services; @@ -8,10 +8,56 @@ namespace App\Services;
8 8
9 use App\Enums\Common\Code; 9 use App\Enums\Common\Code;
10 use App\Exceptions\BsideGlobalException; 10 use App\Exceptions\BsideGlobalException;
  11 +use Mockery;
11 12
12 class BaseService 13 class BaseService
13 { 14 {
14 /** 15 /**
  16 + * 单例模式
  17 + * 特点:三私,两静,一公
  18 + * 三私:三个私有方法,(静态变量、构造函数、克隆函数)
  19 + * 两静:两个静态方法,(一个静态变量,一个静态方法)
  20 + * 一公:单例模式的出口
  21 + *
  22 + * 优点:
  23 + * 1、在内存里只有一个实例,减少了内存的开销,尤其是频繁的创建和销毁实例(比如管理学院首页页面缓存)。
  24 + * 2、避免对资源的多重占用(比如写文件操作)。
  25 + */
  26 +
  27 + protected static $instance;
  28 +
  29 + /**
  30 + * @return static
  31 + */
  32 + public static function getInstance()
  33 + {
  34 + if ((static::$instance[static::class] ?? null) instanceof static) {
  35 + return static::$instance[static::class];
  36 + }
  37 + return static::$instance[static::class] = new static();
  38 + }
  39 +
  40 + /**
  41 + * @return Mockery\Mock
  42 + */
  43 + public static function mockInstance()
  44 + {
  45 + return static::$instance[static::class] = Mockery::mock(static::class)
  46 + ->makePartial()
  47 + ->shouldAllowMockingProtectedMethods();
  48 + }
  49 +
  50 + private function __construct()
  51 + {
  52 +
  53 + }
  54 +
  55 + private function __clone()
  56 + {
  57 + // TODO: Implement __clone() method.
  58 + }
  59 +
  60 + /**
15 * @notes: 手动抛出异常 61 * @notes: 手动抛出异常
16 * @param string $msg 62 * @param string $msg
17 * @param string $code 63 * @param string $code
@@ -11,7 +11,7 @@ use App\Services\BaseService; @@ -11,7 +11,7 @@ use App\Services\BaseService;
11 use App\Traits\RedisTrait; 11 use App\Traits\RedisTrait;
12 use App\Utils\HttpUtils; 12 use App\Utils\HttpUtils;
13 13
14 -class DingService extends BaseService 14 +class DingService
15 { 15 {
16 use RedisTrait; 16 use RedisTrait;
17 17
@@ -19,7 +19,7 @@ use Illuminate\Support\Facades\Schema; @@ -19,7 +19,7 @@ use Illuminate\Support\Facades\Schema;
19 * Class ProjectServer 19 * Class ProjectServer
20 * @package App\Services 20 * @package App\Services
21 */ 21 */
22 -class ProjectServer extends BaseService 22 +class ProjectServer
23 { 23 {
24 /** 24 /**
25 * @param $project_id 25 * @param $project_id
@@ -119,16 +119,17 @@ class ProjectServer extends BaseService @@ -119,16 +119,17 @@ class ProjectServer extends BaseService
119 * @method :post 119 * @method :post
120 * @time :2023/12/29 9:34 120 * @time :2023/12/29 9:34
121 */ 121 */
122 - public function initModule($project_id){  
123 - $moduleModel = new CustomModule();  
124 - $info = $moduleModel->read(['route'=>'video']);  
125 - if($info === false){ 122 + public static function initModule($project_id){
  123 + $info = DB::connection('custom_mysql')->table('gl_custom_module')->first();
  124 + if(empty($info)){
126 $data = [ 125 $data = [
127 'name'=>'视频模块', 126 'name'=>'视频模块',
128 'project_id'=>$project_id, 127 'project_id'=>$project_id,
129 'route'=>'video', 128 'route'=>'video',
  129 + 'created_at' => date('Y-m-d H:i:s'),
  130 + 'updated_at' => date('Y-m-d H:i:s')
130 ]; 131 ];
131 - $moduleModel->add($data); 132 + DB::connection('custom_mysql')->table('gl_custom_module')->insert($data);
132 } 133 }
133 return true; 134 return true;
134 } 135 }
@@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Log; @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Log;
17 * Class SyncService 17 * Class SyncService
18 * @package App\Services 18 * @package App\Services
19 */ 19 */
20 -class SyncService extends BaseService 20 +class SyncService
21 { 21 {
22 /** 22 /**
23 * 同步信息到表单系统 23 * 同步信息到表单系统
@@ -102,4 +102,4 @@ class SyncService extends BaseService @@ -102,4 +102,4 @@ class SyncService extends BaseService
102 curl_close($ch); 102 curl_close($ch);
103 return [$code, $response]; 103 return [$code, $response];
104 } 104 }
105 -}  
  105 +}
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 */ 4 */
5 5
6 use App\Http\Controllers\Aside; 6 use App\Http\Controllers\Aside;
7 -use App\Http\Controllers\Bside\ProjectAssociation\ProjectAssociationController; 7 +use App\Http\Controllers\Aside\ProjectAssociation\ProjectAssociationController;
8 use Illuminate\Support\Facades\Route; 8 use Illuminate\Support\Facades\Route;
9 9
10 10
@@ -72,7 +72,7 @@ Route::middleware(['aloginauth'])->group(function () { @@ -72,7 +72,7 @@ Route::middleware(['aloginauth'])->group(function () {
72 //发送记录 72 //发送记录
73 Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists'); 73 Route::any('/log', [Aside\Ai\AiLogController::class, 'lists'])->name('admin.lists');
74 // 绑定AICC微信应用 74 // 绑定AICC微信应用
75 - Route::post('/wechat', [ProjectAssociationController::class, 'saveWeChatData'])->name('admin.aicc.wechat'); 75 + Route::post('/binding/save', [ProjectAssociationController::class, 'save'])->name('admin.binding.save');
76 // OA后台开启关闭AICC用户绑定 76 // OA后台开启关闭AICC用户绑定
77 Route::post('/check', [ProjectAssociationController::class, 'check'])->name('admin.aicc.check'); 77 Route::post('/check', [ProjectAssociationController::class, 'check'])->name('admin.aicc.check');
78 }); 78 });
@@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -317,6 +317,7 @@ Route::middleware(['bloginauth'])->group(function () {
317 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate'); 317 Route::any('/savePublicTemplate', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'savePublicTemplate'])->name('template_savePublicTemplate');
318 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo'); 318 Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getDetailInfo'])->name('template_getDetailInfo');
319 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail'); 319 Route::any('/saveDetail', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'saveDetail'])->name('template_saveDetail');
  320 + Route::any('/getSource', [\App\Http\Controllers\Bside\Template\BTemplateController::class, 'getSource'])->name('template_getSource');
320 // 模板 321 // 模板
321 Route::prefix('module')->group(function () { 322 Route::prefix('module')->group(function () {
322 //获取所有左侧模版 323 //获取所有左侧模版
@@ -348,6 +349,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -348,6 +349,7 @@ Route::middleware(['bloginauth'])->group(function () {
348 Route::any('/saveCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveCustomizedHtml'])->name('init_saveCustomizedHtml'); 349 Route::any('/saveCustomizedHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveCustomizedHtml'])->name('init_saveCustomizedHtml');
349 Route::any('/getDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailHtml'])->name('init_getDetailHtml'); 350 Route::any('/getDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailHtml'])->name('init_getDetailHtml');
350 Route::any('/saveDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveDetailHtml'])->name('init_saveDetailHtml'); 351 Route::any('/saveDetailHtml', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'saveDetailHtml'])->name('init_saveDetailHtml');
  352 + Route::any('/getDetailInfo', [\App\Http\Controllers\Bside\Template\InitHtmlController::class, 'getDetailInfo'])->name('init_getDetailInfo');
351 }); 353 });
352 354
353 // 自定义页面,专题页 355 // 自定义页面,专题页
@@ -445,6 +447,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -445,6 +447,7 @@ Route::middleware(['bloginauth'])->group(function () {
445 Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'info'])->name('custom_category_info'); 447 Route::any('/info', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'info'])->name('custom_category_info');
446 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save'); 448 Route::any('/save', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'save'])->name('custom_category_save');
447 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del'); 449 Route::any('/del', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'del'])->name('custom_category_del');
  450 + Route::any('/sort', [\App\Http\Controllers\Bside\CustomModule\CustomModuleCategoryController::class, 'sort'])->name('custom_category_sort');
448 }); 451 });
449 452
450 Route::prefix('content')->group(function () { 453 Route::prefix('content')->group(function () {