作者 刘锟

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

正在显示 31 个修改的文件 包含 245 行增加1120 行删除
@@ -146,6 +146,7 @@ class Languages extends Command @@ -146,6 +146,7 @@ class Languages extends Command
146 {"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]'; 146 {"short":"ug","english":"Uyghur","chinese":"维吾尔语","language":"ئۇيغۇر"}]';
147 $data = json_decode($data); 147 $data = json_decode($data);
148 foreach ($data as $v){ 148 foreach ($data as $v){
  149 + $v = (array)$v;
149 echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL; 150 echo date('Y-m-d H:i:s') . ' start: ' . $v['short'] . PHP_EOL;
150 $languageModel = new WebLanguage(); 151 $languageModel = new WebLanguage();
151 $languageModel->add($v); 152 $languageModel->add($v);
@@ -3,7 +3,9 @@ @@ -3,7 +3,9 @@
3 namespace App\Console\Commands; 3 namespace App\Console\Commands;
4 4
5 use App\Helper\FormGlobalsoApi; 5 use App\Helper\FormGlobalsoApi;
  6 +use App\Models\Inquiry\InquiryOther;
6 use App\Models\Project\Project; 7 use App\Models\Project\Project;
  8 +use App\Services\ProjectServer;
7 use Illuminate\Console\Command; 9 use Illuminate\Console\Command;
8 10
9 /** 11 /**
@@ -51,13 +53,19 @@ class LastInquiry extends Command @@ -51,13 +53,19 @@ class LastInquiry extends Command
51 } 53 }
52 $api = new FormGlobalsoApi(); 54 $api = new FormGlobalsoApi();
53 $res = $api->getInquiryList($item['deploy_optimize']['domain']); 55 $res = $api->getInquiryList($item['deploy_optimize']['domain']);
54 - if($res && $res['status'] == 200){  
55 - if(empty($res['data']['data'][0])){ 56 + $last_time = $res['data']['data'][0] ?? '';
  57 + //其他询盘的最新时间
  58 + ProjectServer::useProject($item['id']);
  59 + $other_last_time = InquiryOther::orderBy('id', 'desc')->value('submit_time');
  60 +
  61 + $last_inquiry_time = $last_time > $other_last_time ? $last_time : $other_last_time;
  62 +
  63 + if(!$last_inquiry_time){
56 continue; 64 continue;
57 } 65 }
58 - $item->last_inquiry_time = $res['data']['data'][0]['submit_time']; 66 +
  67 + $item->last_inquiry_time = $last_inquiry_time;
59 $item->save(); 68 $item->save();
60 } 69 }
61 } 70 }
62 - }  
63 } 71 }
@@ -159,21 +159,21 @@ class InquiryMonthlyCount extends Command @@ -159,21 +159,21 @@ class InquiryMonthlyCount extends Command
159 //访问来源前10 159 //访问来源前10
160 $source = DB::connection('custom_mysql')->table('gl_customer_visit') 160 $source = DB::connection('custom_mysql')->table('gl_customer_visit')
161 ->select('referrer_url', DB::raw('COUNT(*) as count')) 161 ->select('referrer_url', DB::raw('COUNT(*) as count'))
162 - ->groupBy('referrer_url')->where(['domain'=>$domain]) 162 + ->groupBy('referrer_url')
163 ->whereBetween('updated_date', [$startTime,$endTime]) 163 ->whereBetween('updated_date', [$startTime,$endTime])
164 ->orderByDesc('count')->limit(10)->get()->toArray(); 164 ->orderByDesc('count')->limit(10)->get()->toArray();
165 $arr['source'] = json_encode($source); 165 $arr['source'] = json_encode($source);
166 //访问国家前15 166 //访问国家前15
167 $source_country = DB::connection('custom_mysql')->table('gl_customer_visit') 167 $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
168 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) 168 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
169 - ->groupBy('country')->where(['domain'=>$domain]) 169 + ->groupBy('country')
170 ->whereBetween('updated_date', [$startTime,$endTime]) 170 ->whereBetween('updated_date', [$startTime,$endTime])
171 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 171 ->orderBy('ip','desc')->limit(15)->get()->toArray();
172 $arr['source_country'] = json_encode($source_country); 172 $arr['source_country'] = json_encode($source_country);
173 //受访界面前15 173 //受访界面前15
174 $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit') 174 $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
175 ->select('url',DB::raw('COUNT(*) as num')) 175 ->select('url',DB::raw('COUNT(*) as num'))
176 - ->orderBy('num','desc')->where(['domain'=>$domain]) 176 + ->orderBy('num','desc')
177 ->whereBetween('updated_date', [$startTime,$endTime]) 177 ->whereBetween('updated_date', [$startTime,$endTime])
178 ->groupBy('url') 178 ->groupBy('url')
179 ->limit(15)->get()->toArray(); 179 ->limit(15)->get()->toArray();
@@ -181,7 +181,7 @@ class InquiryMonthlyCount extends Command @@ -181,7 +181,7 @@ class InquiryMonthlyCount extends Command
181 //访问端口 181 //访问端口
182 $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit') 182 $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
183 ->select('device_port',DB::raw('COUNT(*) as num')) 183 ->select('device_port',DB::raw('COUNT(*) as num'))
184 - ->orderBy('num','desc')->where(['domain'=>$domain]) 184 + ->orderBy('num','desc')
185 ->whereBetween('updated_date', [$startTime,$endTime]) 185 ->whereBetween('updated_date', [$startTime,$endTime])
186 ->groupBy('device_port') 186 ->groupBy('device_port')
187 ->limit(15)->get()->toArray(); 187 ->limit(15)->get()->toArray();
@@ -18,6 +18,7 @@ use App\Services\ProjectServer; @@ -18,6 +18,7 @@ use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 18 use Illuminate\Console\Command;
19 use Illuminate\Database\QueryException; 19 use Illuminate\Database\QueryException;
20 use Illuminate\Support\Facades\DB; 20 use Illuminate\Support\Facades\DB;
  21 +use Illuminate\Support\Str;
21 22
22 /** 23 /**
23 * 测试 24 * 测试
@@ -57,65 +58,52 @@ class Test extends Command @@ -57,65 +58,52 @@ class Test extends Command
57 */ 58 */
58 public function handle() 59 public function handle()
59 { 60 {
60 - $projects = Project::all();  
61 - foreach ($projects as $project){  
62 - echo "project " . $project->id;  
63 -  
64 - if(!ProjectServer::useProject($project->id)){  
65 - echo '-->' . '未配置数据库' . PHP_EOL;  
66 - continue; 61 + $domains = DB::table('gl_customer_visit')->groupBy('domain')->select('domain')->pluck('domain')->toArray();
  62 + foreach($domains as $domain){
  63 + if(!Str::contains($domain, 'globalso.site')){
  64 + $this->sync($domain);
67 } 65 }
68 -  
69 - try {  
70 - $page = BCustomTemplate::where('url', '404')->first();  
71 - if(!$page){  
72 - $page = new BCustomTemplate();  
73 } 66 }
74 - $page->project_id = $project->id;  
75 - $page->name = '404';  
76 - $page->status = 1;  
77 - $page->url = '404';  
78 - $page->html = '<main>  
79 - <section data-section="section" data-screen="screen-large" class="section-404-wrap-block section-block-error404"  
80 - id="sectionIdyxqu938">  
81 - <div class="layout" data-unable="demo01-error404">  
82 - <img src="https://ecdn6.globalso.com/upload/m/image_other/2023-10/6528a87e594db30162.png" />  
83 - </div>  
84 - <p style="text-align: center">SORRY. THE PAGE HAS EITHER MOVED OR CANNOT BE FOUND.</p>  
85 - <style>  
86 - .section-block-error404 .layout {  
87 - height: 700px;  
88 - display: flex;  
89 - align-items: center;  
90 - justify-content: center;  
91 } 67 }
92 - .section-block-error404 img {  
93 - width: 400px; 68 +
  69 + public function sync($domain){
  70 + echo date('Y-m-d H:i:s') . "同步项目{$domain}" . PHP_EOL;
  71 + if(!Str::startsWith($domain,'www.')){
  72 + $domain = 'www.'.$domain;
94 } 73 }
95 - @media only screen and (max-width:500) {  
96 - .section-block-error404 img {  
97 - max-width: 100%; 74 + $project_id = DomainInfo::where('domain', $domain)->value('project_id');
  75 + if(!$project_id){
  76 + echo date('Y-m-d H:i:s') . "项目{$domain}不存在" . PHP_EOL;
  77 + return true;
98 } 78 }
  79 + if(!ProjectServer::useProject($project_id)){
  80 + echo date('Y-m-d H:i:s') . "项目{$domain}数据库配置无效" . PHP_EOL;
  81 + return true;
99 } 82 }
100 - </style>  
101 - <script>  
102 - </script>  
103 - </section>  
104 - </main>';  
105 - $page->html_style = '<style id="globalsojs-styles"></style>';  
106 - $page->description = 'Sorry. The page has either moved or cannot be found.';  
107 - $page->title = '404-Page not found';  
108 - $page->save(); 83 + $visit = 0;
  84 + $visit_item = 0;
  85 + $list = DB::table('gl_customer_visit')->whereIn('domain', [$domain, str_replace('www.','',$domain)])->get();
  86 + foreach ($list as $v){
  87 + $v = (array) $v;
  88 +
  89 + $items = DB::table('gl_customer_visit_item')->where('customer_visit_id', $v['id'])->get();
  90 +
  91 + unset($v['id']);
  92 + $id = DB::connection('custom_mysql')->table('gl_customer_visit')->insertGetId($v);
  93 +
  94 + $visit++;
109 95
110 - $domain = (new DomainInfo())->getDomain($project['deploy_optimize']['domain']);  
111 - $url = $domain.'api/delHtml/?project_id='.$project->id.'&route=404';  
112 - curlGet($url);  
113 - }catch (QueryException | \Exception $e){  
114 - echo '-->' . $e->getMessage() . PHP_EOL;  
115 - continue; 96 + $data = [];
  97 + foreach ($items as $item){
  98 + $item = (array) $item;
  99 + unset($item['id']);
  100 + $item['customer_visit_id'] = $id;
  101 + $data[] = $item;
  102 + $visit_item++;
116 } 103 }
117 - echo '-->成功:' . PHP_EOL; 104 + DB::connection('custom_mysql')->table('gl_customer_visit_item')->insert($data);
118 } 105 }
  106 + echo date('Y-m-d H:i:s') . "visit:{$visit};item:{$visit_item}" . PHP_EOL;exit;
119 } 107 }
120 108
121 } 109 }
1 -<?php  
2 -  
3 -namespace App\Helper;  
4 -  
5 -use App\Models\WebSetting\WebSettingCountry;  
6 -  
7 -/**  
8 - * @name:多语言国家设置  
9 - */  
10 -class Country  
11 -{  
12 - public $tls_list = [  
13 - 'en' => [  
14 - 'text' => '英语',  
15 - 'lang_text' => 'English',  
16 - 'con_flag' => 'con_flag/en.jfif',  
17 - 'shop_lang' => 'en-gb',  
18 - ],  
19 - 'zh' => [  
20 - 'text' => '中文',  
21 - 'lang_text' => '简体中文',  
22 - 'con_flag' => 'con_flag/zh.jfif',  
23 - 'shop_lang' => 'zh-cn',  
24 - ],  
25 - 'fr' => [  
26 - 'text' => '法语',  
27 - 'lang_text' => 'En français',  
28 - 'con_flag' => '',  
29 -  
30 - ],  
31 - 'de' => [  
32 - 'text' => '德语',  
33 - 'lang_text' => 'Das ist Deutsch.',  
34 - 'con_flag' => '',  
35 -  
36 - ],  
37 - 'ko' => [  
38 - 'text' => '韩语',  
39 - 'lang_text' => '',  
40 - 'con_flag' => '',  
41 -  
42 - ],  
43 - 'ja' => [  
44 - 'text' => '日语',  
45 - 'lang_text' => '',  
46 - 'con_flag' => '',  
47 -  
48 - ],  
49 - 'es' => [  
50 - 'text' => '西班牙语',  
51 - 'lang_text' => 'Español.',  
52 - 'con_flag' => '',  
53 -  
54 - ],  
55 - 'ar' => [  
56 - 'text' => '阿拉伯语',  
57 - 'lang_text' => '',  
58 - 'con_flag' => '',  
59 -  
60 - ],  
61 - 'pt' => [  
62 - 'text' => '葡萄牙语(葡萄牙、巴西)',  
63 - 'lang_text' => 'Língua portuguesa',  
64 - 'con_flag' => '',  
65 -  
66 - ],  
67 - 'ru' => [  
68 - 'text' => '俄语',  
69 - 'lang_text' => '',  
70 - 'con_flag' => '',  
71 -  
72 - ],  
73 - 'af' => [  
74 - 'text' => '南非荷兰语',  
75 - 'lang_text' => '',  
76 - 'con_flag' => '',  
77 -  
78 - ],  
79 - 'sq' => [  
80 - 'text' => '阿尔巴尼亚语',  
81 - 'lang_text' => '',  
82 - 'con_flag' => '',  
83 -  
84 - ],  
85 - 'am' => [  
86 - 'text' => '阿姆哈拉语',  
87 - 'lang_text' => '',  
88 - 'con_flag' => '',  
89 -  
90 - ],  
91 - 'hy' => [  
92 - 'text' => '亚美尼亚语',  
93 - 'lang_text' => '',  
94 - 'con_flag' => '',  
95 -  
96 - ],  
97 - 'az' => [  
98 - 'text' => '阿塞拜疆语',  
99 - 'lang_text' => '',  
100 - 'con_flag' => '',  
101 -  
102 - ],  
103 - 'eu' => [  
104 - 'text' => '巴斯克语',  
105 - 'lang_text' => '',  
106 - 'con_flag' => '',  
107 -  
108 - ],  
109 - 'be' => [  
110 - 'text' => '白俄罗斯语',  
111 - 'lang_text' => '',  
112 - 'con_flag' => '',  
113 -  
114 - ],  
115 - 'bn' => [  
116 - 'text' => '孟加拉语',  
117 - 'lang_text' => '',  
118 - 'con_flag' => '',  
119 -  
120 - ],  
121 - 'bs' => [  
122 - 'text' => '波斯尼亚语',  
123 - 'lang_text' => '',  
124 - 'con_flag' => '',  
125 -  
126 - ],  
127 - 'bg' => [  
128 - 'text' => '保加利亚语',  
129 - 'lang_text' => '',  
130 - 'con_flag' => '',  
131 -  
132 - ],  
133 - 'ca' => [  
134 - 'text' => '加泰罗尼亚语',  
135 - 'lang_text' => '',  
136 - 'con_flag' => '',  
137 -  
138 - ],  
139 - 'ceb' => [  
140 - 'text' => '宿务语',  
141 - 'lang_text' => '',  
142 - 'con_flag' => '',  
143 -  
144 - ],  
145 - 'cn' => [  
146 - 'text' => '中文(简体)',  
147 - 'lang_text' => '简体中文',  
148 - 'con_flag' => 'con_flag/zh.jfif',  
149 - 'shop_lang' => 'zh-cn',  
150 - ],  
151 - 'tw' => [  
152 - 'text' => '中文(繁体)',  
153 - 'lang_text' => '繁体中文',  
154 - 'con_flag' => 'con_flag/zh.jfif',  
155 -  
156 - ],  
157 - 'co' => [  
158 - 'text' => '科西嘉语',  
159 - 'lang_text' => '',  
160 - 'con_flag' => '',  
161 -  
162 - ],  
163 - 'hr' => [  
164 - 'text' => '克罗地亚语',  
165 - 'lang_text' => '',  
166 - 'con_flag' => '',  
167 -  
168 - ],  
169 - 'cs' => [  
170 - 'text' => '捷克语',  
171 - 'lang_text' => '',  
172 - 'con_flag' => '',  
173 -  
174 - ],  
175 - 'da' => [  
176 - 'text' => '丹麦语',  
177 - 'lang_text' => '',  
178 - 'con_flag' => '',  
179 -  
180 - ],  
181 - 'nl' => [  
182 - 'text' => '荷兰语',  
183 - 'lang_text' => '',  
184 - 'con_flag' => '',  
185 -  
186 - ],  
187 - 'eo' => [  
188 - 'text' => '世界语',  
189 - 'lang_text' => '',  
190 - 'con_flag' => '',  
191 -  
192 - ],  
193 - 'et' => [  
194 - 'text' => '爱沙尼亚语',  
195 - 'lang_text' => '',  
196 - 'con_flag' => '',  
197 -  
198 - ],  
199 - 'fi' => [  
200 - 'text' => '芬兰语',  
201 - 'lang_text' => '',  
202 - 'con_flag' => '',  
203 -  
204 - ],  
205 - 'fy' => [  
206 - 'text' => '弗里斯兰语',  
207 - 'lang_text' => '',  
208 - 'con_flag' => '',  
209 -  
210 - ],  
211 - 'gl' => [  
212 - 'text' => '加利西亚语',  
213 - 'lang_text' => '',  
214 - 'con_flag' => '',  
215 -  
216 - ],  
217 - 'ka' => [  
218 - 'text' => '格鲁吉亚语',  
219 - 'lang_text' => '',  
220 - 'con_flag' => '',  
221 -  
222 - ],  
223 - 'el' => [  
224 - 'text' => '希腊语',  
225 - 'lang_text' => '',  
226 - 'con_flag' => '',  
227 -  
228 - ],  
229 - 'gu' => [  
230 - 'text' => '古吉拉特语',  
231 - 'lang_text' => '',  
232 - 'con_flag' => '',  
233 -  
234 - ],  
235 - 'ht' => [  
236 - 'text' => '海地克里奥尔语',  
237 - 'lang_text' => '',  
238 - 'con_flag' => '',  
239 -  
240 - ],  
241 - 'ha' => [  
242 - 'text' => '豪萨语',  
243 - 'lang_text' => '',  
244 - 'con_flag' => '',  
245 -  
246 - ],  
247 - 'haw' => [  
248 - 'text' => '夏威夷语',  
249 - 'lang_text' => '',  
250 - 'con_flag' => '',  
251 -  
252 - ],  
253 - 'iw' => [  
254 - 'text' => '希伯来语',  
255 - 'lang_text' => '',  
256 - 'con_flag' => '',  
257 -  
258 - ],  
259 - 'hi' => [  
260 - 'text' => '印地语',  
261 - 'lang_text' => '',  
262 - 'con_flag' => '',  
263 -  
264 - ],  
265 - 'hmn' => [  
266 - 'text' => '苗语',  
267 - 'lang_text' => '',  
268 - 'con_flag' => '',  
269 -  
270 - ],  
271 - 'hu' => [  
272 - 'text' => '匈牙利语',  
273 - 'lang_text' => '',  
274 - 'con_flag' => '',  
275 -  
276 - ],  
277 - 'is' => [  
278 - 'text' => '冰岛语',  
279 - 'lang_text' => '',  
280 - 'con_flag' => '',  
281 -  
282 - ],  
283 - 'ig' => [  
284 - 'text' => '伊博语',  
285 - 'lang_text' => '',  
286 - 'con_flag' => '',  
287 -  
288 - ],  
289 - 'id' => [  
290 - 'text' => '印度尼西亚语',  
291 - 'lang_text' => 'Bahasa Indonesia',  
292 - 'con_flag' => 'con_flag/id.jfif',  
293 - 'shop_lang' => 'id',  
294 - ],  
295 - 'ga' => [  
296 - 'text' => '爱尔兰语',  
297 - 'lang_text' => '',  
298 - 'con_flag' => '',  
299 -  
300 - ],  
301 - 'it' => [  
302 - 'text' => '意大利语',  
303 - 'lang_text' => 'Lingua italiana',  
304 - 'con_flag' => '',  
305 -  
306 - ],  
307 - 'jw' => [  
308 - 'text' => '爪哇语',  
309 - 'lang_text' => '',  
310 - 'con_flag' => '',  
311 -  
312 - ],  
313 - 'kn' => [  
314 - 'text' => '卡纳达语',  
315 - 'lang_text' => '',  
316 - 'con_flag' => '',  
317 -  
318 - ],  
319 - 'kk' => [  
320 - 'text' => '哈萨克语',  
321 - 'lang_text' => '',  
322 - 'con_flag' => '',  
323 -  
324 - ],  
325 - 'km' => [  
326 - 'text' => '高棉语',  
327 - 'lang_text' => '',  
328 - 'con_flag' => '',  
329 -  
330 - ],  
331 - 'rw' => [  
332 - 'text' => '卢旺达语',  
333 - 'lang_text' => '',  
334 - 'con_flag' => '',  
335 -  
336 - ],  
337 - 'ku' => [  
338 - 'text' => '库尔德语',  
339 - 'lang_text' => '',  
340 - 'con_flag' => '',  
341 -  
342 - ],  
343 - 'ky' => [  
344 - 'text' => '吉尔吉斯语',  
345 - 'lang_text' => '',  
346 - 'con_flag' => '',  
347 -  
348 - ],  
349 - 'lo' => [  
350 - 'text' => '老挝文',  
351 - 'lang_text' => '',  
352 - 'con_flag' => '',  
353 -  
354 - ],  
355 - 'la' => [  
356 - 'text' => '拉丁文',  
357 - 'lang_text' => '',  
358 - 'con_flag' => '',  
359 -  
360 - ],  
361 - 'lv' => [  
362 - 'text' => '拉脱维亚语',  
363 - 'lang_text' => '',  
364 - 'con_flag' => '',  
365 -  
366 - ],  
367 - 'lt' => [  
368 - 'text' => '立陶宛语',  
369 - 'lang_text' => '',  
370 - 'con_flag' => '',  
371 -  
372 - ],  
373 - 'lb' => [  
374 - 'text' => '卢森堡语',  
375 - 'lang_text' => '',  
376 - 'con_flag' => '',  
377 -  
378 - ],  
379 - 'mk' => [  
380 - 'text' => '马其顿语',  
381 - 'lang_text' => '',  
382 - 'con_flag' => '',  
383 -  
384 - ],  
385 - 'mg' => [  
386 - 'text' => '马尔加什语',  
387 - 'lang_text' => '',  
388 - 'con_flag' => '',  
389 -  
390 - ],  
391 - 'ms' => [  
392 - 'text' => '马来语',  
393 - 'lang_text' => 'Bahasa Melayu',  
394 - 'con_flag' => 'con_flag/ms.jfif',  
395 - 'shop_lang' => 'ms-my',  
396 - ],  
397 - 'ml' => [  
398 - 'text' => '马拉雅拉姆文',  
399 - 'lang_text' => '',  
400 - 'con_flag' => '',  
401 -  
402 - ],  
403 - 'mt' => [  
404 - 'text' => '马耳他语',  
405 - 'lang_text' => '',  
406 - 'con_flag' => '',  
407 -  
408 - ],  
409 - 'mi' => [  
410 - 'text' => '毛利语',  
411 - 'lang_text' => '',  
412 - 'con_flag' => '',  
413 -  
414 - ],  
415 - 'mr' => [  
416 - 'text' => '马拉地语',  
417 - 'lang_text' => '',  
418 - 'con_flag' => '',  
419 -  
420 - ],  
421 - 'mn' => [  
422 - 'text' => '蒙古文',  
423 - 'lang_text' => '',  
424 - 'con_flag' => '',  
425 -  
426 - ],  
427 - 'my' => [  
428 - 'text' => '缅甸语',  
429 - 'lang_text' => '',  
430 - 'con_flag' => '',  
431 -  
432 - ],  
433 - 'ne' => [  
434 - 'text' => '尼泊尔语',  
435 - 'lang_text' => '',  
436 - 'con_flag' => '',  
437 -  
438 - ],  
439 - 'no' => [  
440 - 'text' => '挪威语',  
441 - 'lang_text' => '',  
442 - 'con_flag' => '',  
443 -  
444 - ],  
445 - 'ny' => [  
446 - 'text' => '尼杨扎语(齐切瓦语)',  
447 - 'lang_text' => '',  
448 - 'con_flag' => '',  
449 -  
450 - ],  
451 - 'or' => [  
452 - 'text' => '奥里亚语(奥里亚)',  
453 - 'lang_text' => '',  
454 - 'con_flag' => '',  
455 -  
456 - ],  
457 - 'ps' => [  
458 - 'text' => '普什图语',  
459 - 'lang_text' => '',  
460 - 'con_flag' => '',  
461 -  
462 - ],  
463 - 'fa' => [  
464 - 'text' => '波斯语',  
465 - 'lang_text' => '',  
466 - 'con_flag' => '',  
467 -  
468 - ],  
469 - 'pl' => [  
470 - 'text' => '波兰语',  
471 - 'lang_text' => '',  
472 - 'con_flag' => '',  
473 -  
474 - ],  
475 - 'pa' => [  
476 - 'text' => '旁遮普语',  
477 - 'lang_text' => '',  
478 - 'con_flag' => '',  
479 -  
480 - ],  
481 - 'ro' => [  
482 - 'text' => '罗马尼亚语',  
483 - 'lang_text' => '',  
484 - 'con_flag' => '',  
485 -  
486 - ],  
487 - 'sm' => [  
488 - 'text' => '萨摩亚语',  
489 - 'lang_text' => '',  
490 - 'con_flag' => '',  
491 -  
492 - ],  
493 - 'gd' => [  
494 - 'text' => '苏格兰盖尔语',  
495 - 'lang_text' => '',  
496 - 'con_flag' => '',  
497 -  
498 - ],  
499 - 'sr' => [  
500 - 'text' => '塞尔维亚语',  
501 - 'lang_text' => '',  
502 - 'con_flag' => '',  
503 -  
504 - ],  
505 - 'st' => [  
506 - 'text' => '塞索托语',  
507 - 'lang_text' => '',  
508 - 'con_flag' => '',  
509 -  
510 - ],  
511 - 'sn' => [  
512 - 'text' => '修纳语',  
513 - 'lang_text' => '',  
514 - 'con_flag' => '',  
515 -  
516 - ],  
517 - 'sd' => [  
518 - 'text' => '信德语',  
519 - 'lang_text' => '',  
520 - 'con_flag' => '',  
521 -  
522 - ],  
523 - 'si' => [  
524 - 'text' => '僧伽罗语',  
525 - 'lang_text' => '',  
526 - 'con_flag' => '',  
527 -  
528 - ],  
529 - 'sk' => [  
530 - 'text' => '斯洛伐克语',  
531 - 'lang_text' => '',  
532 - 'con_flag' => '',  
533 -  
534 - ],  
535 - 'sl' => [  
536 - 'text' => '斯洛文尼亚语',  
537 - 'lang_text' => '',  
538 - 'con_flag' => '',  
539 -  
540 - ],  
541 - 'so' => [  
542 - 'text' => '索马里语',  
543 - 'lang_text' => '',  
544 - 'con_flag' => '',  
545 -  
546 - ],  
547 - 'su' => [  
548 - 'text' => '巽他语',  
549 - 'lang_text' => '',  
550 - 'con_flag' => '',  
551 -  
552 - ],  
553 - 'sw' => [  
554 - 'text' => '斯瓦希里语',  
555 - 'lang_text' => '',  
556 - 'con_flag' => '',  
557 -  
558 - ],  
559 - 'sv' => [  
560 - 'text' => '瑞典语',  
561 - 'lang_text' => '',  
562 - 'con_flag' => '',  
563 -  
564 - ],  
565 - 'tl' => [  
566 - 'text' => '塔加路语(菲律宾语)',  
567 - 'lang_text' => 'Pilipino',  
568 - 'con_flag' => 'con_flag/tl.jfif',  
569 - 'shop_lang' => 'tl',  
570 - ],  
571 - 'tg' => [  
572 - 'text' => '塔吉克语',  
573 - 'lang_text' => '',  
574 - 'con_flag' => '',  
575 -  
576 - ],  
577 - 'ta' => [  
578 - 'text' => '泰米尔语',  
579 - 'lang_text' => '',  
580 - 'con_flag' => '',  
581 -  
582 - ],  
583 - 'tt' => [  
584 - 'text' => '鞑靼语',  
585 - 'lang_text' => '',  
586 - 'con_flag' => '',  
587 -  
588 - ],  
589 - 'te' => [  
590 - 'text' => '泰卢固语',  
591 - 'lang_text' => '',  
592 - 'con_flag' => '',  
593 -  
594 - ],  
595 - 'th' => [  
596 - 'text' => '泰文',  
597 - 'lang_text' => 'ไทย',  
598 - 'con_flag' => 'con_flag/th.jfif',  
599 - 'shop_lang' => 'th',  
600 - ],  
601 - 'tr' => [  
602 - 'text' => '土耳其语',  
603 - 'lang_text' => '',  
604 - 'con_flag' => '',  
605 -  
606 - ],  
607 - 'tk' => [  
608 - 'text' => '土库曼语',  
609 - 'lang_text' => '',  
610 - 'con_flag' => '',  
611 -  
612 - ],  
613 - 'uk' => [  
614 - 'text' => '乌克兰语',  
615 - 'lang_text' => '',  
616 - 'con_flag' => '',  
617 -  
618 - ],  
619 - 'ur' => [  
620 - 'text' => '乌尔都语',  
621 - 'lang_text' => '',  
622 - 'con_flag' => '',  
623 -  
624 - ],  
625 - 'ug' => [  
626 - 'text' => '维吾尔语',  
627 - 'lang_text' => '',  
628 - 'con_flag' => '',  
629 -  
630 - ],  
631 - 'uz' => [  
632 - 'text' => '乌兹别克语',  
633 - 'lang_text' => '',  
634 - 'con_flag' => '',  
635 -  
636 - ],  
637 - 'vi' => [  
638 - 'text' => '越南语',  
639 - 'lang_text' => '',  
640 - 'con_flag' => '',  
641 -  
642 - ],  
643 - 'cy' => [  
644 - 'text' => '威尔士语',  
645 - 'lang_text' => '',  
646 - 'con_flag' => '',  
647 -  
648 - ],  
649 - 'xh' => [  
650 - 'text' => '班图语',  
651 - 'lang_text' => '',  
652 - 'con_flag' => '',  
653 -  
654 - ],  
655 - 'yi' => [  
656 - 'text' => '意第绪语',  
657 - 'lang_text' => '',  
658 - 'con_flag' => '',  
659 -  
660 - ],  
661 - 'yo' => [  
662 - 'text' => '约鲁巴语',  
663 - 'lang_text' => '',  
664 - 'con_flag' => '',  
665 -  
666 - ],  
667 - 'zu' => [  
668 - 'text' => '祖鲁语',  
669 - 'lang_text' => '',  
670 - 'con_flag' => '',  
671 - ],  
672 - ];  
673 -  
674 - /**  
675 - * @name :(获取翻译国家)set_country  
676 - * @author :lyh  
677 - * @method :post  
678 - * @time :2023/5/4 17:57  
679 - */  
680 - public function set_country(){  
681 - $data = [];  
682 - foreach ($this->tls_list as $k=>$v){  
683 - $data[] = ['name'=>$v['text'],'alias'=>$k,'image'=>$k.'.png','con_flag'=>$v['con_flag'],'lang_text'=>$v['lang_text']];  
684 - }  
685 - $webCountry = new WebSettingCountry();  
686 - $webCountry->insert($data);  
687 - return true;  
688 - }  
689 -}  
@@ -123,6 +123,8 @@ class ProjectController extends BaseController @@ -123,6 +123,8 @@ class ProjectController extends BaseController
123 public function searchUpgrade(&$query){ 123 public function searchUpgrade(&$query){
124 if(isset($this->map['is_upgrade'])){ 124 if(isset($this->map['is_upgrade'])){
125 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']); 125 $query->where('gl_project.is_upgrade', $this->map['is_upgrade']);
  126 + }else{
  127 + $query->where('gl_project.is_upgrade', 0);
126 } 128 }
127 return $query; 129 return $query;
128 } 130 }
@@ -11,15 +11,14 @@ namespace App\Http\Controllers\Bside\BCom; @@ -11,15 +11,14 @@ namespace App\Http\Controllers\Bside\BCom;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 -use App\Http\Logic\Bside\Setting\WebSettingLogic;  
15 use App\Models\Com\UpdateNotify; 14 use App\Models\Com\UpdateNotify;
16 use App\Models\Com\UpdateProgress; 15 use App\Models\Com\UpdateProgress;
17 use App\Models\Project\Country as CountryModel; 16 use App\Models\Project\Country as CountryModel;
18 use App\Models\Project\Project; 17 use App\Models\Project\Project;
19 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
20 -use App\Models\WebSetting\WebSettingCountry; 19 +use App\Models\WebSetting\WebLanguage;
21 use Illuminate\Http\Request; 20 use Illuminate\Http\Request;
22 -use Illuminate\Support\Facades\Redis; 21 +
23 22
24 /** 23 /**
25 * @remark :通知C端 24 * @remark :通知C端
@@ -186,13 +185,8 @@ class CNoticeController extends BaseController @@ -186,13 +185,8 @@ class CNoticeController extends BaseController
186 if($info !== false){ 185 if($info !== false){
187 $ids = explode(',',$info['country_lists']); 186 $ids = explode(',',$info['country_lists']);
188 } 187 }
189 - $webSettingCountryModel = new WebSettingCountry();  
190 - $lists = $webSettingCountryModel->list(['id'=>['in',$ids]],'id',['id','name','country_img']);  
191 - if (!empty($lists)){  
192 - foreach ($lists as $k => $v){  
193 - $lists[$k]['image_link'] = url('upload/country/' . $v['country_img']);  
194 - }  
195 - } 188 + $languageModel = new WebLanguage();
  189 + $lists = $languageModel->list(['id'=>['in',$ids]]);
196 $this->response('success',Code::SUCCESS,$lists); 190 $this->response('success',Code::SUCCESS,$lists);
197 } 191 }
198 192
1 <?php 1 <?php
  2 +/**
  3 + * @remark :
  4 + * @name :LanguageController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2023/11/30 11:21
  8 + */
2 9
3 namespace App\Http\Controllers\Bside\Setting; 10 namespace App\Http\Controllers\Bside\Setting;
4 11
5 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
7 -use App\Http\Logic\Bside\Setting\WebSettingCountryLogic;  
8 -use App\Models\Project\Country as CountryModel; 14 +use App\Models\WebSetting\WebLanguage;
9 15
10 -/**  
11 - * @name:多语言国家配置列  
12 - */  
13 -class WebSettingCountryController extends BaseController 16 +class LanguageController extends BaseController
14 { 17 {
15 /** 18 /**
16 - * @name :列表lists 19 + * @remark :获取小语种列表
  20 + * @name :lists
17 * @author :lyh 21 * @author :lyh
18 * @method :post 22 * @method :post
19 - * @time :2023/4/28 14:40 23 + * @time :2023/11/30 10:59
20 */ 24 */
21 - public function lists(WebSettingCountryLogic $webSettingCountryLogic){  
22 - $lists = $webSettingCountryLogic->country_list(); 25 + public function lists(){
  26 + $webLanguageModel = new WebLanguage();
  27 + $lists = $webLanguageModel->list();
23 $this->response('success',Code::SUCCESS,$lists); 28 $this->response('success',Code::SUCCESS,$lists);
24 } 29 }
25 } 30 }
@@ -5,9 +5,8 @@ namespace App\Http\Controllers\Bside\Setting; @@ -5,9 +5,8 @@ namespace App\Http\Controllers\Bside\Setting;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Helper\Translate; 6 use App\Helper\Translate;
7 use App\Http\Controllers\Bside\BaseController; 7 use App\Http\Controllers\Bside\BaseController;
8 -use App\Http\Logic\Bside\Setting\ProofreadingLogic;  
9 use App\Models\WebSetting\Proofreading; 8 use App\Models\WebSetting\Proofreading;
10 -use App\Models\WebSetting\WebSettingCountry; 9 +use App\Models\WebSetting\WebLanguage;
11 use Illuminate\Support\Facades\DB; 10 use Illuminate\Support\Facades\DB;
12 11
13 class ProofreadingController extends BaseController 12 class ProofreadingController extends BaseController
@@ -22,8 +21,8 @@ class ProofreadingController extends BaseController @@ -22,8 +21,8 @@ class ProofreadingController extends BaseController
22 */ 21 */
23 public function lists(){ 22 public function lists(){
24 //获取语种信息 23 //获取语种信息
25 - $webSettingCountryModel = new WebSettingCountry();  
26 - $countryInfo = $webSettingCountryModel->read(['id'=>$this->param['language_id']]); 24 + $languageModel = new WebLanguage();
  25 + $languageInfo = $languageModel->read(['id'=>$this->param['language_id']]);
27 //获取当前链接和语种的校队列表 26 //获取当前链接和语种的校队列表
28 $proofreadingModel = new Proofreading(); 27 $proofreadingModel = new Proofreading();
29 $list = $proofreadingModel->list(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>1],'created_at',['text','translate']); 28 $list = $proofreadingModel->list(['url'=>$this->param['url'],'language_id'=>$this->param['language_id'],'type'=>1],'created_at',['text','translate']);
@@ -31,7 +30,7 @@ class ProofreadingController extends BaseController @@ -31,7 +30,7 @@ class ProofreadingController extends BaseController
31 $new_list = $this->getUrlRead($this->param['url']); 30 $new_list = $this->getUrlRead($this->param['url']);
32 if(empty($list)){ 31 if(empty($list)){
33 $data = []; 32 $data = [];
34 - $translate_list = Translate::tran($new_list, $countryInfo['alias']); 33 + $translate_list = Translate::tran($new_list, $languageInfo['short']);
35 foreach ($new_list as $k=>$v){ 34 foreach ($new_list as $k=>$v){
36 $data[] = [ 35 $data[] = [
37 'text'=>trim($v), 36 'text'=>trim($v),
@@ -51,7 +50,7 @@ class ProofreadingController extends BaseController @@ -51,7 +50,7 @@ class ProofreadingController extends BaseController
51 } 50 }
52 $arr2 = array_values(array_diff($new_list, $old_list)); 51 $arr2 = array_values(array_diff($new_list, $old_list));
53 if(!empty($arr2)){ 52 if(!empty($arr2)){
54 - $translate_list = Translate::tran($arr2, $countryInfo['alias']); 53 + $translate_list = Translate::tran($arr2, $languageInfo['alias']);
55 foreach ($arr2 as $k1=>$v1){ 54 foreach ($arr2 as $k1=>$v1){
56 $data[] = [ 55 $data[] = [
57 'text'=>$v1, 56 'text'=>$v1,
@@ -179,17 +178,6 @@ class ProofreadingController extends BaseController @@ -179,17 +178,6 @@ class ProofreadingController extends BaseController
179 } 178 }
180 179
181 /** 180 /**
182 - * @name :(当前项目选中的语言列表)languageList  
183 - * @author :lyh  
184 - * @method :post  
185 - * @time :2023/6/12 15:52  
186 - */  
187 - public function languageList(ProofreadingLogic $proofreadingLogic){  
188 - $list = $proofreadingLogic->countryLanguageList($this->map,$this->order);  
189 - $this->response('success',Code::SUCCESS,$list);  
190 - }  
191 -  
192 - /**  
193 * @remark :获取Url内容 181 * @remark :获取Url内容
194 * @name :getUrlRead 182 * @name :getUrlRead
195 * @author :lyh 183 * @author :lyh
@@ -19,17 +19,6 @@ class WebSettingHtmlController extends BaseController @@ -19,17 +19,6 @@ class WebSettingHtmlController extends BaseController
19 * @time :2023/4/28 14:45 19 * @time :2023/4/28 14:45
20 */ 20 */
21 public function save(WebSettingHtmlLogic $webSettingHtmlLogic){ 21 public function save(WebSettingHtmlLogic $webSettingHtmlLogic){
22 - if(isset($this->param) && !empty($this->param)){  
23 - $this->request->validate([  
24 - 'head_html'=>'required',  
25 - 'body_html'=>'required',  
26 - 'footer_html'=>'required'  
27 - ],[  
28 - 'head_html.required' => 'head_html不能为空',  
29 - 'body_html.required' => 'body_html不能为空',  
30 - 'footer_html.required' => 'footer_html不能为空'  
31 - ]);  
32 - }  
33 $info = $webSettingHtmlLogic->setting_html_save(); 22 $info = $webSettingHtmlLogic->setting_html_save();
34 $this->response('success',Code::SUCCESS,$info); 23 $this->response('success',Code::SUCCESS,$info);
35 } 24 }
@@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic @@ -69,10 +69,12 @@ class OnlineCheckLogic extends BaseLogic
69 */ 69 */
70 public function saveOnlineCheck(){ 70 public function saveOnlineCheck(){
71 $info = $this->model->read(['project_id'=>$this->param['id']]); 71 $info = $this->model->read(['project_id'=>$this->param['id']]);
72 - $projectModel = new Project();  
73 if($info !== false){ 72 if($info !== false){
74 $this->fail('已提交,请勿重复提交'); 73 $this->fail('已提交,请勿重复提交');
75 }else{ 74 }else{
  75 + $projectModel = new Project();
  76 + //提交审核修改状态为审核中
  77 + $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);
76 //组装数据 78 //组装数据
77 $data = [ 79 $data = [
78 'project_id' => $this->param['id'], 80 'project_id' => $this->param['id'],
@@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic @@ -85,8 +87,6 @@ class OnlineCheckLogic extends BaseLogic
85 if($rs === false){ 87 if($rs === false){
86 $this->fail('error'); 88 $this->fail('error');
87 } 89 }
88 - //提交审核修改状态为审核中  
89 - $projectModel->edit(['status'=>$projectModel::STATUS_ONE],['id'=>$this->param['id']]);  
90 } 90 }
91 return $this->success(); 91 return $this->success();
92 } 92 }
@@ -378,8 +378,8 @@ class BTemplateLogic extends BaseLogic @@ -378,8 +378,8 @@ class BTemplateLogic extends BaseLogic
378 $route = 'all'; 378 $route = 'all';
379 } 379 }
380 } 380 }
381 - return $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route]);  
382 - return $this->success(); 381 + $this->addUpdateNotify($type,$route);
  382 + return $this->curlDelRoute($route);
383 } 383 }
384 384
385 /** 385 /**
@@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic @@ -66,8 +66,8 @@ class CustomTemplateLogic extends BaseLogic
66 try { 66 try {
67 $this->param['url'] = str_replace_url($this->param['url']); 67 $this->param['url'] = str_replace_url($this->param['url']);
68 if(isset($this->param['id']) && !empty($this->param['id'])){ 68 if(isset($this->param['id']) && !empty($this->param['id'])){
69 - $id = $this->param['id'];  
70 - $this->param['url'] = $this->editCustomRoute($this->param['url']); 69 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $this->param['id'], $this->user['project_id']);
  70 + $this->editCustomRoute($this->param['url']);
71 $this->model->edit($this->param,['id'=>$this->param['id']]); 71 $this->model->edit($this->param,['id'=>$this->param['id']]);
72 }else{ 72 }else{
73 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){ 73 if($this->param['url'] == $this->model::NOT_FOUND_PAGE_URL){
@@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic @@ -75,9 +75,10 @@ class CustomTemplateLogic extends BaseLogic
75 } 75 }
76 $this->param['project_id'] = $this->user['project_id']; 76 $this->param['project_id'] = $this->user['project_id'];
77 $id = $this->model->addReturnId($this->param); 77 $id = $this->model->addReturnId($this->param);
78 - }  
79 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 78 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
  79 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
80 $this->model->edit(['url'=>$route],['id'=>$id]); 80 $this->model->edit(['url'=>$route],['id'=>$id]);
  81 + }
81 }catch (\Exception $e){ 82 }catch (\Exception $e){
82 $this->fail('error'); 83 $this->fail('error');
83 } 84 }
@@ -110,8 +111,9 @@ class CustomTemplateLogic extends BaseLogic @@ -110,8 +111,9 @@ class CustomTemplateLogic extends BaseLogic
110 if($rs === false){ 111 if($rs === false){
111 $this->fail('系统错误,请联系管理'); 112 $this->fail('系统错误,请联系管理');
112 } 113 }
113 - $data = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PAGE, 'route'=>$info['url']];  
114 - $this->updateNotify($data); 114 + //通知
  115 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$info['url']);
  116 + $this->curlDelRoute($info['url']);
115 return $this->success(); 117 return $this->success();
116 } 118 }
117 119
@@ -210,14 +212,10 @@ class CustomTemplateLogic extends BaseLogic @@ -210,14 +212,10 @@ class CustomTemplateLogic extends BaseLogic
210 $this->fail('404页面链接不可修改'); 212 $this->fail('404页面链接不可修改');
211 } 213 }
212 if($info['url'] != $route){ 214 if($info['url'] != $route){
213 - //生成一条删除路由记录  
214 - $data = [  
215 - 'source'=>RouteMap::SOURCE_PAGE,  
216 - 'route'=>$info['url'],  
217 - ];  
218 - $this->setRouteDeleteSave($data); 215 + $this->addUpdateNotify(RouteMap::SOURCE_PAGE,$route);
  216 + $this->curlDelRoute($info['url']);
219 } 217 }
220 - return $route; 218 + return true;
221 } 219 }
222 220
223 /** 221 /**
@@ -261,11 +259,7 @@ class CustomTemplateLogic extends BaseLogic @@ -261,11 +259,7 @@ class CustomTemplateLogic extends BaseLogic
261 RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']); 259 RouteMap::delRoute(RouteMap::SOURCE_PAGE, $id, $this->user['project_id']);
262 //生成一条删除路由记录 260 //生成一条删除路由记录
263 $info = $this->model->read(['id' => $id], ['id', 'url']); 261 $info = $this->model->read(['id' => $id], ['id', 'url']);
264 - $data = [  
265 - 'source' => RouteMap::SOURCE_NEWS,  
266 - 'route' => $info['url'],  
267 - ];  
268 - $this->setRouteDeleteSave($data); 262 + $this->curlDelRoute($info['url']);
269 return $this->success(); 263 return $this->success();
270 } 264 }
271 265
@@ -142,49 +142,36 @@ class BaseLogic extends Logic @@ -142,49 +142,36 @@ class BaseLogic extends Logic
142 } 142 }
143 143
144 /** 144 /**
145 - * @name :(通知更新)projectUrl 145 + * @name :生成一条新路由记录
146 * @author :lyh 146 * @author :lyh
147 * @method :post 147 * @method :post
148 * @time :2023/6/6 14:09 148 * @time :2023/6/6 14:09
149 */ 149 */
150 - function updateNotify($data) 150 + public function addUpdateNotify($type,$route)
151 { 151 {
152 $updateNotifyModel = new UpdateNotify(); 152 $updateNotifyModel = new UpdateNotify();
153 - if($data['route'] != 'all'){  
154 - $info = $updateNotifyModel->read(['project_id'=>$data['project_id'],'route'=>$data['route'],'status'=>1]); 153 + $info = $updateNotifyModel->read(['project_id'=>$this->user['project_id'],'route'=>$route,'status'=>1]);
155 if($info === false){ 154 if($info === false){
156 $param = [ 155 $param = [
157 - 'project_id'=>$data['project_id'],  
158 - 'type'=>$data['type'],  
159 - 'route'=>$data['route'], 156 + 'project_id'=>$this->user['project_id'], 'type'=>$type, 'route'=>$route,'status'=>1
160 ]; 157 ];
161 $updateNotifyModel->add($param); 158 $updateNotifyModel->add($param);
162 - }  
163 - //单页面直接通知更新  
164 - $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$data['route'];  
165 }else{ 159 }else{
166 - $url = $this->user['domain'].'api/webInfo/?type=clear_website'; 160 + $updateNotifyModel->edit(['route'=>$route],['project_id'=>$this->user['project_id'],'type'=>$type,'status'=>1]);
167 } 161 }
168 - curlGet($url);  
169 return $this->success(); 162 return $this->success();
170 } 163 }
171 164
172 /** 165 /**
173 - * @remark :删除和编辑路由时生成一条记录  
174 - * @name :setRouteDeleteSave 166 + * @remark :删除路由通知C端
  167 + * @name :curlDelRoute
175 * @author :lyh 168 * @author :lyh
176 * @method :post 169 * @method :post
177 - * @time :2023/9/7 9:38 170 + * @time :2023/11/30 14:43
178 */ 171 */
179 - public function setRouteDeleteSave($param){  
180 - $routeDeleteModel = new RouteDelete();  
181 - $data = [  
182 - 'project_id'=>$this->user['project_id'],  
183 - 'source'=>$param['source'],  
184 - 'created_at'=>date('Y-m-d H:i:s'),  
185 - 'route'=>$param['route'],  
186 - ];  
187 - $routeDeleteModel->insert($data); 172 + public function curlDelRoute($route){
  173 + $url = $this->user['domain'].'api/delHtml/?project_id='.$this->user['project_id'].'&route='.$route;
  174 + curlGet($url);
188 return $this->success(); 175 return $this->success();
189 } 176 }
190 } 177 }
@@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic @@ -32,8 +32,7 @@ class BlogCategoryLogic extends BaseLogic
32 DB::beginTransaction(); 32 DB::beginTransaction();
33 try { 33 try {
34 if(isset($this->param['id']) && !empty($this->param['id'])){ 34 if(isset($this->param['id']) && !empty($this->param['id'])){
35 - //查看路由是否更新  
36 - $id = $this->param['id']; 35 + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $this->param['id'], $this->user['project_id']);
37 $this->editCategoryRoute($this->param['id'], $this->param['alias']); 36 $this->editCategoryRoute($this->param['id'], $this->param['alias']);
38 $this->editHandleCategory($this->param['id'],$this->param['pid']); 37 $this->editHandleCategory($this->param['id'],$this->param['pid']);
39 $this->param['operator_id'] = $this->user['id']; 38 $this->param['operator_id'] = $this->user['id'];
@@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic @@ -46,18 +45,17 @@ class BlogCategoryLogic extends BaseLogic
46 //拼接参数 45 //拼接参数
47 $this->param = $this->addParamProcessing($this->param); 46 $this->param = $this->addParamProcessing($this->param);
48 $id = $this->model->addReturnId($this->param); 47 $id = $this->model->addReturnId($this->param);
  48 + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
  49 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
  50 + $this->edit(['alias'=>$route],['id'=>$id]);
49 //处理子集 51 //处理子集
50 $this->addProcessingSon($id); 52 $this->addProcessingSon($id);
51 } 53 }
52 - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);  
53 - $this->edit(['alias'=>$route],['id'=>$id]);  
54 DB::commit(); 54 DB::commit();
55 }catch (\Exception $e){ 55 }catch (\Exception $e){
56 DB::rollBack(); 56 DB::rollBack();
57 $this->fail('系统错误,请联系管理'); 57 $this->fail('系统错误,请联系管理');
58 } 58 }
59 - //通知更新  
60 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG_CATE, 'route'=>$route]);  
61 return $this->success(); 59 return $this->success();
62 } 60 }
63 61
@@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic @@ -114,11 +112,8 @@ class BlogCategoryLogic extends BaseLogic
114 //生成一条删除路由记录 112 //生成一条删除路由记录
115 $info = $this->model->read(['id'=>$id],['id','alias']); 113 $info = $this->model->read(['id'=>$id],['id','alias']);
116 if($info['alias'] != $route){ 114 if($info['alias'] != $route){
117 - $data = [  
118 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
119 - 'route'=>$info['alias'],  
120 - ];  
121 - $this->setRouteDeleteSave($data); 115 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG_CATE,$route);
  116 + $this->curlDelRoute($info['alias']);
122 } 117 }
123 return true; 118 return true;
124 } 119 }
@@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic @@ -311,11 +306,7 @@ class BlogCategoryLogic extends BaseLogic
311 RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']); 306 RouteMap::delRoute(RouteMap::SOURCE_BLOG_CATE, $id, $this->user['project_id']);
312 //生成一条删除路由记录 307 //生成一条删除路由记录
313 $info = $this->model->read(['id'=>$id],['id','alias']); 308 $info = $this->model->read(['id'=>$id],['id','alias']);
314 - $data = [  
315 - 'source'=>RouteMap::SOURCE_BLOG_CATE,  
316 - 'route'=>$info['alias'],  
317 - ];  
318 - $this->setRouteDeleteSave($data); 309 + $this->curlDelRoute($info['alias']);
319 return $this->success(); 310 return $this->success();
320 } 311 }
321 312
@@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic @@ -331,27 +322,22 @@ class BlogCategoryLogic extends BaseLogic
331 */ 322 */
332 public function importBlogCategory($project_id,$user_id,$category){ 323 public function importBlogCategory($project_id,$user_id,$category){
333 $return = []; 324 $return = [];
334 -  
335 $cate_arr = explode('/',$category); 325 $cate_arr = explode('/',$category);
336 -  
337 $pid = 0; 326 $pid = 0;
338 foreach ($cate_arr as $v){ 327 foreach ($cate_arr as $v){
339 if($v){ 328 if($v){
340 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); 329 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
341 if(!$category_info){ 330 if(!$category_info){
342 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); 331 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
343 -  
344 $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id); 332 $route = RouteMap::setRoute($v, RouteMap::SOURCE_BLOG_CATE, $id, $project_id);
345 $this->model->edit(['alias'=>$route],['id'=>$id]); 333 $this->model->edit(['alias'=>$route],['id'=>$id]);
346 }else{ 334 }else{
347 $id = $category_info['id']; 335 $id = $category_info['id'];
348 } 336 }
349 -  
350 $return[] = $id; 337 $return[] = $id;
351 $pid = $id; 338 $pid = $id;
352 } 339 }
353 } 340 }
354 -  
355 return $this->getLastCategory($return); 341 return $this->getLastCategory($return);
356 } 342 }
357 343
@@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic @@ -34,22 +34,20 @@ class BlogLogic extends BaseLogic
34 try { 34 try {
35 $this->param = $this->paramProcessing($this->param); 35 $this->param = $this->paramProcessing($this->param);
36 if(isset($this->param['id']) && !empty($this->param['id'])){ 36 if(isset($this->param['id']) && !empty($this->param['id'])){
37 - //是否更新路由  
38 - $id = $this->param['id']; 37 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $this->param['id'], $this->user['project_id']);
39 $this->editNewsRoute($this->param['id'],$this->param['url']); 38 $this->editNewsRoute($this->param['id'],$this->param['url']);
40 $this->edit($this->param,['id'=>$this->param['id']]); 39 $this->edit($this->param,['id'=>$this->param['id']]);
41 }else{ 40 }else{
42 $id = $this->model->addReturnId($this->param); 41 $id = $this->model->addReturnId($this->param);
43 - }  
44 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 42 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
  43 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
45 $this->edit(['url'=>$route],['id'=>$id]); 44 $this->edit(['url'=>$route],['id'=>$id]);
  45 + }
46 DB::commit(); 46 DB::commit();
47 }catch (\Exception $e){ 47 }catch (\Exception $e){
48 DB::rollBack(); 48 DB::rollBack();
49 $this->fail('error'); 49 $this->fail('error');
50 } 50 }
51 - //通知更新  
52 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_BLOG, 'route'=>$route]);  
53 return $this->success(); 51 return $this->success();
54 } 52 }
55 53
@@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic @@ -64,11 +62,8 @@ class BlogLogic extends BaseLogic
64 //生成一条删除路由记录 62 //生成一条删除路由记录
65 $info = $this->model->read(['id'=>$id],['id','url']); 63 $info = $this->model->read(['id'=>$id],['id','url']);
66 if($info['url'] != $route){ 64 if($info['url'] != $route){
67 - $data = [  
68 - 'source'=>RouteMap::SOURCE_BLOG,  
69 - 'route'=>$info['url'],  
70 - ];  
71 - $this->setRouteDeleteSave($data); 65 + $this->addUpdateNotify(RouteMap::SOURCE_BLOG,$route);
  66 + $this->curlDelRoute($info['url']);
72 } 67 }
73 return true; 68 return true;
74 } 69 }
@@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic @@ -90,10 +85,11 @@ class BlogLogic extends BaseLogic
90 85
91 86
92 /** 87 /**
93 - * @name :获取数据详情  
94 - * @return array  
95 - * @author :liyuhang  
96 - * @method 88 + * @remark :获取数据详情
  89 + * @name :blogInfo
  90 + * @author :lyh
  91 + * @method :post
  92 + * @time :2023/11/30 15:17
97 */ 93 */
98 public function blogInfo(){ 94 public function blogInfo(){
99 $info = $this->model->read($this->param); 95 $info = $this->model->read($this->param);
@@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic @@ -110,11 +106,11 @@ class BlogLogic extends BaseLogic
110 106
111 107
112 /** 108 /**
113 - * @name :修改状态  
114 - * @return array  
115 - * @throws \App\Exceptions\BsideGlobalException  
116 - * @author :liyuhang  
117 - * @method 109 + * @remark :修改状态
  110 + * @name :blogStatus
  111 + * @author :lyh
  112 + * @method :post
  113 + * @time :2023/11/30 15:16
118 */ 114 */
119 public function blogStatus(){ 115 public function blogStatus(){
120 $this->param['operator_id'] = $this->user['id']; 116 $this->param['operator_id'] = $this->user['id'];
@@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic @@ -126,10 +122,11 @@ class BlogLogic extends BaseLogic
126 } 122 }
127 123
128 /** 124 /**
129 - * @name :删除  
130 - * @return void  
131 - * @author :liyuhang  
132 - * @method 125 + * @remark :删除
  126 + * @name :blogDel
  127 + * @author :lyh
  128 + * @method :post
  129 + * @time :2023/11/30 15:17
133 */ 130 */
134 public function blogDel(){ 131 public function blogDel(){
135 DB::beginTransaction(); 132 DB::beginTransaction();
@@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic @@ -158,11 +155,7 @@ class BlogLogic extends BaseLogic
158 RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']); 155 RouteMap::delRoute(RouteMap::SOURCE_BLOG, $id, $this->user['project_id']);
159 //生成一条删除路由记录 156 //生成一条删除路由记录
160 $info = $this->model->read(['id'=>$id],['id','url']); 157 $info = $this->model->read(['id'=>$id],['id','url']);
161 - $data = [  
162 - 'source'=>RouteMap::SOURCE_BLOG,  
163 - 'route'=>$info['url'],  
164 - ];  
165 - $this->setRouteDeleteSave($data); 158 + $this->curlDelRoute($info['url']);
166 return $this->success(); 159 return $this->success();
167 } 160 }
168 161
@@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi; @@ -6,7 +6,9 @@ use App\Helper\FormGlobalsoApi;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\HomeCount\Count; 7 use App\Models\HomeCount\Count;
8 use App\Models\HomeCount\MonthCount; 8 use App\Models\HomeCount\MonthCount;
  9 +use App\Models\Inquiry\InquiryOther;
9 use App\Models\Project\DeployOptimize; 10 use App\Models\Project\DeployOptimize;
  11 +use App\Services\ProjectServer;
10 use Carbon\Carbon; 12 use Carbon\Carbon;
11 use Illuminate\Support\Facades\DB; 13 use Illuminate\Support\Facades\DB;
12 14
@@ -44,6 +46,8 @@ class MonthCountLogic extends BaseLogic @@ -44,6 +46,8 @@ class MonthCountLogic extends BaseLogic
44 $startTime = Carbon::now()->startOfMonth()->toDateString(); 46 $startTime = Carbon::now()->startOfMonth()->toDateString();
45 $endTime = date('Y-m-d',time()); 47 $endTime = date('Y-m-d',time());
46 $arr = []; 48 $arr = [];
  49 +
  50 + ProjectServer::useProject($this->user['project_id']);
47 $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']); 51 $arr = $this->inquiryCount($arr,$startTime,$endTime,$this->user['domain']);
48 $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']); 52 $arr = $this->flowCount($arr,$startTime,$endTime,$this->user['project_id']);
49 $arr = $this->sourceCount($arr,$startTime,$endTime,$this->user['domain']); 53 $arr = $this->sourceCount($arr,$startTime,$endTime,$this->user['domain']);
@@ -67,8 +71,8 @@ class MonthCountLogic extends BaseLogic @@ -67,8 +71,8 @@ class MonthCountLogic extends BaseLogic
67 //数据详情 71 //数据详情
68 $data = $inquiry_list['data']['data'] ?? ''; 72 $data = $inquiry_list['data']['data'] ?? '';
69 $arr['month_total'] = 0; 73 $arr['month_total'] = 0;
70 - if(isset($data) && !empty($data)){  
71 $countryArr = []; 74 $countryArr = [];
  75 + if(isset($data) && !empty($data)){
72 foreach ($data as $v){ 76 foreach ($data as $v){
73 if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){ 77 if(($startTime.' 00:00:00' <= $v['submit_time']) && $v['submit_time'] <= $endTime.' 23:59:59'){
74 $arr['month_total']++; 78 $arr['month_total']++;
@@ -76,14 +80,27 @@ class MonthCountLogic extends BaseLogic @@ -76,14 +80,27 @@ class MonthCountLogic extends BaseLogic
76 if(isset($countryArr[$v['country']])){ 80 if(isset($countryArr[$v['country']])){
77 $countryArr[$v['country']]++; 81 $countryArr[$v['country']]++;
78 }else{ 82 }else{
79 - $countryArr[$v['country']] = 0; 83 + $countryArr[$v['country']] = 1;
  84 + }
  85 + }
  86 + }
  87 + }
  88 + //加上其他询盘
  89 + $arr['total'] += InquiryOther::count();
  90 + $arr['month_total'] += InquiryOther::whereBetween('submit_time',[$startTime, $endTime])->count();
  91 + $countryData = InquiryOther::whereBetween('submit_time',[$startTime, $endTime])
  92 + ->select("country",DB::raw('COUNT(*) as count'))
  93 + ->groupBy('country')->get()->toArray();
  94 + foreach ($countryData as $v1){
  95 + if(isset($countryArr[$v1['country']])){
  96 + $countryArr[$v1['country']] += $v1['count'];
  97 + }else{
  98 + $countryArr[$v1['country']] = $v1['count'];
80 } 99 }
81 } 100 }
82 arsort($countryArr); 101 arsort($countryArr);
83 $top20 = array_slice($countryArr, 0, 15, true); 102 $top20 = array_slice($countryArr, 0, 15, true);
84 $arr['country'] = $top20; 103 $arr['country'] = $top20;
85 - }  
86 - }  
87 return $arr; 104 return $arr;
88 } 105 }
89 106
@@ -118,31 +135,31 @@ class MonthCountLogic extends BaseLogic @@ -118,31 +135,31 @@ class MonthCountLogic extends BaseLogic
118 */ 135 */
119 public function sourceCount(&$arr,$startTime,$endTime,$domain){ 136 public function sourceCount(&$arr,$startTime,$endTime,$domain){
120 //访问来源前10 137 //访问来源前10
121 - $source = DB::table('gl_customer_visit') 138 + $source = DB::connection('custom_mysql')->table('gl_customer_visit')
122 ->select('referrer_url', DB::raw('COUNT(*) as count')) 139 ->select('referrer_url', DB::raw('COUNT(*) as count'))
123 - ->groupBy('referrer_url')->where(['domain'=>$domain]) 140 + ->groupBy('referrer_url')
124 ->whereBetween('updated_date', [$startTime,$endTime]) 141 ->whereBetween('updated_date', [$startTime,$endTime])
125 ->orderByDesc('count')->limit(10)->get()->toArray(); 142 ->orderByDesc('count')->limit(10)->get()->toArray();
126 $arr['source'] = $source; 143 $arr['source'] = $source;
127 //访问国家前15 144 //访问国家前15
128 - $source_country = DB::table('gl_customer_visit') 145 + $source_country = DB::connection('custom_mysql')->table('gl_customer_visit')
129 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv')) 146 ->select('country',DB::raw('COUNT(*) as ip'),DB::raw('SUM(depth) as pv'))
130 - ->groupBy('country')->where(['domain'=>$domain]) 147 + ->groupBy('country')
131 ->whereBetween('updated_date', [$startTime,$endTime]) 148 ->whereBetween('updated_date', [$startTime,$endTime])
132 ->orderBy('ip','desc')->limit(15)->get()->toArray(); 149 ->orderBy('ip','desc')->limit(15)->get()->toArray();
133 $arr['source_country'] = $source_country; 150 $arr['source_country'] = $source_country;
134 //受访界面前15 151 //受访界面前15
135 - $referrer_url = DB::table('gl_customer_visit') 152 + $referrer_url = DB::connection('custom_mysql')->table('gl_customer_visit')
136 ->select('url',DB::raw('COUNT(*) as num')) 153 ->select('url',DB::raw('COUNT(*) as num'))
137 - ->orderBy('num','desc')->where(['domain'=>$domain]) 154 + ->orderBy('num','desc')
138 ->whereBetween('updated_date', [$startTime,$endTime]) 155 ->whereBetween('updated_date', [$startTime,$endTime])
139 ->groupBy('url') 156 ->groupBy('url')
140 ->limit(15)->get()->toArray(); 157 ->limit(15)->get()->toArray();
141 $arr['referrer_url'] = $referrer_url; 158 $arr['referrer_url'] = $referrer_url;
142 //访问断后 159 //访问断后
143 - $referrer_port = DB::table('gl_customer_visit') 160 + $referrer_port = DB::connection('custom_mysql')->table('gl_customer_visit')
144 ->select('device_port',DB::raw('COUNT(*) as num')) 161 ->select('device_port',DB::raw('COUNT(*) as num'))
145 - ->orderBy('num','desc')->where(['domain'=>$domain]) 162 + ->orderBy('num','desc')
146 ->whereBetween('updated_date', [$startTime,$endTime]) 163 ->whereBetween('updated_date', [$startTime,$endTime])
147 ->groupBy('device_port') 164 ->groupBy('device_port')
148 ->limit(15)->get()->toArray(); 165 ->limit(15)->get()->toArray();
@@ -55,7 +55,7 @@ class NavLogic extends BaseLogic @@ -55,7 +55,7 @@ class NavLogic extends BaseLogic
55 $this->model->add($this->param); 55 $this->model->add($this->param);
56 } 56 }
57 //编辑菜单后,通知更新 57 //编辑菜单后,通知更新
58 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); 58 + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
59 return $this->success(); 59 return $this->success();
60 } 60 }
61 61
@@ -97,7 +97,7 @@ class NavLogic extends BaseLogic @@ -97,7 +97,7 @@ class NavLogic extends BaseLogic
97 $this->fail('error'); 97 $this->fail('error');
98 } 98 }
99 //编辑菜单后,通知更新 99 //编辑菜单后,通知更新
100 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NAV, 'route'=>'all']); 100 + $this->addUpdateNotify(RouteMap::SOURCE_NAV, 'all');
101 return $this->success(); 101 return $this->success();
102 } 102 }
103 103
@@ -151,7 +151,7 @@ class NavLogic extends BaseLogic @@ -151,7 +151,7 @@ class NavLogic extends BaseLogic
151 if($pid){ 151 if($pid){
152 $p_cate = $category->where('id', $pid)->select($fields)->first(); 152 $p_cate = $category->where('id', $pid)->select($fields)->first();
153 if($p_cate){ 153 if($p_cate){
154 - $nav_pid = $this->model->where('import_id', $nav['id'])->where('url', $p_cate['alias'])->value('id'); 154 + $nav_pid = $this->model->where('import_id', $nav['id'])->where('url', $p_cate['alias'])->value('id') ?: $nav_pid;
155 } 155 }
156 } 156 }
157 $list = $category->list(['pid' => $pid], 'id', $fields, 'asc'); 157 $list = $category->list(['pid' => $pid], 'id', $fields, 'asc');
@@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic @@ -44,11 +44,10 @@ class NewsCategoryLogic extends BaseLogic
44 DB::beginTransaction(); 44 DB::beginTransaction();
45 try { 45 try {
46 if(isset($this->param['id']) && !empty($this->param['id'])){ 46 if(isset($this->param['id']) && !empty($this->param['id'])){
47 - $this->param['operator_id'] = $this->user['id'];  
48 - //查看路由是否更新  
49 - $id = $this->param['id']; 47 + $this->param['alias'] = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $this->param['id'], $this->user['project_id']);
50 $this->editCategoryRoute($this->param['id'],$this->param['alias']); 48 $this->editCategoryRoute($this->param['id'],$this->param['alias']);
51 $this->editHandleCategory($this->param['id'],$this->param['pid']); 49 $this->editHandleCategory($this->param['id'],$this->param['pid']);
  50 + $this->param['operator_id'] = $this->user['id'];
52 $this->edit($this->param,['id'=>$this->param['id']]); 51 $this->edit($this->param,['id'=>$this->param['id']]);
53 }else{ 52 }else{
54 if(!isset($this->param['alias']) || empty($this->param['alias'])){ 53 if(!isset($this->param['alias']) || empty($this->param['alias'])){
@@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic @@ -56,18 +55,17 @@ class NewsCategoryLogic extends BaseLogic
56 } 55 }
57 $this->param = $this->addParamProcessing($this->param); 56 $this->param = $this->addParamProcessing($this->param);
58 $id = $this->model->addReturnId($this->param); 57 $id = $this->model->addReturnId($this->param);
  58 + $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
  59 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
  60 + $this->model->edit(['alias'=>$route],['id'=>$id]);
59 //当父级分类拥有产品时,处理子集 61 //当父级分类拥有产品时,处理子集
60 $this->addProcessingSon($id); 62 $this->addProcessingSon($id);
61 } 63 }
62 - $route = RouteMap::setRoute($this->param['alias'], RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);  
63 - $this->model->edit(['alias'=>$route],['id'=>$id]);  
64 DB::commit(); 64 DB::commit();
65 }catch (\Exception $e){ 65 }catch (\Exception $e){
66 DB::rollBack(); 66 DB::rollBack();
67 $this->fail('系统错误,请联系管理员'); 67 $this->fail('系统错误,请联系管理员');
68 } 68 }
69 - //更新通知记录表  
70 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_NEWS_CATE, 'route'=>$route]);  
71 return $this->success(); 69 return $this->success();
72 } 70 }
73 71
@@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic @@ -124,22 +122,19 @@ class NewsCategoryLogic extends BaseLogic
124 //生成一条删除路由记录 122 //生成一条删除路由记录
125 $info = $this->model->read(['id'=>$id],['id','alias']); 123 $info = $this->model->read(['id'=>$id],['id','alias']);
126 if($info['alias'] != $route){ 124 if($info['alias'] != $route){
127 - $data = [  
128 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
129 - 'route'=>$info['alias'],  
130 - ];  
131 - $this->setRouteDeleteSave($data); 125 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS_CATE,$route);
  126 + $this->curlDelRoute($info['alias']);
132 } 127 }
133 return true; 128 return true;
134 } 129 }
135 130
136 131
137 /** 132 /**
138 - * @name :修改状态  
139 - * @return array  
140 - * @throws \App\Exceptions\BsideGlobalException  
141 - * @author :liyuhang  
142 - * @method 133 + * @remark :修改状态
  134 + * @name :status_news_category
  135 + * @author :lyh
  136 + * @method :post
  137 + * @time :2023/11/30 15:13
143 */ 138 */
144 public function status_news_category(){ 139 public function status_news_category(){
145 $this->param['operator_id'] = $this->user['id']; 140 $this->param['operator_id'] = $this->user['id'];
@@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic @@ -291,13 +286,8 @@ class NewsCategoryLogic extends BaseLogic
291 public function delRoute($id){ 286 public function delRoute($id){
292 //删除路由映射 287 //删除路由映射
293 RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']); 288 RouteMap::delRoute(RouteMap::SOURCE_NEWS_CATE, $id, $this->user['project_id']);
294 - //生成一条删除路由记录  
295 $info = $this->model->read(['id'=>$id],['id','alias']); 289 $info = $this->model->read(['id'=>$id],['id','alias']);
296 - $data = [  
297 - 'source'=>RouteMap::SOURCE_NEWS_CATE,  
298 - 'route'=>$info['alias'],  
299 - ];  
300 - $this->setRouteDeleteSave($data); 290 + $this->curlDelRoute($info['alias']);
301 return $this->success(); 291 return $this->success();
302 } 292 }
303 293
@@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic @@ -313,22 +303,18 @@ class NewsCategoryLogic extends BaseLogic
313 */ 303 */
314 public function importNewsCategory($project_id,$user_id,$category){ 304 public function importNewsCategory($project_id,$user_id,$category){
315 $return = []; 305 $return = [];
316 -  
317 $cate_arr = explode('/',$category); 306 $cate_arr = explode('/',$category);
318 -  
319 $pid = 0; 307 $pid = 0;
320 foreach ($cate_arr as $v){ 308 foreach ($cate_arr as $v){
321 if($v){ 309 if($v){
322 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]); 310 $category_info = $this->model->read(['name'=>$v,'pid'=>$pid]);
323 if(!$category_info){ 311 if(!$category_info){
324 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]); 312 $id = $this->model->addReturnId(['name'=>$v,'pid'=>$pid,'project_id'=>$project_id,'operator_id'=>$user_id,'create_id'=>$user_id]);
325 -  
326 $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id); 313 $route = RouteMap::setRoute($v, RouteMap::SOURCE_NEWS_CATE, $id, $project_id);
327 $this->model->edit(['alias'=>$route],['id'=>$id]); 314 $this->model->edit(['alias'=>$route],['id'=>$id]);
328 }else{ 315 }else{
329 $id = $category_info['id']; 316 $id = $category_info['id'];
330 } 317 }
331 -  
332 $return[] = $id; 318 $return[] = $id;
333 $pid = $id; 319 $pid = $id;
334 } 320 }
@@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic @@ -63,23 +63,22 @@ class NewsLogic extends BaseLogic
63 try { 63 try {
64 $this->param = $this->paramProcessing($this->param); 64 $this->param = $this->paramProcessing($this->param);
65 if (isset($this->param['id']) && !empty($this->param['id'])) { 65 if (isset($this->param['id']) && !empty($this->param['id'])) {
  66 + $this->param['url'] = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $this->param['id'], $this->user['project_id']);
66 //是否更新路由 67 //是否更新路由
67 $this->editNewsRoute($this->param['id'], $this->param['url']); 68 $this->editNewsRoute($this->param['id'], $this->param['url']);
68 - $id = $this->param['id'];  
69 $this->edit($this->param, ['id' => $this->param['id']]); 69 $this->edit($this->param, ['id' => $this->param['id']]);
70 } else { 70 } else {
71 $id = $this->model->addReturnId($this->param); 71 $id = $this->model->addReturnId($this->param);
72 - }  
73 - //更新路由  
74 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 72 $route = RouteMap::setRoute($this->param['url'], RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
  73 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
75 $this->edit(['url' => $route], ['id' => $id]); 74 $this->edit(['url' => $route], ['id' => $id]);
  75 + }
  76 + //更新路由
76 DB::commit(); 77 DB::commit();
77 } catch (\Exception $e) { 78 } catch (\Exception $e) {
78 DB::rollBack(); 79 DB::rollBack();
79 $this->fail('系统错误,请联系管理员'); 80 $this->fail('系统错误,请联系管理员');
80 } 81 }
81 - //通知更新  
82 - $this->updateNotify(['project_id' => $this->user['project_id'], 'type' => RouteMap::SOURCE_NEWS, 'route' => $route]);  
83 return $this->success(); 82 return $this->success();
84 } 83 }
85 84
@@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic @@ -95,11 +94,8 @@ class NewsLogic extends BaseLogic
95 //生成一条删除路由记录 94 //生成一条删除路由记录
96 $info = $this->model->read(['id' => $id], ['id', 'url']); 95 $info = $this->model->read(['id' => $id], ['id', 'url']);
97 if ($info['url'] != $route) { 96 if ($info['url'] != $route) {
98 - $data = [  
99 - 'source' => RouteMap::SOURCE_NEWS,  
100 - 'route' => $info['url'],  
101 - ];  
102 - $this->setRouteDeleteSave($data); 97 + $this->addUpdateNotify(RouteMap::SOURCE_NEWS,$route);
  98 + $this->curlDelRoute($info['url']);
103 } 99 }
104 return true; 100 return true;
105 } 101 }
@@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic @@ -271,11 +267,7 @@ class NewsLogic extends BaseLogic
271 RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']); 267 RouteMap::delRoute(RouteMap::SOURCE_NEWS, $id, $this->user['project_id']);
272 //生成一条删除路由记录 268 //生成一条删除路由记录
273 $info = $this->model->read(['id' => $id], ['id', 'url']); 269 $info = $this->model->read(['id' => $id], ['id', 'url']);
274 - $data = [  
275 - 'source' => RouteMap::SOURCE_NEWS,  
276 - 'route' => $info['url'],  
277 - ];  
278 - $this->setRouteDeleteSave($data); 270 + $this->curlDelRoute($info['url']);
279 return $this->success(); 271 return $this->success();
280 } 272 }
281 273
@@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic @@ -113,19 +113,20 @@ class CategoryLogic extends BaseLogic
113 DB::beginTransaction(); 113 DB::beginTransaction();
114 try { 114 try {
115 if(isset($this->param['id']) && !empty($this->param['id'])){ 115 if(isset($this->param['id']) && !empty($this->param['id'])){
116 - //是否编辑路由  
117 - $id = $this->editCategoryRoute($this->param['id'],$this->param['route']); 116 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $this->param['id'], $this->user['project_id']);
  117 + $this->editCategoryRoute($this->param['id'],$this->param['route']);
118 //处理子集 118 //处理子集
119 $this->editHandleCategory($this->param['id'],$this->param['pid']); 119 $this->editHandleCategory($this->param['id'],$this->param['pid']);
120 $this->model->edit($this->param,['id'=>$this->param['id']]); 120 $this->model->edit($this->param,['id'=>$this->param['id']]);
121 }else{ 121 }else{
122 $this->param['project_id'] = $this->user['project_id']; 122 $this->param['project_id'] = $this->user['project_id'];
123 $id = $this->model->addReturnId($this->param); 123 $id = $this->model->addReturnId($this->param);
  124 + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
  125 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
  126 + $this->edit(['route'=>$route],['id'=>$id]);
124 //处理子集 127 //处理子集
125 $this->addProcessingSon($id); 128 $this->addProcessingSon($id);
126 } 129 }
127 - $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);  
128 - $this->edit(['route'=>$route],['id'=>$id]);  
129 //清除缓存 130 //清除缓存
130 Common::del_user_cache('product_category',$this->user['project_id']); 131 Common::del_user_cache('product_category',$this->user['project_id']);
131 DB::commit(); 132 DB::commit();
@@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic @@ -133,9 +134,6 @@ class CategoryLogic extends BaseLogic
133 DB::rollBack(); 134 DB::rollBack();
134 $this->fail('系统错误,请联系管理员'); 135 $this->fail('系统错误,请联系管理员');
135 } 136 }
136 - //通知更新  
137 - $notifyData = ['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_CATE, 'route'=>$route];  
138 - $this->updateNotify($notifyData);  
139 return $this->success(); 137 return $this->success();
140 } 138 }
141 139
@@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic @@ -234,13 +232,10 @@ class CategoryLogic extends BaseLogic
234 //生成一条删除路由记录 232 //生成一条删除路由记录
235 $info = $this->model->read(['id'=>$id],['id','route']); 233 $info = $this->model->read(['id'=>$id],['id','route']);
236 if($info['route'] != $route){ 234 if($info['route'] != $route){
237 - $data = [  
238 - 'source'=>RouteMap::SOURCE_PRODUCT_CATE,  
239 - 'route'=>$info['route'],  
240 - ];  
241 - $this->setRouteDeleteSave($data); 235 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_CATE,$route);
  236 + $this->curlDelRoute($info['route']);
242 } 237 }
243 - return $id; 238 + return true;
244 } 239 }
245 240
246 /** 241 /**
@@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic @@ -283,11 +278,7 @@ class CategoryLogic extends BaseLogic
283 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']); 278 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_CATE, $id, $this->user['project_id']);
284 //生成一条删除路由记录 279 //生成一条删除路由记录
285 $info = $this->model->read(['id'=>$id],['id','route']); 280 $info = $this->model->read(['id'=>$id],['id','route']);
286 - $data = [  
287 - 'source'=>RouteMap::SOURCE_PRODUCT_CATE,  
288 - 'route'=>$info['route'],  
289 - ];  
290 - $this->setRouteDeleteSave($data); 281 + $this->curlDelRoute($info['route']);
291 return $this->success(); 282 return $this->success();
292 } 283 }
293 284
@@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic @@ -302,27 +293,22 @@ class CategoryLogic extends BaseLogic
302 */ 293 */
303 public function importProductCategory($project_id,$category){ 294 public function importProductCategory($project_id,$category){
304 $return = []; 295 $return = [];
305 -  
306 $cate_arr = explode('/',$category); 296 $cate_arr = explode('/',$category);
307 -  
308 $pid = 0; 297 $pid = 0;
309 foreach ($cate_arr as $v){ 298 foreach ($cate_arr as $v){
310 if($v){ 299 if($v){
311 $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]); 300 $category_info = $this->model->read(['title'=>$v,'pid'=>$pid]);
312 if(!$category_info){ 301 if(!$category_info){
313 $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]); 302 $id = $this->model->addReturnId(['title'=>$v,'pid'=>$pid,'project_id'=>$project_id]);
314 -  
315 $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id); 303 $route = RouteMap::setRoute($v, RouteMap::SOURCE_PRODUCT_CATE, $id, $project_id);
316 $this->model->edit(['route'=>$route],['id'=>$id]); 304 $this->model->edit(['route'=>$route],['id'=>$id]);
317 }else{ 305 }else{
318 $id = $category_info['id']; 306 $id = $category_info['id'];
319 } 307 }
320 -  
321 $return[] = $id; 308 $return[] = $id;
322 $pid = $id; 309 $pid = $id;
323 } 310 }
324 } 311 }
325 -  
326 //清除缓存 312 //清除缓存
327 Common::del_user_cache('product_category',$project_id); 313 Common::del_user_cache('product_category',$project_id);
328 return $this->getLastCategory($return); 314 return $this->getLastCategory($return);
@@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic @@ -56,17 +56,16 @@ class KeywordLogic extends BaseLogic
56 try { 56 try {
57 $this->param = $this->handleSaveParam($this->param); 57 $this->param = $this->handleSaveParam($this->param);
58 if(isset($this->param['id']) && !empty($this->param['id'])){ 58 if(isset($this->param['id']) && !empty($this->param['id'])){
  59 + //TODO::不能修改路由
59 $this->model->edit($this->param,['id'=>$this->param['id']]); 60 $this->model->edit($this->param,['id'=>$this->param['id']]);
60 - $id = $this->param['id'];  
61 }else{ 61 }else{
62 - $this->param['project_id'] = $this->user['project_id'];  
63 - $this->param['created_at'] = date('Y-m-d H:i:s');  
64 - $this->param['updated_at'] = $this->param['created_at']; 62 + $this->param = $this->addHandleParam($this->param);
65 $id = $this->model->insertGetId($this->param); 63 $id = $this->model->insertGetId($this->param);
66 - }  
67 //路由映射 64 //路由映射
68 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 65 $route = RouteMap::setRoute($this->param['title'], RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
  66 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT_KEYWORD,$route);
69 $this->model->edit(['route'=>$route],['id'=>$id]); 67 $this->model->edit(['route'=>$route],['id'=>$id]);
  68 + }
70 //清除缓存 69 //清除缓存
71 Common::del_user_cache('product_keyword',$this->user['project_id']); 70 Common::del_user_cache('product_keyword',$this->user['project_id']);
72 DB::commit(); 71 DB::commit();
@@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic @@ -74,12 +73,24 @@ class KeywordLogic extends BaseLogic
74 DB::rollBack(); 73 DB::rollBack();
75 $this->fail('保存失败'); 74 $this->fail('保存失败');
76 } 75 }
77 - //通知更新  
78 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT_KEYWORD, 'route'=>$route]);  
79 return $this->success(); 76 return $this->success();
80 } 77 }
81 78
82 /** 79 /**
  80 + * @remark :添加组装数据
  81 + * @name :addHandleParam
  82 + * @author :lyh
  83 + * @method :post
  84 + * @time :2023/11/30 15:00
  85 + */
  86 + public function addHandleParam($param){
  87 + $param['project_id'] = $this->user['project_id'];
  88 + $param['created_at'] = date('Y-m-d H:i:s');
  89 + $param['updated_at'] = $param['created_at'];
  90 + return $this->success($param);
  91 + }
  92 +
  93 + /**
83 * @remark :保存数据时参数处理 94 * @remark :保存数据时参数处理
84 * @name :handleSaveParam 95 * @name :handleSaveParam
85 * @author :lyh 96 * @author :lyh
@@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic @@ -174,11 +185,7 @@ class KeywordLogic extends BaseLogic
174 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']); 185 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT_KEYWORD, $id, $this->user['project_id']);
175 //生成一条删除路由记录 186 //生成一条删除路由记录
176 $info = $this->model->read(['id'=>$id],['id','route']); 187 $info = $this->model->read(['id'=>$id],['id','route']);
177 - $data = [  
178 - 'source'=>RouteMap::SOURCE_PRODUCT_KEYWORD,  
179 - 'route'=>$info['route'],  
180 - ];  
181 - $this->setRouteDeleteSave($data); 188 + $this->curlDelRoute($info['route']);
182 return $this->success(); 189 return $this->success();
183 } 190 }
184 191
@@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic @@ -193,9 +200,7 @@ class KeywordLogic extends BaseLogic
193 */ 200 */
194 public function importProductKeyword($project_id,$keyword){ 201 public function importProductKeyword($project_id,$keyword){
195 $return = []; 202 $return = [];
196 -  
197 $keyword_arr = explode(',',$keyword); 203 $keyword_arr = explode(',',$keyword);
198 -  
199 foreach ($keyword_arr as $v){ 204 foreach ($keyword_arr as $v){
200 $keyword_info = $this->model->read(['title'=>$v]); 205 $keyword_info = $this->model->read(['title'=>$v]);
201 if(!$keyword_info){ 206 if(!$keyword_info){
@@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic @@ -207,7 +212,6 @@ class KeywordLogic extends BaseLogic
207 } 212 }
208 $return[] = $k_id; 213 $return[] = $k_id;
209 } 214 }
210 -  
211 //清除缓存 215 //清除缓存
212 Common::del_user_cache('product_keyword',$project_id); 216 Common::del_user_cache('product_keyword',$project_id);
213 return ','.implode(',',$return).','; 217 return ','.implode(',',$return).',';
@@ -56,16 +56,18 @@ class ProductLogic extends BaseLogic @@ -56,16 +56,18 @@ class ProductLogic extends BaseLogic
56 DB::connection('custom_mysql')->beginTransaction(); 56 DB::connection('custom_mysql')->beginTransaction();
57 try { 57 try {
58 if(isset($this->param['id']) && !empty($this->param['id'])){ 58 if(isset($this->param['id']) && !empty($this->param['id'])){
59 - $id = $this->param['id']; 59 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
60 //查看路由是否更新 60 //查看路由是否更新
61 - $this->param['route'] = $this->editProductRoute($this->param['route']); 61 + $this->editProductRoute($this->param['id'],$this->param['route']);
62 $this->model->edit($this->param,['id'=>$this->param['id']]); 62 $this->model->edit($this->param,['id'=>$this->param['id']]);
  63 + $id = $this->param['id'];
63 }else{ 64 }else{
64 $this->param = $this->addHandleParam($this->param); 65 $this->param = $this->addHandleParam($this->param);
65 $id = $this->model->addReturnId($this->param); 66 $id = $this->model->addReturnId($this->param);
  67 + $route = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
  68 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
  69 + $this->model->edit(['route'=>$route],['id'=>$id]);
66 } 70 }
67 - $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);  
68 - $this->model->edit(['route'=> $this->param['route']],['id'=>$id]);  
69 //产品分类关联 71 //产品分类关联
70 CategoryRelated::saveRelated($id, $category_ids); 72 CategoryRelated::saveRelated($id, $category_ids);
71 //保存扩展字段 73 //保存扩展字段
@@ -75,8 +77,6 @@ class ProductLogic extends BaseLogic @@ -75,8 +77,6 @@ class ProductLogic extends BaseLogic
75 DB::connection('custom_mysql')->rollBack(); 77 DB::connection('custom_mysql')->rollBack();
76 $this->fail('系统错误请联系管理员'); 78 $this->fail('系统错误请联系管理员');
77 } 79 }
78 - //通知更新  
79 - $this->updateNotify(['project_id'=>$this->user['project_id'], 'type'=>RouteMap::SOURCE_PRODUCT, 'route'=>$this->param['route']]);  
80 return $this->success(); 80 return $this->success();
81 } 81 }
82 82
@@ -154,10 +154,15 @@ class ProductLogic extends BaseLogic @@ -154,10 +154,15 @@ class ProductLogic extends BaseLogic
154 }else{ 154 }else{
155 $this->param['thumb'] = Arr::a2s([]); 155 $this->param['thumb'] = Arr::a2s([]);
156 } 156 }
  157 + try {
157 if(isset($this->param['route']) && !empty($this->param['route'])){ 158 if(isset($this->param['route']) && !empty($this->param['route'])){
158 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']); 159 $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  160 + $this->editProductRoute($this->param['id'],$this->param['route']);
159 } 161 }
160 $this->model->edit($this->param,['id'=>$this->param['id']]); 162 $this->model->edit($this->param,['id'=>$this->param['id']]);
  163 + }catch (\Exception $e){
  164 + $this->fail('系统错误,请连续管理员');;
  165 + }
161 return $this->success(); 166 return $this->success();
162 } 167 }
163 168
@@ -285,15 +290,11 @@ class ProductLogic extends BaseLogic @@ -285,15 +290,11 @@ class ProductLogic extends BaseLogic
285 * @method :post 290 * @method :post
286 * @time :2023/9/7 10:02 291 * @time :2023/9/7 10:02
287 */ 292 */
288 - public function editProductRoute($route){  
289 - $info = $this->model->read(['id'=>$this->param['id']]); 293 + public function editProductRoute($id,$route){
  294 + $info = $this->model->read(['id'=>$id]);
290 if($info['route'] != $route){ 295 if($info['route'] != $route){
291 - //生成一条删除路由记录  
292 - $data = [  
293 - 'source'=>RouteMap::SOURCE_PRODUCT,  
294 - 'route'=>$route,  
295 - ];  
296 - $this->setRouteDeleteSave($data); 296 + $this->addUpdateNotify(RouteMap::SOURCE_PRODUCT,$route);
  297 + $this->curlDelRoute($info['route']);
297 } 298 }
298 return $route; 299 return $route;
299 } 300 }
@@ -340,11 +341,7 @@ class ProductLogic extends BaseLogic @@ -340,11 +341,7 @@ class ProductLogic extends BaseLogic
340 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']); 341 RouteMap::delRoute(RouteMap::SOURCE_PRODUCT, $id, $this->user['project_id']);
341 //生成一条删除路由记录 342 //生成一条删除路由记录
342 $info = $this->model->read(['id'=>$id],['id','route']); 343 $info = $this->model->read(['id'=>$id],['id','route']);
343 - $data = [  
344 - 'source'=>RouteMap::SOURCE_PRODUCT,  
345 - 'route'=>$info['route'],  
346 - ];  
347 - $this->setRouteDeleteSave($data); 344 + $this->curlDelRoute($info['route']);
348 return $this->success(); 345 return $this->success();
349 } 346 }
350 347
1 -<?php  
2 -  
3 -namespace App\Http\Logic\Bside\Setting;  
4 -  
5 -use App\Http\Logic\Bside\BaseLogic;  
6 -use App\Models\Project\Country;  
7 -use App\Models\WebSetting\Proofreading;  
8 -use App\Models\WebSetting\WebSettingCountry;  
9 -use Illuminate\Support\Facades\DB;  
10 -  
11 -class ProofreadingLogic extends BaseLogic  
12 -{  
13 -  
14 - public function __construct()  
15 - {  
16 - parent::__construct();  
17 - $this->model = new Proofreading();  
18 - $this->param = $this->requestAll;  
19 - }  
20 -  
21 - /**  
22 - * @name :(保存翻译校队)proofreadingSave  
23 - * @author :lyh  
24 - * @method :post  
25 - * @time :2023/6/12 11:03  
26 - */  
27 - public function proofreadingSave(){  
28 - DB::beginTransaction();  
29 - try {  
30 - //删除以前的数据  
31 - $this->model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);  
32 - foreach ($this->param['data'] as $k => $v){  
33 - $v['created_at'] = date('Y-m-d H:i:s');  
34 - $v['updated_at'] = date('Y-m-d H:i:s');  
35 - $v['project_id'] = $this->user['project_id'];  
36 - $v['language_id'] = $this->param['language_id'];  
37 - $v['type'] = $this->param['type'];  
38 - $v['alias'] = $this->param['alias'];  
39 - $this->param['data'][$k] = $v;  
40 - }  
41 - //新增  
42 - $this->model->insert($this->param['data']);  
43 - DB::commit();  
44 - }catch (\Exception $e){  
45 - DB::rollBack();  
46 - $this->fail('error');  
47 - }  
48 - return $this->success();  
49 - }  
50 -  
51 - /**  
52 - * @name :(项目已选中多语言国家列表)countryLanguageList  
53 - * @author :lyh  
54 - * @method :post  
55 - * @time :2023/6/12 15:54  
56 - */  
57 - public function countryLanguageList($map,$order = 'created_at'){  
58 - $map['project_id'] = $this->user['project_id'];  
59 - $projectCountryModel = new Country();  
60 - $countryInfo = $projectCountryModel->read($map);  
61 - $list = [];  
62 - if(!empty($countryInfo['country_lists'])){  
63 - $countryArr = explode(",",$countryInfo['country_lists']);  
64 - $webCountryModel = new WebSettingCountry();  
65 - $list = $webCountryModel->list(['id'=>['in',$countryArr]]);  
66 - }  
67 - return $this->success($list);  
68 - }  
69 -}  
1 -<?php  
2 -  
3 -namespace App\Http\Logic\Bside\Setting;  
4 -  
5 -use App\Http\Logic\Bside\BaseLogic;  
6 -use App\Models\Project\Country;  
7 -use App\Models\Project\Country as CountryModel;  
8 -use App\Models\WebSetting\WebSettingCountry;  
9 -  
10 -class WebSettingCountryLogic extends BaseLogic  
11 -{  
12 - public function __construct()  
13 - {  
14 - parent::__construct();  
15 -  
16 - $this->model = new WebSettingCountry();  
17 - $this->param = $this->requestAll;  
18 - }  
19 -  
20 - /**  
21 - * @name :(获取多语言国家)user_country_list  
22 - * @author :lyh  
23 - * @method :post  
24 - * @time :2023/4/28 16:18  
25 - */  
26 - public function country_list(){  
27 - $lists = $this->model->list($this->param,'id',['id','name','alias','lang_text']);  
28 - return $this->success($lists);  
29 - }  
30 -  
31 -}  
@@ -46,7 +46,7 @@ class WebSettingReceivingLogic extends BaseLogic @@ -46,7 +46,7 @@ class WebSettingReceivingLogic extends BaseLogic
46 }catch (\Exception $e){ 46 }catch (\Exception $e){
47 $this->fail('error'); 47 $this->fail('error');
48 } 48 }
49 - app(SyncService::class)->projectAcceptAddress($this->user['project_id']); 49 + (new SyncService())->projectAcceptAddress($this->user['project_id']);
50 return $this->success(); 50 return $this->success();
51 } 51 }
52 } 52 }
@@ -35,7 +35,7 @@ class VisitLogic extends BaseLogic @@ -35,7 +35,7 @@ class VisitLogic extends BaseLogic
35 'customer_visit_id' => $this->param['id'], 35 'customer_visit_id' => $this->param['id'],
36 // 'domain' => $this->user['domain'], 36 // 'domain' => $this->user['domain'],
37 ]; 37 ];
38 - $data = $this->model->list($map); 38 + $data = $this->model->list($map, 'created_at');
39 return $this->success($data); 39 return $this->success($data);
40 } 40 }
41 41
@@ -20,7 +20,6 @@ class News extends Base @@ -20,7 +20,6 @@ class News extends Base
20 if(!$value){ 20 if(!$value){
21 return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at'))); 21 return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
22 } 22 }
23 -  
24 return $value; 23 return $value;
25 } 24 }
26 } 25 }
@@ -164,4 +164,10 @@ class Product extends Base @@ -164,4 +164,10 @@ class Product extends Base
164 // return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); 164 // return self::where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
165 // } 165 // }
166 166
  167 + public function getSendTimeAttribute($value){
  168 + if(!$value){
  169 + return date('Y-m-d H:i:s', strtotime($this->getAttribute('created_at')));
  170 + }
  171 + return $value;
  172 + }
167 } 173 }
1 -<?php  
2 -  
3 -namespace App\Models\WebSetting;  
4 -  
5 -use App\Models\Base;  
6 -  
7 -class WebSettingCountry extends Base  
8 -{  
9 - protected $table = 'gl_web_setting_country';  
10 -  
11 -}  
@@ -144,7 +144,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -144,7 +144,6 @@ Route::middleware(['bloginauth'])->group(function () {
144 }); 144 });
145 //多语言设置 145 //多语言设置
146 Route::prefix('country')->group(function () { 146 Route::prefix('country')->group(function () {
147 - Route::any('/', [\App\Http\Controllers\Bside\Setting\WebSettingCountryController::class, 'lists'])->name('web_setting_country_lists');  
148 Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info'); 147 Route::any('/info', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'info'])->name('web_setting_country_info');
149 Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'save'])->name('web_setting_country_save'); 148 Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProjectCountryController::class, 'save'])->name('web_setting_country_save');
150 }); 149 });
@@ -170,7 +169,6 @@ Route::middleware(['bloginauth'])->group(function () { @@ -170,7 +169,6 @@ Route::middleware(['bloginauth'])->group(function () {
170 Route::any('/imageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'imageList'])->name('web_proofreading_imageList'); 169 Route::any('/imageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'imageList'])->name('web_proofreading_imageList');
171 Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save'); 170 Route::any('/save', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'save'])->name('web_proofreading_save');
172 Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage'); 171 Route::any('/saveImage', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'saveImage'])->name('web_proofreading_saveImage');
173 - Route::any('/languageList', [\App\Http\Controllers\Bside\Setting\ProofreadingController::class, 'languageList'])->name('web_proofreading_languageList');  
174 }); 172 });
175 173
176 //seo设置 174 //seo设置
@@ -418,6 +416,11 @@ Route::middleware(['bloginauth'])->group(function () { @@ -418,6 +416,11 @@ Route::middleware(['bloginauth'])->group(function () {
418 Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload'); 416 Route::any('/upload', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'upload'])->name('file_manager_upload');
419 Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete'); 417 Route::any('/delete', [\App\Http\Controllers\Bside\FileManage\FileManageController::class, 'delete'])->name('file_manager_delete');
420 }); 418 });
  419 +
  420 + //小语种
  421 + Route::prefix('language')->group(function () {
  422 + Route::any('/', [\App\Http\Controllers\Bside\Setting\LanguageController::class, 'lists'])->name('language_lists');
  423 + });
421 }); 424 });
422 //无需登录验证的路由组 425 //无需登录验证的路由组
423 Route::group([], function () { 426 Route::group([], function () {