作者 刘锟

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

正在显示 41 个修改的文件 包含 644 行增加534 行删除
@@ -101,19 +101,21 @@ class VideoTask extends Command @@ -101,19 +101,21 @@ class VideoTask extends Command
101 continue; 101 continue;
102 } 102 }
103 $keywordInfo = $this->getKeywordImage($val->id,$task_project->project_id,$domainInfo['domain']); 103 $keywordInfo = $this->getKeywordImage($val->id,$task_project->project_id,$domainInfo['domain']);
104 - $array = [  
105 - 'project_id' => $task_project->project_id,  
106 - 'keyword_id' => $val->id,  
107 - 'keyword' => $val->title,  
108 - 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'],  
109 - 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'],  
110 - 'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]),  
111 - 'status' => KeywordVideoTaskLog::STATUS_INIT,  
112 - 'updated_at' => date('Y-m-d H:i:s'),  
113 - 'created_at' => date('Y-m-d H:i:s'),  
114 - ];  
115 - KeywordVideoTaskLog::insert($array);  
116 - $sub_task_num--; 104 + if(!empty($keywordInfo['product_list'])){
  105 + $array = [
  106 + 'project_id' => $task_project->project_id,
  107 + 'keyword_id' => $val->id,
  108 + 'keyword' => $val->title,
  109 + 'data' => json_encode(['url' => $keywordInfo['url'],'title' => $keywordInfo['title'],
  110 + 'description' => $keywordInfo['keyword_content'], 'images' => $keywordInfo['product_list'],
  111 + 'keywords' => $keywordInfo['keyword_list'], 'logo_bg' => $logo_bg]),
  112 + 'status' => KeywordVideoTaskLog::STATUS_INIT,
  113 + 'updated_at' => date('Y-m-d H:i:s'),
  114 + 'created_at' => date('Y-m-d H:i:s'),
  115 + ];
  116 + KeywordVideoTaskLog::insert($array);
  117 + $sub_task_num--;
  118 + }
117 } 119 }
118 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 120 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
119 $task_project->save(); 121 $task_project->save();
@@ -209,7 +211,6 @@ class VideoTask extends Command @@ -209,7 +211,6 @@ class VideoTask extends Command
209 } 211 }
210 } 212 }
211 } 213 }
212 -  
213 //TODO::所有产品 214 //TODO::所有产品
214 $thumb = $this->getRecommendAndHotProducts($keywordInfo['route'],$project_id); 215 $thumb = $this->getRecommendAndHotProducts($keywordInfo['route'],$project_id);
215 $keyword_arr = Keyword::where("project_id",$project_id)->where("status",1)->inRandomOrder()->take(10)->pluck('title')->toArray(); 216 $keyword_arr = Keyword::where("project_id",$project_id)->where("status",1)->inRandomOrder()->take(10)->pluck('title')->toArray();
@@ -238,7 +239,7 @@ class VideoTask extends Command @@ -238,7 +239,7 @@ class VideoTask extends Command
238 $productIds[] = $item->id; 239 $productIds[] = $item->id;
239 } 240 }
240 if (count($productIds)<7){ 241 if (count($productIds)<7){
241 - $product_all_id = Product::where("project_id", $project_id)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); 242 + $product_all_id = Product::where("project_id", $project_id)->where('thumb','!=',null)->whereNotIn('id', $productIds)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
242 $number = 40; 243 $number = 40;
243 $array_count = count($product_all_id); 244 $array_count = count($product_all_id);
244 if ($array_count > 0) { 245 if ($array_count > 0) {
@@ -250,7 +251,7 @@ class VideoTask extends Command @@ -250,7 +251,7 @@ class VideoTask extends Command
250 $products = $productsQuery; 251 $products = $productsQuery;
251 } 252 }
252 }else{ 253 }else{
253 - $product_all_id = Product::where("project_id", $project_id)->where("status",Product::STATUS_ON)->pluck('id')->toArray(); 254 + $product_all_id = Product::where("project_id", $project_id)->where('thumb','!=',null)->where("status",Product::STATUS_ON)->pluck('id')->toArray();
254 $number = 40; 255 $number = 40;
255 $array_count = count($product_all_id); 256 $array_count = count($product_all_id);
256 if ($array_count > 0) 257 if ($array_count > 0)
@@ -273,7 +274,7 @@ class VideoTask extends Command @@ -273,7 +274,7 @@ class VideoTask extends Command
273 if (strpos(','.$keyword_id.',', ','.$productKeyword->id.',') === false) { 274 if (strpos(','.$keyword_id.',', ','.$productKeyword->id.',') === false) {
274 //不包含 275 //不包含
275 $productModel = new Product(); 276 $productModel = new Product();
276 - $keyword_id = $keyword_id . $productKeyword->id.','; 277 + $keyword_id = ','.$keyword_id.',' . $productKeyword->id.',';
277 $productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]); 278 $productModel->edit(['keyword_id'=>$keyword_id],['id'=>$item->id]);
278 } 279 }
279 $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title]; 280 $data[] = ['url'=>getImageUrl($item->thumb['url']),'title'=>$item->title];
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :SyncFile.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/4/17 10:05
  8 + */
  9 +
  10 +namespace App\Console\Commands\SyncFile;
  11 +
  12 +use App\Models\File\ErrorFile;
  13 +use Illuminate\Console\Command;
  14 +
  15 +class SyncFile extends Command
  16 +{
  17 + /**
  18 + * The name and signature of the console command.
  19 + *
  20 + * @var string
  21 + */
  22 + protected $signature = 'sync_file';
  23 +
  24 + /**
  25 + * The console command description.
  26 + *
  27 + * @var string
  28 + */
  29 + protected $description = '同步图片与文件';
  30 +
  31 +
  32 + public function handle(){
  33 + $errorFileModel = new ErrorFile();
  34 + $lists = $errorFileModel->list(['status'=>0]);//未同步成功的图片及文件
  35 + foreach ($lists as $k => $v){
  36 + $code = $this->synchronizationFile($v['path']);
  37 + if((int)$code == 200){
  38 + echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
  39 + $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
  40 + }
  41 + }
  42 + echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
  43 + return true;
  44 + }
  45 +
  46 + /**
  47 + * @remark :指定同步文件到獨立177服務器
  48 + * @name :synchronizationFile
  49 + * @author :lyh
  50 + * @method :post
  51 + * @time :2024/4/8 11:10
  52 + */
  53 + public function synchronizationFile($path_name){
  54 + //同步到大文件
  55 + $file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
  56 + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
  57 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
  58 + return shell_exec($cmd);
  59 + }
  60 +}
@@ -11,6 +11,7 @@ use App\Helper\Common; @@ -11,6 +11,7 @@ use App\Helper\Common;
11 use App\Models\Blog\Blog; 11 use App\Models\Blog\Blog;
12 use App\Models\Devops\ServerConfig; 12 use App\Models\Devops\ServerConfig;
13 use App\Models\Domain\DomainInfo; 13 use App\Models\Domain\DomainInfo;
  14 +use App\Models\File\File;
14 use App\Models\File\Image; 15 use App\Models\File\Image;
15 use App\Models\Manage\BelongingGroup; 16 use App\Models\Manage\BelongingGroup;
16 use App\Models\Manage\Dept; 17 use App\Models\Manage\Dept;
@@ -47,381 +48,7 @@ class Demo extends Command @@ -47,381 +48,7 @@ class Demo extends Command
47 */ 48 */
48 protected $description = 'demo'; 49 protected $description = 'demo';
49 50
50 - /**  
51 - * Create a new command instance.  
52 - *  
53 - * @return void  
54 - */  
55 -// public function __construct()  
56 -// {  
57 -// parent::__construct();  
58 -// }  
59 -  
60 - public function curlRequest($url, $data, $method = 'POST', $header = [], $time_out = 60)  
61 - {  
62 -  
63 - $ch = curl_init();  
64 - curl_setopt($ch, CURLOPT_TIMEOUT, $time_out);  
65 - curl_setopt($ch, CURLOPT_URL, $url);  
66 - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);  
67 - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);  
68 - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);  
69 - if ($data)  
70 - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));  
71 - curl_setopt($ch, CURLOPT_HTTPHEADER, array_merge([  
72 - 'Expect:',  
73 - 'Content-type: application/json',  
74 - 'Accept: application/json',  
75 - ], $header)  
76 - );  
77 - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);  
78 - $response = curl_exec($ch);  
79 - $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);  
80 - curl_close($ch);  
81 - return [$code, $response];  
82 - }  
83 -  
84 - /**  
85 - * @return bool  
86 - */  
87 -// public function handle()  
88 -// {  
89 -// return $this->domain();  
90 -// $result = app(SyncService::class)->projectAcceptAddress(1);  
91 -// dd($result);  
92 -// $data = [  
93 -// 'key' => 'productkey_keyword',  
94 -// 'keywords' => 'apple watch'  
95 -// ];  
96 -// $result = Common::send_openai_msg('v2/openai_chat', $data);  
97 -// dd();  
98 -// $string = 'demo.globalso.site/';  
99 -// $domain_array = parse_url($string);  
100 -// $domain = $domain_array['host'] ?? $domain_array['path'];  
101 -// dd($domain);  
102 -// $data = [];  
103 -// dd(isset($data['a']['b']));  
104 -// $url = 'https://demo.globalso.site/';  
105 -// $action = 'api/updateHtmlNotify/';  
106 -// $data = [  
107 -// 'project_id' => 1,  
108 -// 'type' => 1,  
109 -// 'route' => 1  
110 -// ];;  
111 -// $method = 'GET';  
112 -// $result = $this->curlRequest($url . $action, $data, $method);  
113 -// dd($result);  
114 -//  
115 -// $context = stream_context_create([  
116 -// 'ssl' => [  
117 -// 'capture_peer_cert' => true,  
118 -// 'capture_peer_cert_chain' => false,  
119 -// ],  
120 -// ]);  
121 -//  
122 -// $stream = stream_socket_client('ssl://oa.quanqiusou.cn:443', $errno, $errstr, 30, STREAM_CLIENT_CONNECT, $context);  
123 -//  
124 -// if(!$stream) {  
125 -// die("Failed to connect: $errno - $errstr");  
126 -// }  
127 -//  
128 -// $remote_cert = stream_context_get_params($stream)['options']['ssl']['peer_certificate'];  
129 -//  
130 -// if(!$remote_cert) {  
131 -// die("Failed to retrieve certificate");  
132 -// }  
133 -//  
134 -// $valid_from = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validFrom_time_t']);  
135 -// $valid_to = date('Y-m-d H:i:s', openssl_x509_parse($remote_cert)['validTo_time_t']);  
136 -//  
137 -// fclose($stream);  
138 -//  
139 -// echo "Certificate Valid From: $valid_from<br>";  
140 -// echo "Certificate Valid To: $valid_to<br>";  
141 -//  
142 -// dd('end');  
143 -// $dept_array = [  
144 -// '品牌部',  
145 -// '综合部',  
146 -// '渠道部',  
147 -// '广告推广部',  
148 -// 'AICC运营部',  
149 -// '黑格运营部',  
150 -// '直营运营部',  
151 -// '直营销售部',  
152 -// '深圳跨境部',  
153 -// '外贸部',  
154 -// '研发部',  
155 -// '技术部',  
156 -// '售后部',  
157 -// ];  
158 -// foreach ($dept_array as $v) {  
159 -// $dept = Dept::where(['title' => $v])->first();  
160 -// if (FALSE == empty($dept))  
161 -// continue;  
162 -// $dept = new Dept();  
163 -// $dept->title = $v;  
164 -// $dept->save();  
165 -// }  
166 -//// dd('dept end');  
167 -// $dept_map = Dept::pluck('title', 'id')->toArray();  
168 -// $belonging_map = BelongingGroup::pluck('name', 'id')->toArray();  
169 -//// dd($belonging_map);  
170 -//  
171 -// $filename = storage_path('logs/oa_hr.txt');  
172 -// $string = file_get_contents($filename);  
173 -// $data = explode("\r\n", $string);  
174 -// $data = array_filter($data);  
175 -// $dept = '';  
176 -// foreach ($data as $k=>$v) {  
177 -//// var_dump($v) . PHP_EOL;  
178 -// if ($k == 1)  
179 -// continue;  
180 -// $tmp = explode("\t", $v);  
181 -// if (count($tmp) == 3) {  
182 -// $dept = $tmp[0] ? : $dept;  
183 -// $position = $tmp[1];  
184 -// $name = $tmp[2];  
185 -// } else if (count($tmp) == 2) {  
186 -// $position = $tmp[0];  
187 -// $name = $tmp[1];  
188 -// } else {  
189 -// Log::info($v . PHP_EOL);  
190 -// continue;  
191 -// }  
192 -//  
193 -//  
194 -//// Log::info($dept . '---' . $position . '---' . $name . PHP_EOL);  
195 -//// continue;  
196 -//  
197 -// $dept_id = array_search($dept, $dept_map);  
198 -// $belonging_id = 17;  
199 -// if (FALSE !== strpos($dept,'技术部')) {  
200 -// $belonging_string = str_replace('技术部', '', $dept);  
201 -// if ($belonging_string) {  
202 -// $belonging_string = $belonging_string . '组';  
203 -// $belonging_id = array_search($belonging_string, $belonging_map);  
204 -// }  
205 -//  
206 -// $dept_tmp = '技术部';  
207 -// $dept_id = array_search($dept_tmp, $dept_map);  
208 -// }  
209 -// if (FALSE !== strpos($dept,'售后')) {  
210 -// $belonging_string = str_replace('售后', '', $dept);  
211 -// if ($belonging_string)  
212 -// $belonging_id = array_search($belonging_string, $belonging_map);  
213 -// $dept_tmp = '售后部';  
214 -// $dept_id = array_search($dept_tmp, $dept_map);  
215 -// }  
216 -//  
217 -// $position_log = EntryPosition::where(['name' => $position])->first();  
218 -// if (empty($position_log)) {  
219 -// $position_log = new EntryPosition();  
220 -// $position_log->name = $position;  
221 -// $position_log->save();  
222 -// }  
223 -// $position_id = $position_log->id;  
224 -//  
225 -// $hr = ManageHr::where(['name' => $name])->first();  
226 -// if (empty($hr)) {  
227 -// Log::info($k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id);  
228 -// continue;  
229 -// }  
230 -//  
231 -// $hr->belong_group = $belonging_id;  
232 -// $hr->dept_id = $dept_id;  
233 -// $hr->entry_position = $position_id;  
234 -// $hr->save();  
235 -// echo $k . '-' . $name . '-' . $dept . '-' . $dept_id . '-' . $position . '-' . $position_id . '-' . '组' . '-' . $belonging_id . PHP_EOL;  
236 -//  
237 -// }  
238 -// dd('end');  
239 -// exit;  
240 -//  
241 -// if (($handle = fopen($filename, 'r')) !== false) {  
242 -// while (($data = fgetcsv($handle, 1000, ',')) !== false) {  
243 -// // 处理每行数据  
244 -// Log::info(var_export($data, true));  
245 -// }  
246 -// fclose($handle);  
247 -// }  
248 -// exit;  
249 -//  
250 -// $group = BelongingGroup::get();  
251 -// dd($group->toArray());  
252 -// $domain = parse_url('https//:dev.golbalso.site/');  
253 -// dd($domain);  
254 -// echo time() . PHP_EOL;  
255 -// $blogModel = new Image();  
256 -// $list = $blogModel->list();  
257 -// echo time() . PHP_EOL;  
258 -// dd(count($list));  
259 -//  
260 -// return;  
261 -// preg_match_all("/\@include\(\"([a-z0-9_]+)\"\)/i",'  
262 -//@include("asdf")@include("")@include("asdtrw2erf")  
263 -// ',$include);  
264 -//  
265 -// print_r($include);  
266 -// }  
267 public function handle(){ 51 public function handle(){
268 - $domainModel = new DomainInfo();  
269 - $domainInfo = $domainModel->read(['project_id'=>45]);  
270 - if($domainInfo === false){  
271 - dd('11111');  
272 - }  
273 - $bg = '';  
274 - $logo = '';  
275 - $dom = file_get_html('https://'.$domainInfo['domain'].'/');  
276 - $logoDom = $dom->find('.logo', 0)->find("img",0);  
277 - if($logoDom != null){  
278 - $logo = $logoDom->src;  
279 - }  
280 - $elements = $dom->find('.section-banner-wrap-block');  
281 - if (count($elements) >= 2) {  
282 - foreach ($elements as $v){  
283 - $image = $v->find('img', 0);  
284 - if($image != null){  
285 - break;  
286 - }  
287 - }  
288 - } else {  
289 - $image = $elements->find('img', 0);  
290 - }  
291 - if($image != null){  
292 - $bg = $image->src;  
293 - }  
294 - if($image != null){  
295 - $bg = $image->src;  
296 - }  
297 -// return $logo;  
298 - dd(['logo'=>$logo ?? '','bg'=>$bg ?? '']);  
299 -// $projectModel = new Project();  
300 -// $list = $projectModel->list(['delete_status'=>0,'type'=>['!=',0]]);  
301 -// foreach ($list as $v1){  
302 -// ProjectServer::useProject($v1['id']);  
303 -// echo date('Y-m-d H:i:s') . '项目id:'.$v1['id'] . PHP_EOL;  
304 -// $navGroupModel = new BNavGroup();  
305 -// $groupList = $navGroupModel->list(['sort_list'=>['!=','']]);  
306 -// if(empty($groupList)){  
307 -// continue;  
308 -// }  
309 -// foreach ($groupList as $k=>$v){  
310 -// if(!empty($v['sort_list'])){  
311 -// $sort_list = json_decode($v['sort_list']);  
312 -// $sort = 0;  
313 -// $this->subSort($sort_list,$sort);  
314 -// }  
315 -// }  
316 -// DB::disconnect('custom_mysql');  
317 -// }  
318 - return true;  
319 - }  
320 52
321 - /**  
322 - * @remark :处理子集排序  
323 - * @name :subSort  
324 - * @author :lyh  
325 - * @method :post  
326 - * @time :2024/2/29 15:30  
327 - */  
328 - public function subSort($subList,&$sort,$pid = 0){  
329 - $navModel = new BNav();  
330 - foreach ($subList as $k => $v){  
331 - $v = (array)$v;  
332 - $sort = $sort+1;  
333 - $navModel->edit(['sort'=>$sort],['id'=>$v['id']]);  
334 - if(!empty($v['sub'])){  
335 - $this->subSort($v['sub'],$sort,$v['id']);  
336 - }  
337 - }  
338 - return true;  
339 - }  
340 -// public function handle(){  
341 -// $projectModel = new DeployOptimize();  
342 -// $list = $projectModel->list(['project_id'=>['<',187]]);  
343 -// foreach ($list as $v){  
344 -// echo date('Y-m-d H:i:s') . 'end'.json_encode($v) . PHP_EOL;  
345 -// $data = [];  
346 -// if(!empty($v['minor_languages']) && is_array($v['minor_languages'])){  
347 -// foreach ($v['minor_languages'] as $k1=> $v1){  
348 -// if(!empty($v1['tl']) && !empty($v1['type'])){  
349 -// $data[] = [  
350 -// 'language'=>$v1['tl'],  
351 -// 'type'=>$v1['type'],  
352 -// 'keywords'=>$v1['keywords'],  
353 -// 'service_day'=>$v1['service_day'],  
354 -// 'project_id'=>$v['project_id'],  
355 -// 'created_at'=>date('Y-m-d H:i:s'),  
356 -// 'updated_at'=>date('Y-m-d H:i:s')  
357 -// ];  
358 -// }  
359 -// }  
360 -// }  
361 -// $languageModel = new MinorLanguages();  
362 -// $languageModel->insert($data);  
363 -// }  
364 -//  
365 -// }  
366 -  
367 - public function printMessage()  
368 - {  
369 - $client = new Client();  
370 - $headers = [  
371 - 'Accept-Language' => 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',  
372 - 'Cache-Control' => 'no-cache',  
373 - 'Content-Type' => 'application/json',  
374 - 'DNT' => '1',  
375 - 'Origin' => 'http://openai.waimaoq.com',  
376 - 'Pragma' => 'no-cache',  
377 - 'Proxy-Connection' => 'keep-alive',  
378 - 'Referer' => 'http://openai.waimaoq.com/docs',  
379 - 'User-Agent' => 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36',  
380 - 'accept' => 'application/json',  
381 - 'Access-Control-Allow-Origin' => '*'  
382 - ];  
383 - $body = '{  
384 - "prompt": "Human: 我需要一篇100字的英文原创博客并包含标题,内容结合:“cnc machine”。AI:"  
385 - }';  
386 - $response = $client->post('http://openai.waimaoq.com/v1/openai_chat_stream', [  
387 - 'stream' => true,  
388 - 'headers' => $headers,  
389 - 'body' => $body  
390 - ]);  
391 - // 获取响应流对象  
392 - $stream = $response->getBody();  
393 -  
394 - // 设置输出缓冲区  
395 - ob_start();  
396 -  
397 - // 读取流中的数据并输出到页面  
398 - while (!$stream->eof()) {  
399 - echo $stream->read(4);  
400 - ob_flush();  
401 - flush();  
402 - }  
403 - dd(1);  
404 - }  
405 -  
406 - /**  
407 - * @remark :获取域名  
408 - * @name :domain  
409 - * @author :lyh  
410 - * @method :post  
411 - * @time :2023/11/29 18:47  
412 - */  
413 - public function domain(){  
414 - $domainModel = new DomainInfo();  
415 - $lists = $domainModel->list();  
416 - foreach ($lists as $k => $v){  
417 - if($v['project_id'] != 0){  
418 - echo date('Y-m-d H:i:s') . ' start: ' . $v['project_id'] . PHP_EOL;  
419 - $domain = 'https://'.$v['domain'].'/';  
420 - $url = $domain.'/api/update_robots/?project_id='.$v['project_id'];  
421 - http_get($url);  
422 - echo date('Y-m-d H:i:s') . ' end: ' . $v['project_id'] . PHP_EOL;  
423 - }  
424 - }  
425 - return true;  
426 } 53 }
427 } 54 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :EditVideoMp4.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/4/16 9:44
  8 + */
  9 +
  10 +namespace App\Console\Commands\Test;
  11 +
  12 +use App\Models\Project\Project;
  13 +use App\Models\Template\BTemplate;
  14 +use App\Models\Template\BTemplateCommon;
  15 +use App\Services\ProjectServer;
  16 +use Illuminate\Console\Command;
  17 +use Illuminate\Support\Facades\DB;
  18 +
  19 +class EditVideoMp4 extends Command
  20 +{
  21 + /**
  22 + * The name and signature of the console command.
  23 + *
  24 + * @var string
  25 + */
  26 + protected $signature = 'edit_video';
  27 +
  28 + /**
  29 + * The console command description.
  30 + *
  31 + * @var string
  32 + */
  33 + protected $description = 'edit_mp4';
  34 +
  35 +
  36 + public function handle(){
  37 + $projectModel = new Project();
  38 + $list = $projectModel->list(['is_upgrade'=>0,'delete_status'=>0,'type'=>['!=',0],'id'=>['<=',82]]);
  39 + $data = [];
  40 + foreach ($list as $v){
  41 + echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
  42 + ProjectServer::useProject($v['id']);
  43 + $this->copyTable();
  44 + $this->getHtml();
  45 + DB::disconnect('custom_mysql');
  46 + }
  47 + echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
  48 + }
  49 +
  50 + /**
  51 + * @remark :获取需要替换的html
  52 + * @name :getHtml
  53 + * @author :lyh
  54 + * @method :post
  55 + * @time :2024/4/16 10:17
  56 + */
  57 + public function getHtml(){
  58 + $templateModel = new BTemplate();
  59 + $templateList = $templateModel->list();
  60 + if(!empty($templateList)){
  61 + foreach ($templateList as $v1){
  62 + $this->getVideoSrc($v1['id'],$v1['main_html'],'main_html',$templateModel);
  63 + }
  64 + }
  65 + return true;
  66 + }
  67 +
  68 + /**
  69 + * @remark :获取video的src
  70 + * @name :getVideoSrc
  71 + * @author :lyh
  72 + * @method :post
  73 + * @time :2024/4/16 9:46
  74 + */
  75 + public function getVideoSrc($id,$html,$filed,$model){
  76 + $pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
  77 + preg_match_all($pattern, $html, $matches);
  78 + $srcLinks = $matches[1];
  79 + if(!empty($srcLinks)){
  80 + foreach ($srcLinks as $link) {
  81 + $newLink = str_replace('ecdn6.globalso.com','v6-file.globalso.com', $link);
  82 + $html = str_replace($link, $newLink, $html);
  83 + }
  84 + $model->edit([$filed=>$html],['id'=>$id]);
  85 + }
  86 + return true;
  87 + }
  88 +
  89 +
  90 + /**
  91 + * @remark :复制表
  92 + * @name :copyTable
  93 + * @author :lyh
  94 + * @method :post
  95 + * @time :2024/4/16 9:51
  96 + */
  97 + public function copyTable(){
  98 + // 原始表名和新表名
  99 + $originalTableName = "gl_web_template";
  100 + $newTableName = "gl_web_template_c";
  101 + // 检查原始表是否存在
  102 + DB::connection('custom_mysql')->select("SHOW TABLES LIKE '{$originalTableName}'");
  103 + DB::connection('custom_mysql')->statement("CREATE TABLE {$newTableName} LIKE {$originalTableName}");
  104 + DB::connection('custom_mysql')->statement("INSERT INTO {$newTableName} SELECT * FROM {$originalTableName}");
  105 + }
  106 +}
@@ -165,6 +165,8 @@ class WebTraffic extends Command @@ -165,6 +165,8 @@ class WebTraffic extends Command
165 try { 165 try {
166 $type = $this->argument('type'); 166 $type = $this->argument('type');
167 167
  168 + Log::channel('traffic')->info('开始运行:' . $type);
  169 +
168 $this->sleep($type); 170 $this->sleep($type);
169 171
170 $page = 1; 172 $page = 1;
@@ -164,6 +164,8 @@ class WebTrafficSpecial extends Command @@ -164,6 +164,8 @@ class WebTrafficSpecial extends Command
164 */ 164 */
165 public function handle() 165 public function handle()
166 { 166 {
  167 + Log::channel('traffic')->info('开始运行特殊引流' );
  168 +
167 try { 169 try {
168 $this->sleep(); 170 $this->sleep();
169 171
@@ -29,12 +29,12 @@ class Kernel extends ConsoleKernel @@ -29,12 +29,12 @@ class Kernel extends ConsoleKernel
29 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 29 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
30 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 30 $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
31 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 31 $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
32 - $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次  
33 - $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次  
34 - $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次  
35 - $schedule->command('web_traffic_russia 1')->everyThirtyMinutes(); // 俄语站引流 1-3个月的项目,半小时一次  
36 - $schedule->command('web_traffic_russia 2')->cron('*/18 * * * *'); // 俄语站引流 4-8个月的项目,18分钟一次  
37 - $schedule->command('web_traffic_russia 3')->cron('*/12 * * * *'); // 俄语站引流 大于9个月的项目,12分钟一次 32 +// $schedule->command('web_traffic 1')->everyThirtyMinutes(); // 引流 1-3个月的项目,半小时一次
  33 +// $schedule->command('web_traffic 2')->cron('*/18 * * * *'); // 引流 4-8个月的项目,18分钟一次
  34 +// $schedule->command('web_traffic 3')->cron('*/12 * * * *'); // 引流 大于9个月的项目,12分钟一次
  35 +// $schedule->command('web_traffic_russia 1')->everyThirtyMinutes(); // 俄语站引流 1-3个月的项目,半小时一次
  36 +// $schedule->command('web_traffic_russia 2')->cron('*/18 * * * *'); // 俄语站引流 4-8个月的项目,18分钟一次
  37 +// $schedule->command('web_traffic_russia 3')->cron('*/12 * * * *'); // 俄语站引流 大于9个月的项目,12分钟一次
38 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 38 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
39 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录 39 $schedule->command('forward_count')->monthlyOn(1,'01:00')->withoutOverlapping(1);//没月月初1号执行月统计转发询盘记录
40 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次 40 $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次
@@ -53,7 +53,7 @@ if (!function_exists('http_post')) { @@ -53,7 +53,7 @@ if (!function_exists('http_post')) {
53 * @param type $url 53 * @param type $url
54 * @param type $post_data 54 * @param type $post_data
55 */ 55 */
56 - function http_post($url, $post_data, $header = []) 56 + function http_post($url, $post_data, $header = [],$is_json = true)
57 { 57 {
58 if (empty($header)) { 58 if (empty($header)) {
59 $header = array( 59 $header = array(
@@ -78,7 +78,10 @@ if (!function_exists('http_post')) { @@ -78,7 +78,10 @@ if (!function_exists('http_post')) {
78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); 78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
79 } 79 }
80 curl_close($ch); 80 curl_close($ch);
81 - return json_decode($res, true); 81 + if($is_json){
  82 + return json_decode($res, true);
  83 + }
  84 + return trim($res);
82 } 85 }
83 } 86 }
84 87
@@ -594,12 +597,12 @@ if (!function_exists('getFileUrl')) { @@ -594,12 +597,12 @@ if (!function_exists('getFileUrl')) {
594 if(substr($path,0,2) == '//'){ 597 if(substr($path,0,2) == '//'){
595 return 'https:'.$path; 598 return 'https:'.$path;
596 } 599 }
597 -// $file_type = pathinfo($path, PATHINFO_EXTENSION);  
598 -// $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];  
599 -// if(in_array(strtolower($file_type),$fileTypeArr)){  
600 -// $cdn2 = config('filesystems.disks.cos')['cdn2'];  
601 -// return $cdn2.$path;  
602 -// } 600 + $file_type = pathinfo($path, PATHINFO_EXTENSION);
  601 + $fileTypeArr = ['zip', 'pdf', 'mp4', 'doc', 'docx', 'm4v', 'xlsx'];
  602 + if(in_array(strtolower($file_type),$fileTypeArr)){
  603 + $cdn2 = config('filesystems.disks.cos')['cdn2'];
  604 + return $cdn2.$path;
  605 + }
603 if($location == 0){ 606 if($location == 0){
604 //v6-file.globalso.com 607 //v6-file.globalso.com
605 $cos = config('filesystems.disks.cos'); 608 $cos = config('filesystems.disks.cos');
@@ -59,8 +59,8 @@ class KeywordVideoController extends BaseController @@ -59,8 +59,8 @@ class KeywordVideoController extends BaseController
59 * @time :2023/8/18 10:58 59 * @time :2023/8/18 10:58
60 */ 60 */
61 public function searchParam(&$query){ 61 public function searchParam(&$query){
62 - if(isset($this->map['project_name']) && is_array($this->map['project_name'])){  
63 - $query->where('gl_project.title','like','%'.$this->map['project_name'].'%'); 62 + if(isset($this->map['title']) && is_array($this->map['title'])){
  63 + $query->where('gl_project.title','like','%'.$this->map['title'].'%');
64 } 64 }
65 if(isset($this->map['status'])){ 65 if(isset($this->map['status'])){
66 $query->where('gl_keyword_video_task.status',$this->map['status']); 66 $query->where('gl_keyword_video_task.status',$this->map['status']);
@@ -138,6 +138,7 @@ class OptimizeController extends BaseController @@ -138,6 +138,7 @@ class OptimizeController extends BaseController
138 } 138 }
139 $item['product_num'] = $data['product'] ?? 0; 139 $item['product_num'] = $data['product'] ?? 0;
140 $item['keyword_num'] = $item['key'] ?? 0; 140 $item['keyword_num'] = $item['key'] ?? 0;
  141 + $item['inquiry_num'] = $data['inquiry'] ?? 0;
141 $item['autologin_code'] = getAutoLoginCode($item['id']); 142 $item['autologin_code'] = getAutoLoginCode($item['id']);
142 return $item; 143 return $item;
143 } 144 }
@@ -86,6 +86,7 @@ class ProjectController extends BaseController @@ -86,6 +86,7 @@ class ProjectController extends BaseController
86 'gl_project.channel AS channel', 86 'gl_project.channel AS channel',
87 'gl_project.company AS company', 87 'gl_project.company AS company',
88 'gl_project.type AS type', 88 'gl_project.type AS type',
  89 + 'gl_project.uptime AS uptime',
89 'gl_project.is_upgrade AS is_upgrade', 90 'gl_project.is_upgrade AS is_upgrade',
90 'gl_project.created_at AS created_at', 91 'gl_project.created_at AS created_at',
91 'gl_project.cooperate_date AS cooperate_date', 92 'gl_project.cooperate_date AS cooperate_date',
@@ -13,9 +13,12 @@ use App\Enums\Common\Code; @@ -13,9 +13,12 @@ use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 use App\Models\HomeCount\Count; 14 use App\Models\HomeCount\Count;
15 use App\Models\HomeCount\MonthCount; 15 use App\Models\HomeCount\MonthCount;
  16 +use App\Models\Inquiry\InquiryIP;
  17 +use App\Models\Inquiry\InquirySet;
16 use App\Models\News\News; 18 use App\Models\News\News;
17 use App\Models\Product\Category; 19 use App\Models\Product\Category;
18 use App\Models\Product\Product; 20 use App\Models\Product\Product;
  21 +use App\Models\Visit\Visit;
19 use Carbon\Carbon; 22 use Carbon\Carbon;
20 23
21 class MonthReportController extends BaseController 24 class MonthReportController extends BaseController
@@ -82,6 +85,9 @@ class MonthReportController extends BaseController @@ -82,6 +85,9 @@ class MonthReportController extends BaseController
82 $info['news_num_last_7'] = $newsModel->formatQuery( 85 $info['news_num_last_7'] = $newsModel->formatQuery(
83 ['status'=>0,'created_at'=>['between',[now()->subDays(7)->startOfDay()->toDateString(),now()->startOfDay()->toDateString()]] 86 ['status'=>0,'created_at'=>['between',[now()->subDays(7)->startOfDay()->toDateString(),now()->startOfDay()->toDateString()]]
84 ])->count(); 87 ])->count();
  88 + $info['service_duration'] = $this->user['service_duration'];//服务天数
  89 + $info['ip_total'] = (new Visit())->count();//ip总数
  90 + $info['remain_day'] = $this->user['remain_day'];//剩余服务天数
85 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2); 91 $info['speed'] = round((0.3 + mt_rand()/mt_getrandmax() * (1-0.3)),2);
86 $this->response('success',Code::SUCCESS,$info); 92 $this->response('success',Code::SUCCESS,$info);
87 } 93 }
@@ -41,6 +41,9 @@ class BaseController extends Controller @@ -41,6 +41,9 @@ class BaseController extends Controller
41 $this->uid = $info['id']; 41 $this->uid = $info['id'];
42 //参数处理 42 //参数处理
43 $this->getParam(); 43 $this->getParam();
  44 + if(!empty($this->user)){
  45 + $this->project = Cache::get('user-'.$this->user['project_id']);
  46 + }
44 //日志记录 47 //日志记录
45 $this->set_user_log(); 48 $this->set_user_log();
46 } 49 }
@@ -17,6 +17,7 @@ use App\Helper\Translate; @@ -17,6 +17,7 @@ use App\Helper\Translate;
17 use App\Helper\Wechat; 17 use App\Helper\Wechat;
18 use App\Http\Logic\Bside\User\UserLoginLogic; 18 use App\Http\Logic\Bside\User\UserLoginLogic;
19 use App\Models\Domain\DomainInfo; 19 use App\Models\Domain\DomainInfo;
  20 +use App\Models\File\ErrorFile;
20 use App\Models\Project\Project; 21 use App\Models\Project\Project;
21 use App\Models\Service\Service; 22 use App\Models\Service\Service;
22 use App\Models\Sms\SmsLog; 23 use App\Models\Sms\SmsLog;
@@ -24,6 +25,7 @@ use App\Models\User\DeptUser; @@ -24,6 +25,7 @@ use App\Models\User\DeptUser;
24 use App\Models\User\ProjectRole; 25 use App\Models\User\ProjectRole;
25 use App\Models\User\User; 26 use App\Models\User\User;
26 use App\Utils\EncryptUtils; 27 use App\Utils\EncryptUtils;
  28 +use http\Client\Response;
27 use Illuminate\Support\Facades\Cache; 29 use Illuminate\Support\Facades\Cache;
28 use Mrgoon\AliSms\AliSms; 30 use Mrgoon\AliSms\AliSms;
29 31
@@ -54,15 +54,22 @@ class DescribeController extends BaseController @@ -54,15 +54,22 @@ class DescribeController extends BaseController
54 $this->response('success'); 54 $this->response('success');
55 } 55 }
56 56
57 - public function delete(Request $request, DescribeLogic $logic) 57 + /**
  58 + * @remark :删除数据
  59 + * @name :delete
  60 + * @author :lyh
  61 + * @method :post
  62 + * @time :2024/4/12 16:59
  63 + */
  64 + public function delete(DescribeLogic $logic)
58 { 65 {
59 - $request->validate([  
60 - 'ids'=>['required', new Ids()] 66 + $this->request->validate([
  67 + 'ids'=>'required'
61 ],[ 68 ],[
62 'ids.required' => 'ID不能为空' 69 'ids.required' => 'ID不能为空'
63 ]); 70 ]);
64 - $data = $logic->delete($this->param['ids']);  
65 - $this->response('success',Code::SUCCESS,$data); 71 + $logic->describeDel();
  72 + $this->response('success');
66 } 73 }
67 74
68 } 75 }
@@ -173,4 +173,32 @@ class KeywordController extends BaseController @@ -173,4 +173,32 @@ class KeywordController extends BaseController
173 $this->response('success'); 173 $this->response('success');
174 } 174 }
175 175
  176 + /**
  177 + * @remark :批量清除关键词相关内容
  178 + * @name :batchKeywordFiled
  179 + * @author :lyh
  180 + * @method :post
  181 + * @time :2024/4/22 10:27
  182 + */
  183 + public function batchKeywordFiled(){
  184 + $param = [];
  185 + if(isset($this->param['keyword'])){
  186 + $param['seo_keywords'] = null;
  187 + }
  188 + if(isset($this->param['description'])){
  189 + $param['seo_description'] = null;
  190 + }
  191 + if(isset($this->param['title'])){
  192 + $param['keyword_title'] = null;
  193 + }
  194 + if(isset($this->param['content'])){
  195 + $param['keyword_content'] = null;
  196 + }
  197 + $keywordModel = new Keyword();
  198 + $rs = $keywordModel->edit($param,['id'=>['!=',0]]);
  199 + if($rs === false){
  200 + $this->fail('保存失败,请联系管理员');
  201 + }
  202 + $this->response('success');
  203 + }
176 } 204 }
@@ -85,8 +85,8 @@ class TranslateController extends BaseController @@ -85,8 +85,8 @@ class TranslateController extends BaseController
85 'url.required' => 'url不能为空', 85 'url.required' => 'url不能为空',
86 'alias.required' => 'url不能为空', 86 'alias.required' => 'url不能为空',
87 ]); 87 ]);
88 - $logic->translateSave();  
89 - $this->response('success'); 88 + $rs = $logic->translateSave();
  89 + $this->response('success',Code::SUCCESS,$rs);
90 } 90 }
91 91
92 /** 92 /**
@@ -33,9 +33,8 @@ class BTemplateLogController extends BaseController @@ -33,9 +33,8 @@ class BTemplateLogController extends BaseController
33 * @time :2023/8/23 11:05 33 * @time :2023/8/23 11:05
34 */ 34 */
35 public function lists(BTemplateLog $bTemplateLog){ 35 public function lists(BTemplateLog $bTemplateLog){
36 - unset($this->map['template_id']); 36 +// unset($this->map['template_id']);
37 $this->map['project_id'] = $this->user['project_id']; 37 $this->map['project_id'] = $this->user['project_id'];
38 - $this->map['source'] = 1;  
39 $this->map['is_custom'] = 0; 38 $this->map['is_custom'] = 0;
40 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']); 39 $lists = $bTemplateLog->lists($this->map,$this->page,$this->row,$this->order,['id','template_id','operator_id','source','created_at','updated_at']);
41 if(!empty($lists['list'])){ 40 if(!empty($lists['list'])){
@@ -6,6 +6,8 @@ use App\Enums\Common\Code; @@ -6,6 +6,8 @@ use App\Enums\Common\Code;
6 use App\Http\Controllers\Bside\BaseController; 6 use App\Http\Controllers\Bside\BaseController;
7 use App\Http\Logic\Bside\BTemplate\CustomTemplateLogic; 7 use App\Http\Logic\Bside\BTemplate\CustomTemplateLogic;
8 use App\Http\Requests\Bside\Template\CustomTemplateRequest; 8 use App\Http\Requests\Bside\Template\CustomTemplateRequest;
  9 +use App\Models\Template\BTemplate;
  10 +use App\Models\Template\BTemplateLog;
9 11
10 /** 12 /**
11 * @remark :自定义模块 13 * @remark :自定义模块
@@ -107,4 +109,40 @@ class CustomTemplateController extends BaseController @@ -107,4 +109,40 @@ class CustomTemplateController extends BaseController
107 $customTemplateLogic->saveHtml(); 109 $customTemplateLogic->saveHtml();
108 $this->response('success'); 110 $this->response('success');
109 } 111 }
  112 +
  113 + /**
  114 + * @remark :获取自定义界面的保存记录
  115 + * @name :getCustomTemplateLog
  116 + * @author :lyh
  117 + * @method :post
  118 + * @time :2024/4/23 11:07
  119 + */
  120 + public function getCustomTemplateLog(BTemplateLog $bTemplateLog){
  121 + $this->request->validate([
  122 + 'source_id'=>['required'],
  123 + ],[
  124 + 'source_id.required' => 'ID不能为空',
  125 + ]);
  126 + $this->map['source'] = 9;
  127 + $this->map['is_custom'] = 0;
  128 + $lists = $bTemplateLog->lists($this->map,$this->page,$this->row);
  129 + $this->response('success',Code::SUCCESS,$lists);
  130 + }
  131 +
  132 + /**
  133 + * @remark :还原单页面记录
  134 + * @name :rollbackVersion
  135 + * @author :lyh
  136 + * @method :post
  137 + * @time :2024/4/23 13:58
  138 + */
  139 + public function rollbackVersion(CustomTemplateLogic $logic){
  140 + $this->request->validate([
  141 + 'id'=>['required'],
  142 + ],[
  143 + 'id.required' => '模版ID不能为空',
  144 + ]);
  145 + $logic->saveRollbackVersion();
  146 + $this->response('success');
  147 + }
110 } 148 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Controllers\File; 3 namespace App\Http\Controllers\File;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Models\File\ErrorFile;
6 use App\Models\File\File; 7 use App\Models\File\File;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Services\AmazonS3Service; 9 use App\Services\AmazonS3Service;
@@ -130,7 +131,7 @@ class FileController @@ -130,7 +131,7 @@ class FileController
130 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 131 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
131 } 132 }
132 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); 133 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
133 - $this->synchronizationFile($files->getClientOriginalExtension(),$fileName); 134 + $this->synchronizationFile($fileName);
134 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 135 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
135 } 136 }
136 137
@@ -141,11 +142,16 @@ class FileController @@ -141,11 +142,16 @@ class FileController
141 * @method :post 142 * @method :post
142 * @time :2024/4/8 11:10 143 * @time :2024/4/8 11:10
143 */ 144 */
144 - public function synchronizationFile($file_type,$fileName){ 145 + public function synchronizationFile($fileName){
145 //同步到大文件 146 //同步到大文件
146 - $file_path = getFileUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); 147 + $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName;
147 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; 148 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
148 - shell_exec($cmd); 149 + $code = shell_exec($cmd);
  150 + if(200 != (int)$code){
  151 + $errorFileModel = new ErrorFile();
  152 + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
  153 + }
  154 + return true;
149 } 155 }
150 156
151 /** 157 /**
@@ -262,7 +268,7 @@ class FileController @@ -262,7 +268,7 @@ class FileController
262 $mime = $file->getMimeType(); 268 $mime = $file->getMimeType();
263 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); 269 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
264 $data[] = $this->responseData($this->path.'/'.$fileName, $name); 270 $data[] = $this->responseData($this->path.'/'.$fileName, $name);
265 - $this->synchronizationFile($file_type,$fileName); 271 + $this->synchronizationFile($fileName);
266 } 272 }
267 $this->response('资源',Code::SUCCESS,$data); 273 $this->response('资源',Code::SUCCESS,$data);
268 } 274 }
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\File; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\File;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Controller; 6 use App\Http\Controllers\Controller;
7 use App\Http\Controllers\type; 7 use App\Http\Controllers\type;
  8 +use App\Models\File\ErrorFile;
8 use App\Models\File\Image as ImageModel; 9 use App\Models\File\Image as ImageModel;
9 use App\Models\Project\Project; 10 use App\Models\Project\Project;
10 use App\Services\AmazonS3Service; 11 use App\Services\AmazonS3Service;
@@ -225,7 +226,12 @@ class ImageController extends Controller @@ -225,7 +226,12 @@ class ImageController extends Controller
225 //同步到大文件 226 //同步到大文件
226 $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); 227 $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
227 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; 228 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
228 - shell_exec($cmd); 229 + $code = shell_exec($cmd);
  230 + if(200 != (int)$code){
  231 + $errorFileModel = new ErrorFile();
  232 + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
  233 + }
  234 + return true;
229 } 235 }
230 236
231 /** 237 /**
@@ -307,13 +307,11 @@ class DomainInfoLogic extends BaseLogic @@ -307,13 +307,11 @@ class DomainInfoLogic extends BaseLogic
307 //主站生成证书 307 //主站生成证书
308 EditDomainBt::dispatch($this->param['id']); 308 EditDomainBt::dispatch($this->param['id']);
309 // $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? [],$this->param['is_https'] ?? 0); 309 // $this->setDomainSsl($server_info['init_domain'],$info['domain'],$this->param['extend_config'] ?? [],$this->param['other_domain'] ?? [],$this->param['is_https'] ?? 0);
310 -  
311 //amp站生成证书 310 //amp站生成证书
312 if($data['amp_status']){ 311 if($data['amp_status']){
313 EditAmpDomainBt::dispatch($this->param['id']); 312 EditAmpDomainBt::dispatch($this->param['id']);
314 // $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']); 313 // $this->setAmpDomainSsl($server_info['init_domain'],$info['domain']);
315 } 314 }
316 -  
317 return $this->success(); 315 return $this->success();
318 } 316 }
319 317
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Http\Logic\Aside\Project; 3 namespace App\Http\Logic\Aside\Project;
4 4
  5 +use App\Console\Commands\Languages;
5 use App\Enums\Common\Code; 6 use App\Enums\Common\Code;
6 use App\Events\CopyImageFile; 7 use App\Events\CopyImageFile;
7 use App\Events\CopyProject; 8 use App\Events\CopyProject;
@@ -16,9 +17,16 @@ use App\Models\Project\InquiryFilterConfig; @@ -16,9 +17,16 @@ use App\Models\Project\InquiryFilterConfig;
16 use App\Models\Project\MinorLanguages; 17 use App\Models\Project\MinorLanguages;
17 use App\Models\Project\ProjectRenew; 18 use App\Models\Project\ProjectRenew;
18 use App\Models\Project\WebTrafficConfig; 19 use App\Models\Project\WebTrafficConfig;
  20 +use App\Models\RankData\ExternalLinks;
  21 +use App\Models\RankData\IndexedPages;
  22 +use App\Models\RankData\RankData;
  23 +use App\Models\RankData\RankWeek;
  24 +use App\Models\RankData\RecommDomain;
  25 +use App\Models\RankData\Speed;
19 use App\Models\Template\Setting; 26 use App\Models\Template\Setting;
20 use App\Models\User\ProjectMenu; 27 use App\Models\User\ProjectMenu;
21 use App\Models\User\ProjectRole; 28 use App\Models\User\ProjectRole;
  29 +use App\Models\WebSetting\WebLanguage;
22 use App\Services\SyncService; 30 use App\Services\SyncService;
23 use App\Utils\HttpUtils; 31 use App\Utils\HttpUtils;
24 use App\Utils\LogUtils; 32 use App\Utils\LogUtils;
@@ -156,9 +164,8 @@ class ProjectLogic extends BaseLogic @@ -156,9 +164,8 @@ class ProjectLogic extends BaseLogic
156 $this->saveProjectDeployOptimize($this->param['deploy_optimize']); 164 $this->saveProjectDeployOptimize($this->param['deploy_optimize']);
157 //保存售后信息 165 //保存售后信息
158 $this->saveProjectAfter($this->param['project_after']); 166 $this->saveProjectAfter($this->param['project_after']);
159 - $this->saveMinorLanguages($this->param['minor_language'] ?? []); 167 + $this->saveMinorLanguages($this->param['deploy_optimize']['minor_languages'] ?? []);
160 $this->syncImageFile($this->param['project_location'],$this->param['id']); 168 $this->syncImageFile($this->param['project_location'],$this->param['id']);
161 - //创建站点  
162 (new SyncService())->projectAcceptAddress($this->param['id']); 169 (new SyncService())->projectAcceptAddress($this->param['id']);
163 } 170 }
164 DB::commit(); 171 DB::commit();
@@ -288,13 +295,24 @@ class ProjectLogic extends BaseLogic @@ -288,13 +295,24 @@ class ProjectLogic extends BaseLogic
288 //更改域名 295 //更改域名
289 $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']); 296 $this->editDomainStatus($deploy_optimize['domain'],$deploy_optimize['project_id']);
290 } 297 }
291 - $deploy_optimize['minor_languages'] = Arr::a2s( []); 298 + $deploy_optimize['minor_languages'] = Arr::a2s($deploy_optimize['minor_languages'] ?? []);
  299 + $deploy_optimize['g_top_plan'] = Arr::a2s($deploy_optimize['g_top_plan'] ?? []);
292 $deploy_optimize['minor_keywords'] = Arr::a2s(!empty($deploy_optimize['minor_keywords']) ? $deploy_optimize['minor_keywords'] : []); 300 $deploy_optimize['minor_keywords'] = Arr::a2s(!empty($deploy_optimize['minor_keywords']) ? $deploy_optimize['minor_keywords'] : []);
293 $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : ''; 301 $deploy_optimize['special'] = !empty($deploy_optimize['special']) ? ','.trim($deploy_optimize['special'],',').',' : '';
294 //是否更新了api_no 302 //是否更新了api_no
295 $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no'); 303 $api_no = DeployOptimize::where('id', $deploy_optimize['id'])->value('api_no');
296 if($api_no != $deploy_optimize['api_no']){ 304 if($api_no != $deploy_optimize['api_no']){
297 - NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no']]); 305 + if($deploy_optimize['api_no']){
  306 + NoticeLog::createLog(NoticeLog::TYPE_RANK_DATA, ['api_no' => $deploy_optimize['api_no'] ?: 0]);
  307 + }else{
  308 + //清空已有排名数据
  309 + RankData::where('project_id', $deploy_optimize['project_id'])->delete();
  310 + ExternalLinks::where('project_id', $deploy_optimize['project_id'])->delete();
  311 + IndexedPages::where('project_id', $deploy_optimize['project_id'])->delete();
  312 + RecommDomain::where('project_id', $deploy_optimize['project_id'])->delete();
  313 + Speed::where('project_id', $deploy_optimize['project_id'])->delete();
  314 + RankWeek::where('project_id', $deploy_optimize['project_id'])->delete();
  315 + }
298 } 316 }
299 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]); 317 $deployOptimizeModel->edit($deploy_optimize,['id'=>$deploy_optimize['id']]);
300 return $this->success(); 318 return $this->success();
@@ -327,12 +345,24 @@ class ProjectLogic extends BaseLogic @@ -327,12 +345,24 @@ class ProjectLogic extends BaseLogic
327 $languageModel = new MinorLanguages(); 345 $languageModel = new MinorLanguages();
328 $languageModel->del(['project_id'=>$this->param['id']]); 346 $languageModel->del(['project_id'=>$this->param['id']]);
329 if(!empty($minor_language)){ 347 if(!empty($minor_language)){
  348 + $webLanguageModel = new WebLanguage();
  349 + $result = [];
330 foreach ($minor_language as $k => $v){ 350 foreach ($minor_language as $k => $v){
331 - if(!empty($v['language'])){  
332 - $v['created_at'] = date('Y-m-d H:i:s');  
333 - $v['updated_at'] = date('Y-m-d H:i:s');  
334 - $v['project_id'] = $this->param['id'];  
335 - $data[] = $v; 351 + if(!empty($v['lang'])){
  352 + $zh = $webLanguageModel->read(['short'=>$v['lang']],['chinese']);
  353 + if(empty($zh)){
  354 + continue;
  355 + }
  356 + //获取小语种达标天数
  357 + $result['language'] = $zh['chinese'];
  358 + $result['lang'] = $v['lang'];
  359 + $result['created_at'] = date('Y-m-d H:i:s');
  360 + $result['updated_at'] = date('Y-m-d H:i:s');
  361 + $result['project_id'] = $this->param['id'];
  362 + $result['service_day'] = $v['service_day'];
  363 + $result['type'] = $v['type'];
  364 + $result['keywords'] = $v['keywords'];
  365 + $data[] = $result;
336 } 366 }
337 } 367 }
338 if(!empty($data)){ 368 if(!empty($data)){
@@ -10,6 +10,7 @@ @@ -10,6 +10,7 @@
10 namespace App\Http\Logic\Bside\BTemplate; 10 namespace App\Http\Logic\Bside\BTemplate;
11 11
12 use App\Http\Logic\Bside\BaseLogic; 12 use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Project\PageSetting;
13 use App\Models\Service\Service as ServiceSettingModel; 14 use App\Models\Service\Service as ServiceSettingModel;
14 use App\Models\Template\BTemplate; 15 use App\Models\Template\BTemplate;
15 use App\Models\Template\BTemplateCommon; 16 use App\Models\Template\BTemplateCommon;
@@ -39,38 +40,76 @@ class BTemplateLogLogic extends BaseLogic @@ -39,38 +40,76 @@ class BTemplateLogLogic extends BaseLogic
39 $this->fail('error'); 40 $this->fail('error');
40 } 41 }
41 $bTemplateModel = new BTemplate(); 42 $bTemplateModel = new BTemplate();
42 - if($info['template_id'] == 0){//定制项目  
43 - //TODO::还原头部+底部  
44 - $bTemplateModel->edit(['html'=>$info['text']],['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);  
45 - return $this->success();  
46 - }  
47 //演示项目,不允许其他号码编辑 43 //演示项目,不允许其他号码编辑
48 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){ 44 if(($this->user['project_id'] == 1) && (!in_array($this->user['mobile'],$bTemplateModel->mobile)) && ($info['source'] == 1)){
49 $this->fail('演示项目仅支持演示功能,无法更改首页'); 45 $this->fail('演示项目仅支持演示功能,无法更改首页');
50 } 46 }
51 - //获取当前项目的模版 47 + if($info['template_id'] == 0) {//todo::定制项目
  48 + return $this->rollBackCustomized($info);
  49 + }
  50 + //TODO::非定制项目,获取当前项目的模版
  51 + return $this->rollBackNoCustomized($info);
  52 + }
  53 +
  54 + /**
  55 + * @remark :定制页面还原
  56 + * @name :rollBackCustomized
  57 + * @author :lyh
  58 + * @method :post
  59 + * @time :2024/4/23 14:36
  60 + */
  61 + public function rollBackCustomized($info){
  62 + $bTemplateModel = new BTemplate();
  63 + $condition = ['template_id'=>0,'source'=>$info['source'],'source_id'=>$info['source_id'],
  64 + 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']];
  65 + //TODO::还原头部+底部
  66 + $bTemplateModel->edit(['html'=>$info['text']],$condition);
  67 + $commonData = [
  68 + 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'],
  69 + 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css']
  70 + ];
  71 + $type = $this->getCustomizedType($info['source'],$info['is_list']);
  72 + $commonTemplateModel = new BTemplateCommon();
  73 + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
  74 + return $this->success();
  75 + }
  76 +
  77 + /**
  78 + * @remark :非定制界面还原
  79 + * @name :rollBackNoCustomized
  80 + * @author :lyh
  81 + * @method :post
  82 + * @time :2024/4/23 14:38
  83 + */
  84 + public function rollBackNoCustomized($info){
52 $bSettingModel = new Setting(); 85 $bSettingModel = new Setting();
53 $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]); 86 $settingInfo = $bSettingModel->read(['project_id'=>$this->user['project_id']]);
54 if($settingInfo === false){ 87 if($settingInfo === false){
55 $this->fail('请先选择模版'); 88 $this->fail('请先选择模版');
56 } 89 }
57 - //切换模版  
58 - if($info['template_id'] != $settingInfo['template_id']){  
59 - $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]);  
60 - } 90 + $bTemplateModel = new BTemplate();
61 try { 91 try {
62 - $data = $this->setParam($info);  
63 - $bTemplateModel->edit($data,['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id']]);  
64 - $commonData = $this->setCommonParam($info); 92 + //切换模版
  93 + if($info['template_id'] != $settingInfo['template_id']){
  94 + $bSettingModel->edit(['template_id'=>$info['template_id']],['id'=>$settingInfo['id']]);
  95 + }
  96 + $data = ['main_html'=>$info['main_html'], 'main_css'=>$info['main_css']];
  97 + $condition = ['template_id'=>$info['template_id'],'source'=>$info['source'],'source_id'=>$info['source_id'],
  98 + 'is_list'=>$info['is_list'],'is_custom'=>$info['is_custom']];
  99 + $bTemplateModel->edit($data,$condition);
  100 + //还原头部+底部
  101 + $commonData = [
  102 + 'head_html'=>$info['head_html'], 'head_css'=>$info['head_css'], 'footer_html'=>$info['footer_html'], 'footer_css'=>$info['footer_css']
  103 + ];
65 $commonTemplateModel = new BTemplateCommon(); 104 $commonTemplateModel = new BTemplateCommon();
66 - $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>1,'project_id'=>$this->user['project_id']]);  
67 - //更新所有界面的other 105 + $type = $this->getType($info['source'],$info['is_list'],$info['is_custom']);
  106 + $commonTemplateModel->edit($commonData,['template_id'=>$info['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
68 if(!empty($info['other'])){ 107 if(!empty($info['other'])){
69 - $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); 108 + $commonTemplateModel->edit(['other'=>$info['other']],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$info['type']]);
70 }else{ 109 }else{
71 $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s')); 110 $footer_other = str_replace('<header','',characterTruncation($info['text'],'/<style id="globalsojs-footer">(.*?)<header/s'));
72 $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other); 111 $other = preg_replace('/<style id="globalsojs-footer">(.*?)<\/style>/s', '', $footer_other);
73 - $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id']]); 112 + $commonTemplateModel->edit(['other'=>$other],['project_id'=>$this->user['project_id'],'template_id'=>$info['template_id'],'type'=>$type]);
74 } 113 }
75 }catch (\Exception $e){ 114 }catch (\Exception $e){
76 $this->fail('系统错误,请联系管理员'); 115 $this->fail('系统错误,请联系管理员');
@@ -79,35 +118,67 @@ class BTemplateLogLogic extends BaseLogic @@ -79,35 +118,67 @@ class BTemplateLogLogic extends BaseLogic
79 } 118 }
80 119
81 /** 120 /**
82 - * @remark :设置回滚参数  
83 - * @name :setParam 121 + * @remark :定制页面头部类型---根据source获取type类型
  122 + * @name :getType
84 * @author :lyh 123 * @author :lyh
85 * @method :post 124 * @method :post
86 - * @time :2023/8/23 14:18 125 + * @time :2023/11/16 11:20
87 */ 126 */
88 - public function setParam($info){  
89 - $data = [  
90 - 'main_html'=>$info['main_html'],  
91 - 'main_css'=>$info['main_css'],  
92 - ];  
93 - return $this->success($data); 127 + public function getCustomizedType($source,$is_list){
  128 + $type = BTemplate::TYPE_HOME;
  129 + if($source == BTemplate::SOURCE_PRODUCT){
  130 + if($is_list == BTemplate::IS_LIST){
  131 + $type = BTemplate::TYPE_PRODUCT_LIST;
  132 + }else{
  133 + $type = BTemplate::TYPE_PRODUCT_DETAIL;
  134 + }
  135 + }
  136 + if($source == BTemplate::SOURCE_BLOG){
  137 + if($is_list == BTemplate::IS_LIST){
  138 + $type = BTemplate::TYPE_BLOG_LIST;
  139 + }else{
  140 + $type = BTemplate::TYPE_BLOG_DETAIL;
  141 + }
  142 + }
  143 + if($source == BTemplate::SOURCE_NEWS){
  144 + if($is_list == BTemplate::IS_LIST){
  145 + $type = BTemplate::TYPE_NEWS_LIST;
  146 + }else{
  147 + $type = BTemplate::TYPE_NEWS_DETAIL;
  148 + }
  149 + }
  150 + return $type;
94 } 151 }
95 152
96 /** 153 /**
97 - * @remark :设置回滚公共参数参数  
98 - * @name :setParam 154 + * @remark :(非定制)保存时获取获取设置的类型
  155 + * @name :getType
99 * @author :lyh 156 * @author :lyh
100 * @method :post 157 * @method :post
101 - * @time :2023/8/23 14:18 158 + * @time :2023/10/21 17:29
102 */ 159 */
103 - public function setCommonParam($info){  
104 - $data = [  
105 - 'head_html'=>$info['head_html'],  
106 - 'head_css'=>$info['head_css'],  
107 - 'footer_html'=>$info['footer_html'],  
108 - 'footer_css'=>$info['footer_css']  
109 - ];  
110 - return $this->success($data); 160 + public function getType($source,$is_list,$is_custom = 0){
  161 + $type = BTemplate::SOURCE_HOME;//首页公共头部底部
  162 + $is_head = $this->user['configuration']['is_head'] ?? BTemplate::IS_NO_HEADER;
  163 + if($is_custom == BTemplate::IS_CUSTOM){//拓展模块为首页头部
  164 + return $this->success($type);
  165 + }
  166 + //查看页面是否设置自定义头部底部
  167 + if($is_head != BTemplate::IS_NO_HEADER) {
  168 + $pageSettingModel = new PageSetting();
  169 + $pageInfo = $pageSettingModel->read(['project_id' => $this->user['project_id']]);
  170 + if ($pageInfo === false) {
  171 + return $this->success($type);
  172 + }
  173 + if ($source == BTemplate::SOURCE_PRODUCT) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['product_details'] != 0) {$type = BTemplate::TYPE_PRODUCT_DETAIL;}}
  174 + else {if ($pageInfo['product_list'] != 0) {$type = BTemplate::TYPE_PRODUCT_LIST;}}}
  175 + if ($source == BTemplate::SOURCE_BLOG) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['blog_details'] != 0) {$type = BTemplate::TYPE_BLOG_DETAIL;}}
  176 + else {if ($pageInfo['blog_list'] != 0) {$type = BTemplate::TYPE_BLOG_LIST;}}}
  177 + if ($source == BTemplate::SOURCE_NEWS) {if ($is_list != BTemplate::IS_LIST) {if ($pageInfo['news_details'] != 0) {$type = BTemplate::TYPE_NEWS_DETAIL;}}
  178 + else {if ($pageInfo['news_list'] != 0) {$type = BTemplate::TYPE_NEWS_LIST;}}}
  179 + if ($source == BTemplate::SOURCE_KEYWORD) {if ($pageInfo['polymerization'] != 0) {$type = BTemplate::TYPE_CUSTOM_PAGE;}}
  180 + }
  181 + return $this->success($type);
111 } 182 }
112 183
113 /** 184 /**
@@ -417,7 +417,7 @@ class BTemplateLogic extends BaseLogic @@ -417,7 +417,7 @@ class BTemplateLogic extends BaseLogic
417 } 417 }
418 //更新头部信息 418 //更新头部信息
419 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']); 419 $this->saveCommonHtml($this->param['html'],$this->param['source'],$this->param['is_list'],$this->param['template_id'],$this->param['is_custom']);
420 - $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom']); 420 + $this->setOperationRecords($this->param['html'],$this->param['source'],$this->param['source_id'],$this->param['template_id'],$this->param['is_custom'],$this->param['is_list']);
421 //通知更新 421 //通知更新
422 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']); 422 $this->homeOrProduct($this->param['source'],$this->param['source_id'],$this->param['is_custom'],$this->param['is_list']);
423 return $this->success(); 423 return $this->success();
@@ -607,6 +607,7 @@ class BTemplateLogic extends BaseLogic @@ -607,6 +607,7 @@ class BTemplateLogic extends BaseLogic
607 $param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 607 $param['main_css'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
608 return $this->success($param); 608 return $this->success($param);
609 } 609 }
  610 +
610 /** 611 /**
611 * @remark :(非定制)保存时获取获取设置的类型 612 * @remark :(非定制)保存时获取获取设置的类型
612 * @name :getType 613 * @name :getType
@@ -646,7 +647,7 @@ class BTemplateLogic extends BaseLogic @@ -646,7 +647,7 @@ class BTemplateLogic extends BaseLogic
646 * @method :post 647 * @method :post
647 * @time :2023/8/23 11:16 648 * @time :2023/8/23 11:16
648 */ 649 */
649 - public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom,$type = 0){ 650 + public function setOperationRecords($html,$source,$source_id,$template_id,$is_custom = 0,$is_list = 0,$type = 0){
650 if($is_custom != BTemplate::IS_NO_CUSTOM){ 651 if($is_custom != BTemplate::IS_NO_CUSTOM){
651 return true; 652 return true;
652 } 653 }
@@ -657,6 +658,7 @@ class BTemplateLogic extends BaseLogic @@ -657,6 +658,7 @@ class BTemplateLogic extends BaseLogic
657 'text'=>$html, 658 'text'=>$html,
658 'type'=>$type, 659 'type'=>$type,
659 'is_custom'=>$is_custom, 660 'is_custom'=>$is_custom,
  661 + 'is_list'=>$is_list,
660 'source'=>$source, 662 'source'=>$source,
661 'source_id'=>$source_id, 663 'source_id'=>$source_id,
662 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'), 664 'main_html' => characterTruncation($html,'/<main\b[^>]*>(.*?)<\/main>/s'),
@@ -113,7 +113,7 @@ class CustomTemplateLogic extends BaseLogic @@ -113,7 +113,7 @@ class CustomTemplateLogic extends BaseLogic
113 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s'); 113 $this->param['html_style'] = characterTruncation($html,'/<style id="globalsojs-styles">(.*?)<\/style>/s');
114 $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']); 114 $this->setTemplateLog($bSettingInfo['template_id'],$html,$this->param['id']);
115 } 115 }
116 - $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); 116 + $rs = $this->model->edit($this->param,['id'=>$this->param['id'],'project_id'=>$this->user['project_id']]);
117 if($rs === false){ 117 if($rs === false){
118 $this->fail('系统错误,请联系管理'); 118 $this->fail('系统错误,请联系管理');
119 } 119 }
@@ -364,4 +364,37 @@ class CustomTemplateLogic extends BaseLogic @@ -364,4 +364,37 @@ class CustomTemplateLogic extends BaseLogic
364 } 364 }
365 return $this->success($data); 365 return $this->success($data);
366 } 366 }
  367 +
  368 + /**
  369 + * @remark :单页面还原
  370 + * @name :saveRollbackVersion
  371 + * @author :lyh
  372 + * @method :post
  373 + * @time :2024/4/23 14:00
  374 + */
  375 + public function saveRollbackVersion(){
  376 + //获取当前数据记录详情
  377 + $log = new BTemplateLog();
  378 + $logInfo = $log->read(['id'=>$this->param['id']]);
  379 + if($logInfo === false){
  380 + $this->fail('未获取到当前记录');
  381 + }
  382 + //获取当前数据详情
  383 + $info = $this->model->read(['id'=>$logInfo['source_id']],['is_visualization']);
  384 + if($info['is_visualization'] == 0 || $info['is_visualization'] == 1){
  385 + //还原头部底部
  386 + $type = $this->getType();
  387 + //还原头部+底部
  388 + $commonData = [
  389 + 'head_html'=>$logInfo['head_html'],
  390 + 'head_css'=>$logInfo['head_css'],
  391 + 'footer_html'=>$logInfo['footer_html'],
  392 + 'footer_css'=>$logInfo['footer_css']
  393 + ];
  394 + $commonTemplateModel = new BTemplateCommon();
  395 + $commonTemplateModel->edit($commonData,['template_id'=>$logInfo['template_id'],'type'=>$type,'project_id'=>$this->user['project_id']]);
  396 + }
  397 + $this->model->edit(['html'=>$logInfo['main_html'],'html_style'=>$logInfo['main_css']],['id'=>$logInfo['source_id']]);
  398 + return $this->success();
  399 + }
367 } 400 }
@@ -39,4 +39,23 @@ class DescribeLogic extends BaseLogic @@ -39,4 +39,23 @@ class DescribeLogic extends BaseLogic
39 } 39 }
40 return $this->success(); 40 return $this->success();
41 } 41 }
  42 +
  43 + /**
  44 + * @remark :删除数据
  45 + * @name :del
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2024/4/12 16:57
  49 + */
  50 + public function describeDel(){
  51 + if(is_array($this->param['ids'])){
  52 + $rs = $this->model->del(['id'=>['in',$this->param['ids']]]);
  53 + }else{
  54 + $rs = $this->model->del(['id'=>$this->param['ids']]);
  55 + }
  56 + if($rs === false){
  57 + $this->fail('系统错误,请联系管理员');
  58 + }
  59 + return $this->success();
  60 + }
42 } 61 }
@@ -273,22 +273,29 @@ class ProductLogic extends BaseLogic @@ -273,22 +273,29 @@ class ProductLogic extends BaseLogic
273 */ 273 */
274 public function handleSaveParam(&$param){ 274 public function handleSaveParam(&$param){
275 //产品图 275 //产品图
276 - if(isset($param['gallery'])){ 276 + if(isset($param['gallery']) && !empty($param['gallery'])){
277 foreach ($param['gallery'] as $k => $v){ 277 foreach ($param['gallery'] as $k => $v){
278 $v['url'] = str_replace_url($v['url']); 278 $v['url'] = str_replace_url($v['url']);
279 $param['gallery'][$k] = $v; 279 $param['gallery'][$k] = $v;
280 } 280 }
281 $param['thumb'] = Arr::a2s($param['gallery'][0] ?? []); 281 $param['thumb'] = Arr::a2s($param['gallery'][0] ?? []);
282 $param['gallery'] = Arr::a2s($param['gallery'] ?? []); 282 $param['gallery'] = Arr::a2s($param['gallery'] ?? []);
  283 + }else{
  284 + $param['thumb'] = Arr::a2s([]);
  285 + $param['gallery'] = Arr::a2s([]);
283 } 286 }
284 - if(isset($param['files'])){ 287 + if(isset($param['files']) && !empty($param['files'])){
285 $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); 288 $param['files']['url'] = str_replace_url($param['files']['url'] ?? '');
286 $param['files'] = Arr::a2s($param['files'] ?? []); 289 $param['files'] = Arr::a2s($param['files'] ?? []);
  290 + }else{
  291 + $param['files'] = Arr::a2s([]);
287 } 292 }
288 if(isset($param['video'])){ 293 if(isset($param['video'])){
289 $param['video']['url'] = str_replace_url($param['video']['url']); 294 $param['video']['url'] = str_replace_url($param['video']['url']);
290 $param['video']['video_image'] = str_replace_url($param['video']['video_image']); 295 $param['video']['video_image'] = str_replace_url($param['video']['video_image']);
291 $param['video'] = Arr::a2s($param['video'] ?? []); 296 $param['video'] = Arr::a2s($param['video'] ?? []);
  297 + }else{
  298 + $param['video'] = Arr::a2s([]);
292 } 299 }
293 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){ 300 if(isset($param['keyword_id']) && !empty($param['keyword_id'])){
294 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).','; 301 $param['keyword_id'] = ','.Arr::arrToSet($param['keyword_id']).',';
@@ -304,6 +311,8 @@ class ProductLogic extends BaseLogic @@ -304,6 +311,8 @@ class ProductLogic extends BaseLogic
304 $param['icon'][$k1] = str_replace_url($v1); 311 $param['icon'][$k1] = str_replace_url($v1);
305 } 312 }
306 $param['icon'] = Arr::a2s($param['icon'] ?? []); 313 $param['icon'] = Arr::a2s($param['icon'] ?? []);
  314 + }else{
  315 + $param['icon'] = Arr::a2s([]);
307 } 316 }
308 $param['created_uid'] = $this->user['id']; 317 $param['created_uid'] = $this->user['id'];
309 return $param; 318 return $param;
@@ -77,8 +77,8 @@ class RankDataLogic extends BaseLogic @@ -77,8 +77,8 @@ class RankDataLogic extends BaseLogic
77 'keyword_num' => $project['deploy_build']['keyword_num'], 77 'keyword_num' => $project['deploy_build']['keyword_num'],
78 'compliance_day' => $project['finish_remain_day'] ?? 0, 78 'compliance_day' => $project['finish_remain_day'] ?? 0,
79 'remain_day' => $project['deploy_build']['service_duration'] - ($project['finish_remain_day'] ?? 0), 79 'remain_day' => $project['deploy_build']['service_duration'] - ($project['finish_remain_day'] ?? 0),
  80 + 'g_top_plan' => $project['deploy_optimize']['g_top_plan'] ?? [],
80 ]; 81 ];
81 -  
82 //小语种列表 82 //小语种列表
83 $quanqiusou_api = new QuanqiusouApi(); 83 $quanqiusou_api = new QuanqiusouApi();
84 $lang_data = $quanqiusou_api->getLangRankData($api_no); 84 $lang_data = $quanqiusou_api->getLangRankData($api_no);
@@ -92,10 +92,11 @@ class RankDataLogic extends BaseLogic @@ -92,10 +92,11 @@ class RankDataLogic extends BaseLogic
92 $data['langs'][$lang['language'] ?? ''] = [ 92 $data['langs'][$lang['language'] ?? ''] = [
93 'lang_text' => $lang['language'], 93 'lang_text' => $lang['language'],
94 'keyword_num' => $lang['keywords'] ?? 0, 94 'keyword_num' => $lang['keywords'] ?? 0,
95 - 'reach_day' => $lang_data[$lang['language']]['dabiao_day'] ?? 0,  
96 - 'home_cnt' => $lang_data[$lang['language']]['home_cnt'] ?? 0, 95 + 'reach_day' => $lang_data[$lang['lang']]['dabiao_day'] ?? 0,
  96 + 'home_cnt' => $lang_data[$lang['lang']]['home_cnt'] ?? 0,
97 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day, 97 'remain_day' => ($lang['type']??0) == 1 ? $data['project']['remain_day'] : $lang['service_day'] - $remain_day,
98 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数 98 'type' => $lang['type'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数
  99 + 'service_day' => $lang['service_day'] ?? 0, //1 项目关键词 项目天数 2 保证首页关键词 项目达标天数
99 ]; 100 ];
100 } 101 }
101 } 102 }
@@ -424,8 +425,10 @@ class RankDataLogic extends BaseLogic @@ -424,8 +425,10 @@ class RankDataLogic extends BaseLogic
424 */ 425 */
425 public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){ 426 public function save_rank($project_id, $data, int $indexed_pages_num = 0, string $lang = ''){
426 $without_project_ids = []; //不用处理排名的项目 427 $without_project_ids = []; //不用处理排名的项目
  428 + $without_extension_project_ids = [658]; //是否达标只统计主词的
427 429
428 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0; 430 $first_num = $first_page_num = $first_three_pages_num = $first_five_pages_num = $first_ten_pages_num = 0;
  431 + $first_page_without_extension_num = 0; //不算扩展词在首页的数量
429 432
430 foreach ($data as &$ranks){ 433 foreach ($data as &$ranks){
431 ksort($ranks); 434 ksort($ranks);
@@ -446,6 +449,7 @@ class RankDataLogic extends BaseLogic @@ -446,6 +449,7 @@ class RankDataLogic extends BaseLogic
446 //排名第一页 449 //排名第一页
447 if($last['position'] > 0 && $last['position'] <= 10){ 450 if($last['position'] > 0 && $last['position'] <= 10){
448 $first_page_num ++; 451 $first_page_num ++;
  452 + $last['g'] == 1 && $first_page_without_extension_num++;
449 } 453 }
450 //排名前三页 454 //排名前三页
451 if($last['position'] > 0 && $last['position'] <= 30){ 455 if($last['position'] > 0 && $last['position'] <= 30){
@@ -460,8 +464,6 @@ class RankDataLogic extends BaseLogic @@ -460,8 +464,6 @@ class RankDataLogic extends BaseLogic
460 $first_ten_pages_num ++; 464 $first_ten_pages_num ++;
461 } 465 }
462 } 466 }
463 -  
464 -  
465 $where = [ 467 $where = [
466 'project_id' => $project_id, 468 'project_id' => $project_id,
467 'lang' => $lang 469 'lang' => $lang
@@ -470,28 +472,29 @@ class RankDataLogic extends BaseLogic @@ -470,28 +472,29 @@ class RankDataLogic extends BaseLogic
470 if(!$model){ 472 if(!$model){
471 $model = new RankData(); 473 $model = new RankData();
472 } 474 }
473 -  
474 //关键词达标天数 475 //关键词达标天数
475 //保证关键词数 476 //保证关键词数
476 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num'); 477 $keyword_num = DeployBuild::where('project_id', $project_id)->value('keyword_num');
477 $type = Project::where('id', $project_id)->value('type'); 478 $type = Project::where('id', $project_id)->value('type');
478 $model->is_compliance = 0; 479 $model->is_compliance = 0;
479 - if ($keyword_num && $type == Project::TYPE_TWO && $first_page_num >= $keyword_num) {  
480 - Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num);  
481 - 480 + //是否达标
  481 + $is_compliance = $first_page_num >= $keyword_num;
  482 + if(in_array($project_id, $without_extension_project_ids)){
  483 + $is_compliance = $first_page_without_extension_num >= $keyword_num;
  484 + }
  485 + if ($keyword_num && $type == Project::TYPE_TWO && $is_compliance) {
  486 + Log::channel('rank_data')->info('项目' . $project_id . ':关键词达标'. $keyword_num .' - ' . $first_page_num . ' - ' . $first_page_without_extension_num);
482 //项目表更新 487 //项目表更新
483 if (($model->updated_date != date('Y-m-d') || empty($model->is_compliance)) && !$lang) { 488 if (($model->updated_date != date('Y-m-d') || empty($model->is_compliance)) && !$lang) {
484 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0; 489 $compliance_day = Project::where(['id' => $project_id])->value('finish_remain_day') ?: 0;
485 Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]); 490 Project::where('id', $project_id)->update(['is_remain_today' => 1, 'finish_remain_day' => $compliance_day + 1]);
486 Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1)); 491 Log::channel('rank_data')->info('项目' . $project_id . '达标天数+1:'. ($compliance_day + 1));
487 } 492 }
488 -  
489 $model->compliance_day = $model->compliance_day + 1; 493 $model->compliance_day = $model->compliance_day + 1;
490 $model->is_compliance = 1; 494 $model->is_compliance = 1;
491 } else { 495 } else {
492 Log::channel('rank_data')->info('项目' . $project_id . ':关键词未达标'. $keyword_num .' - ' . $first_page_num); 496 Log::channel('rank_data')->info('项目' . $project_id . ':关键词未达标'. $keyword_num .' - ' . $first_page_num);
493 } 497 }
494 -  
495 $model->project_id = $project_id; 498 $model->project_id = $project_id;
496 $model->first_num = $first_num; 499 $model->first_num = $first_num;
497 $model->first_page_num = $first_page_num; 500 $model->first_page_num = $first_page_num;
@@ -54,16 +54,20 @@ class TranslateLogic extends BaseLogic @@ -54,16 +54,20 @@ class TranslateLogic extends BaseLogic
54 $text_array = $this->getUrlRead($url); 54 $text_array = $this->getUrlRead($url);
55 // 原始校对程序 55 // 原始校对程序
56 $old_key = [];//key值组成数据 56 $old_key = [];//key值组成数据
57 - if($info !== false){  
58 - $data_read = json_decode($info['data'],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 57 + $data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
  58 + if(!empty($data_read)){
59 foreach ($data_read as $k => $v){ 59 foreach ($data_read as $k => $v){
  60 + $k = urldecode($k);
60 $old_key[] = $k; 61 $old_key[] = $k;
61 $data[] = [$k => $v]; 62 $data[] = [$k => $v];
62 } 63 }
63 } 64 }
64 $arr2 = []; 65 $arr2 = [];
65 foreach ($text_array as $val) { 66 foreach ($text_array as $val) {
66 - if (FALSE == in_array($val, $old_key)){ 67 + if($val == ' '){
  68 + continue;
  69 + }
  70 + if (FALSE == in_array(trim(urldecode($val),' '), $old_key)){
67 $arr2[] = $val; 71 $arr2[] = $val;
68 } 72 }
69 } 73 }
@@ -251,7 +255,7 @@ class TranslateLogic extends BaseLogic @@ -251,7 +255,7 @@ class TranslateLogic extends BaseLogic
251 } 255 }
252 $this->param['data'] = $data; 256 $this->param['data'] = $data;
253 } 257 }
254 - try { 258 +// try {
255 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]); 259 $info = $this->model->read(['language_id'=>$this->param['language_id'],'url'=>$this->param['url'],'project_id'=>$this->user['project_id'],'type'=>$this->param['type']]);
256 if($info === false){ 260 if($info === false){
257 $param = [ 261 $param = [
@@ -262,21 +266,21 @@ class TranslateLogic extends BaseLogic @@ -262,21 +266,21 @@ class TranslateLogic extends BaseLogic
262 'alias'=>$this->param['alias'], 266 'alias'=>$this->param['alias'],
263 ]; 267 ];
264 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 268 $param['data'] = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
265 - $this->model->add($param); 269 + $rs = $this->model->add($param);
266 }else{ 270 }else{
267 if(!empty($data)){ 271 if(!empty($data)){
268 $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES); 272 $data = json_encode($data,JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
269 - $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]); 273 + $rs = $this->model->edit(['data'=>$data],['language_id'=>$this->param['language_id'],'project_id'=>$this->user['project_id'],'url'=>$this->param['url'],'type'=>$this->param['type']]);
270 } 274 }
271 } 275 }
272 //写日志 276 //写日志
273 $userLogModel = new UserLog(); 277 $userLogModel = new UserLog();
274 $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]); 278 $userLogModel->add(['model'=>'translate/save','remark'=>json_encode($this->param,true),'type'=>0,'operator_id'=>$this->user['id'],'project_id'=>$this->user['project_id']]);
275 - }catch (\Exception $e){  
276 - $this->fail('系统错误请联系管理员');  
277 - } 279 +// }catch (\Exception $e){
  280 +// $this->fail('系统错误请联系管理员');
  281 +// }
278 $this->handleRoute($this->param['url']); 282 $this->handleRoute($this->param['url']);
279 - return $this->success(); 283 + return $this->success($rs);
280 } 284 }
281 285
282 /** 286 /**
@@ -56,8 +56,6 @@ class UserLoginLogic @@ -56,8 +56,6 @@ class UserLoginLogic
56 } 56 }
57 $projectModel = new Project(); 57 $projectModel = new Project();
58 $project_list = $projectModel->list(['id'=>['in',$projectArr],'delete_status'=>0],'id',['id','title']); 58 $project_list = $projectModel->list(['id'=>['in',$projectArr],'delete_status'=>0],'id',['id','title']);
59 - //登录选择项目的有效时间  
60 - Cache::add('login-project-'.$this->param['mobile'],1,300);  
61 return $this->success($project_list); 59 return $this->success($project_list);
62 } 60 }
63 61
@@ -69,9 +67,6 @@ class UserLoginLogic @@ -69,9 +67,6 @@ class UserLoginLogic
69 * @time :2023/6/17 16:43 67 * @time :2023/6/17 16:43
70 */ 68 */
71 public function projectLogin(){ 69 public function projectLogin(){
72 - if(!Cache::get('login-project-'.$this->param['mobile'])){  
73 - $this->fail('当前用户选择项目有限时间已过期');  
74 - }  
75 //获取项目详情 70 //获取项目详情
76 $info = $this->assembleParam($this->param['mobile'],$this->param['project_id']); 71 $info = $this->assembleParam($this->param['mobile'],$this->param['project_id']);
77 if(isset($info['token']) && !empty($info['token'])){ 72 if(isset($info['token']) && !empty($info['token'])){
@@ -178,10 +173,12 @@ class UserLoginLogic @@ -178,10 +173,12 @@ class UserLoginLogic
178 $info['is_update_language'] = $project['is_update_language']; 173 $info['is_update_language'] = $project['is_update_language'];
179 $info['configuration'] = $project['deploy_build']['configuration']; 174 $info['configuration'] = $project['deploy_build']['configuration'];
180 $info['project_type'] = $project['type']; 175 $info['project_type'] = $project['type'];
  176 + $info['service_duration'] = $project['deploy_build']['service_duration'];
  177 + $info['remain_day'] = $project['remain_day'];
181 if($info['is_customized'] == 1){ 178 if($info['is_customized'] == 1){
182 $info['is_visualization'] = json_decode($project['is_visualization']); 179 $info['is_visualization'] = json_decode($project['is_visualization']);
183 } 180 }
184 - 181 + $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority'];
185 //是否开通AMP 182 //是否开通AMP
186 $is_amp = 0; 183 $is_amp = 0;
187 if(!empty($project['deploy_optimize']['domain'])){ 184 if(!empty($project['deploy_optimize']['domain'])){
@@ -277,10 +274,12 @@ class UserLoginLogic @@ -277,10 +274,12 @@ class UserLoginLogic
277 $info['project_type'] = $project['type']; 274 $info['project_type'] = $project['type'];
278 $info['storage_type'] = $project['storage_type']; 275 $info['storage_type'] = $project['storage_type'];
279 $info['project_location'] = $project['project_location']; 276 $info['project_location'] = $project['project_location'];
  277 + $info['service_duration'] = $project['deploy_build']['service_duration'] ?? 0;
  278 + $info['remain_day'] = $project['remain_day'] ?? 0;
280 if($info['is_customized'] == 1){ 279 if($info['is_customized'] == 1){
281 $info['is_visualization'] = json_decode($project['is_visualization']); 280 $info['is_visualization'] = json_decode($project['is_visualization']);
282 } 281 }
283 - 282 + $info['is_visualization_authority'] = $project['deploy_build']['is_visualization_authority'];
284 //是否开通AMP 283 //是否开通AMP
285 $is_amp = 0; 284 $is_amp = 0;
286 if(!empty($project['deploy_optimize']['domain'])){ 285 if(!empty($project['deploy_optimize']['domain'])){
@@ -58,6 +58,7 @@ class CopyProjectJob implements ShouldQueue @@ -58,6 +58,7 @@ class CopyProjectJob implements ShouldQueue
58 $type = $data['type']; 58 $type = $data['type'];
59 $data['type'] = 0; 59 $data['type'] = 0;
60 $data['status'] = 0; 60 $data['status'] = 0;
  61 + $data['finish_remain_day'] = 0;
61 $data['title'] = $data['title'].'-copy'; 62 $data['title'] = $data['title'].'-copy';
62 unset($data['id']); 63 unset($data['id']);
63 $project_id = $projectModel->insertGetId($data); 64 $project_id = $projectModel->insertGetId($data);
@@ -82,6 +83,8 @@ class CopyProjectJob implements ShouldQueue @@ -82,6 +83,8 @@ class CopyProjectJob implements ShouldQueue
82 $optimizeData = $optimizeData->getAttributes(); 83 $optimizeData = $optimizeData->getAttributes();
83 unset($optimizeData['id'],$optimizeData['domain']); 84 unset($optimizeData['id'],$optimizeData['domain']);
84 $optimizeData['project_id'] = $project_id; 85 $optimizeData['project_id'] = $project_id;
  86 + $optimizeData['api_no'] = 0;
  87 + $optimizeData['minor_languages'] = json_encode([]);
85 $optimizeModel->insert($optimizeData); 88 $optimizeModel->insert($optimizeData);
86 } 89 }
87 //复制付费表 90 //复制付费表
@@ -160,6 +163,9 @@ class CopyProjectJob implements ShouldQueue @@ -160,6 +163,9 @@ class CopyProjectJob implements ShouldQueue
160 $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}"); 163 $sql = DB::connection('custom_tmp_mysql_copy')->select("SHOW CREATE TABLE {$table}");
161 DB::connection('custom_mysql')->statement(get_object_vars($sql[0])['Create Table']); 164 DB::connection('custom_mysql')->statement(get_object_vars($sql[0])['Create Table']);
162 } 165 }
  166 + if($table == 'gl_customer_visit' || $table == 'gl_customer_visit_item' || $table == 'gl_inquiry_other' || $table == 'gl_inquiry_form_data' || $table == 'gl_inquiry_form'){
  167 + continue;
  168 + }
163 // DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据 169 // DB::connection('custom_mysql')->table($table)->truncate(); // 清空目标表数据
164 DB::connection('custom_mysql')->table($table)->insertUsing( 170 DB::connection('custom_mysql')->table($table)->insertUsing(
165 [], // 列名数组,留空表示插入所有列 171 [], // 列名数组,留空表示插入所有列
@@ -44,21 +44,18 @@ class EditCustomDomainBt implements ShouldQueue @@ -44,21 +44,18 @@ class EditCustomDomainBt implements ShouldQueue
44 if ($domain_info === false) { 44 if ($domain_info === false) {
45 return $this->output($domain_info['custom_domain'] . ':获取域名数据失败'); 45 return $this->output($domain_info['custom_domain'] . ':获取域名数据失败');
46 } 46 }
47 -  
48 //获取项目数据 47 //获取项目数据
49 $project_model = new Project(); 48 $project_model = new Project();
50 $project_info = $project_model->read(['id' => $domain_info['project_id']], 'serve_id'); 49 $project_info = $project_model->read(['id' => $domain_info['project_id']], 'serve_id');
51 if ($project_info === false) { 50 if ($project_info === false) {
52 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败'); 51 return $this->output($domain_info['custom_domain'] . ':获取项目数据失败');
53 } 52 }
54 -  
55 //获取服务器数据 53 //获取服务器数据
56 $server_model = new ServerConfig(); 54 $server_model = new ServerConfig();
57 $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']); 55 $server_info = $server_model->read(['id' => $project_info['serve_id']], ['init_domain', 'host']);
58 if ($server_info === false) { 56 if ($server_info === false) {
59 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败'); 57 return $this->output($domain_info['custom_domain'] . ':获取服务器数据失败');
60 } 58 }
61 -  
62 //编辑站点 59 //编辑站点
63 if ($domain_info['type'] == 2) { 60 if ($domain_info['type'] == 2) {
64 $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl'; 61 $api_url = 'http://' . $server_info['init_domain'] . '/api/setSsl';
@@ -10,9 +10,11 @@ @@ -10,9 +10,11 @@
10 namespace App\Models\ASide; 10 namespace App\Models\ASide;
11 11
12 use App\Helper\AyrShare as AyrShareHelper; 12 use App\Helper\AyrShare as AyrShareHelper;
  13 +use App\Helper\FormGlobalsoApi;
13 use App\Models\AyrShare\AyrShare as AyrShareModel; 14 use App\Models\AyrShare\AyrShare as AyrShareModel;
14 use App\Models\Base; 15 use App\Models\Base;
15 use App\Services\ProjectServer; 16 use App\Services\ProjectServer;
  17 +use Illuminate\Support\Facades\Cache;
16 use Illuminate\Support\Facades\DB; 18 use Illuminate\Support\Facades\DB;
17 19
18 class APublicModel extends Base 20 class APublicModel extends Base
@@ -30,16 +32,26 @@ class APublicModel extends Base @@ -30,16 +32,26 @@ class APublicModel extends Base
30 */ 32 */
31 public static function getNumByProjectId($project_id){ 33 public static function getNumByProjectId($project_id){
32 ProjectServer::useProject($project_id); 34 ProjectServer::useProject($project_id);
33 - $productNumber = DB::connection('custom_mysql')->table('gl_product')  
34 - ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();  
35 - $blogNumber = DB::connection('custom_mysql')->table('gl_blog')  
36 - ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();  
37 - $newsNumber = DB::connection('custom_mysql')->table('gl_news')  
38 - ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();  
39 - $keyNumber = DB::connection('custom_mysql')->table('gl_product_keyword')  
40 - ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count(); 35 + $data = Cache::get('product_blog_news_'.$project_id);
  36 + if(!$data){
  37 + $productNumber = DB::connection('custom_mysql')->table('gl_product')
  38 + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
  39 + $blogNumber = DB::connection('custom_mysql')->table('gl_blog')
  40 + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
  41 + $newsNumber = DB::connection('custom_mysql')->table('gl_news')
  42 + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
  43 + $keyNumber = DB::connection('custom_mysql')->table('gl_product_keyword')
  44 + ->where('project_id', $project_id)->where('status', self::STATUS_ON)->count();
  45 + //获取项目的询盘数量
  46 + $inquiryNumber = 0;
  47 + $countInfo = DB::table('gl_count')->where('project_id', $project_id)->orderBy('id', 'desc')->first();
  48 + if(!empty($countInfo)){
  49 + $inquiryNumber = $countInfo->inquiry_num ?? 0;
  50 + }
  51 + $data = ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber,'inquiry'=>$inquiryNumber];
  52 + Cache::add('product_blog_news_'.$project_id,$data,30 * 60);
  53 + }
41 DB::disconnect('custom_mysql'); 54 DB::disconnect('custom_mysql');
42 - return ['product'=>$productNumber,'blog'=>$blogNumber,'news'=>$newsNumber,'key'=>$keyNumber]; 55 + return $data;
43 } 56 }
44 -  
45 } 57 }
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ErrorFile.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/4/16 17:00
  8 + */
  9 +
  10 +namespace App\Models\File;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ErrorFile extends Base
  15 +{
  16 + protected $table = 'gl_error_file';
  17 +}
@@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes; @@ -8,7 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
8 8
9 class Keyword extends Base 9 class Keyword extends Base
10 { 10 {
11 - use SoftDeletes; 11 +// use SoftDeletes;
12 12
13 //设置关联表名 13 //设置关联表名
14 protected $table = 'gl_product_keyword'; 14 protected $table = 'gl_product_keyword';
@@ -19,7 +19,9 @@ class DeployOptimize extends Base @@ -19,7 +19,9 @@ class DeployOptimize extends Base
19 public function getMinorLanguagesAttribute($value){ 19 public function getMinorLanguagesAttribute($value){
20 return Arr::s2a($value); 20 return Arr::s2a($value);
21 } 21 }
22 - 22 + public function getGTopPlanAttribute($value){
  23 + return Arr::s2a($value);
  24 + }
23 public static function clearCache($row){ 25 public static function clearCache($row){
24 $cache_key = 'project_' . $row->original['domain']; 26 $cache_key = 'project_' . $row->original['domain'];
25 Cache::forget($cache_key); 27 Cache::forget($cache_key);
@@ -9,6 +9,7 @@ use App\Models\Devops\ServerConfig; @@ -9,6 +9,7 @@ use App\Models\Devops\ServerConfig;
9 use App\Models\Optimize\Process; 9 use App\Models\Optimize\Process;
10 use App\Services\Facades\Upload; 10 use App\Services\Facades\Upload;
11 use Illuminate\Support\Facades\Cache; 11 use Illuminate\Support\Facades\Cache;
  12 +use App\Models\Domain\DomainInfo as DomainInfoModel;
12 13
13 class Project extends Base 14 class Project extends Base
14 { 15 {
@@ -354,19 +355,23 @@ class Project extends Base @@ -354,19 +355,23 @@ class Project extends Base
354 $project_id = DeployBuild::where('test_domain', 'https://' . $domain . '/')->value('project_id'); 355 $project_id = DeployBuild::where('test_domain', 'https://' . $domain . '/')->value('project_id');
355 //是否正式域名 356 //是否正式域名
356 if (!$project_id) { 357 if (!$project_id) {
357 - //是否小语种域名或amp站域名  
358 - $domainPrefix = explode(".",$domain);  
359 - if (!empty($domainPrefix)){  
360 - if($domainPrefix[0] == 'm'){  
361 - $domain = "www.".$domainPrefix[1].".".$domainPrefix[2];  
362 - }else{  
363 - $isLang = Translate::getTls($domainPrefix[0]);  
364 - if ($isLang) { 358 + $domainModel = new DomainInfoModel();
  359 + $project_id = $domainModel->formatQuery(['domain'=>$domain,'status'=>1])->value('project_id');
  360 + if (empty($project_id)) {
  361 + //是否小语种域名或amp站域名
  362 + $domainPrefix = explode(".",$domain);
  363 + if (!empty($domainPrefix)){
  364 + if($domainPrefix[0] == 'm'){
365 $domain = "www.".$domainPrefix[1].".".$domainPrefix[2]; 365 $domain = "www.".$domainPrefix[1].".".$domainPrefix[2];
  366 + }else{
  367 + $isLang = Translate::getTls($domainPrefix[0]);
  368 + if ($isLang) {
  369 + $domain = "www.".$domainPrefix[1].".".$domainPrefix[2];
  370 + }
366 } 371 }
367 } 372 }
  373 + $project_id = $domainModel->formatQuery(['domain'=>$domain,'status'=>1])->value('project_id');
368 } 374 }
369 - $project_id = \App\Models\Domain\DomainInfo::where('domain', $domain)->value('project_id');  
370 } 375 }
371 $project = self::find($project_id ?: 0); 376 $project = self::find($project_id ?: 0);
372 if($project){ 377 if($project){
@@ -40,12 +40,10 @@ class ProjectServer @@ -40,12 +40,10 @@ class ProjectServer
40 config(['database.connections.custom_mysql.database' => $project->databaseName()]); 40 config(['database.connections.custom_mysql.database' => $project->databaseName()]);
41 config(['database.connections.custom_mysql.username' => $project->mysqlConfig->user]); 41 config(['database.connections.custom_mysql.username' => $project->mysqlConfig->user]);
42 config(['database.connections.custom_mysql.password' => $project->mysqlConfig->password]); 42 config(['database.connections.custom_mysql.password' => $project->mysqlConfig->password]);
43 -  
44 //清除现有的数据库连接配置 43 //清除现有的数据库连接配置
45 DB::purge('custom_mysql'); 44 DB::purge('custom_mysql');
46 //重连 45 //重连
47 DB::connection('custom_mysql')->reconnect(); 46 DB::connection('custom_mysql')->reconnect();
48 -  
49 // 设置 redis 配置 47 // 设置 redis 配置
50 return $project; 48 return $project;
51 } 49 }
@@ -172,7 +170,7 @@ class ProjectServer @@ -172,7 +170,7 @@ class ProjectServer
172 * @method :post 170 * @method :post
173 * @time :2023/12/29 9:32 171 * @time :2023/12/29 9:32
174 */ 172 */
175 - public function init404Page($project_id){ 173 + public static function init404Page($project_id){
176 $time = date('Y-m-d H:i:s'); 174 $time = date('Y-m-d H:i:s');
177 $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first(); 175 $info = DB::connection('custom_mysql')->table('gl_web_custom_template')->first();
178 if(empty($info)) { 176 if(empty($info)) {
@@ -204,6 +204,11 @@ class SyncSubmitTaskService @@ -204,6 +204,11 @@ class SyncSubmitTaskService
204 } 204 }
205 205
206 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id); 206 $config = InquiryFilterConfig::getCacheInfoByProjectId($project_id);
  207 + //没配置 则默认开启且使用全局
  208 + if($config){
  209 + $config['is_global_rule'] = 1;
  210 + $config['status'] = 1;
  211 + }
207 //是否开启过滤 212 //是否开启过滤
208 if($config && $config['status']){ 213 if($config && $config['status']){
209 //是否包含全局规则(就是project_id=1的配置) 214 //是否包含全局规则(就是project_id=1的配置)
@@ -262,7 +267,7 @@ class SyncSubmitTaskService @@ -262,7 +267,7 @@ class SyncSubmitTaskService
262 //过滤邮箱 267 //过滤邮箱
263 if($config['filter_emails'] && !empty($data['data']['email'])){ 268 if($config['filter_emails'] && !empty($data['data']['email'])){
264 foreach ($config['filter_emails'] as $filter_email){ 269 foreach ($config['filter_emails'] as $filter_email){
265 - if($data['data']['email'] == $filter_email){ 270 + if(Str::contains($data['data']['email'], $filter_email)){
266 throw new InquiryFilterException( '过滤邮箱:' . $filter_email); 271 throw new InquiryFilterException( '过滤邮箱:' . $filter_email);
267 } 272 }
268 } 273 }
@@ -270,7 +275,7 @@ class SyncSubmitTaskService @@ -270,7 +275,7 @@ class SyncSubmitTaskService
270 //过滤电话 275 //过滤电话
271 if($config['filter_mobiles'] && !empty($data['data']['phone'])){ 276 if($config['filter_mobiles'] && !empty($data['data']['phone'])){
272 foreach ($config['filter_mobiles'] as $filter_mobile){ 277 foreach ($config['filter_mobiles'] as $filter_mobile){
273 - if($data['data']['phone'] == $filter_mobile){ 278 + if(Str::contains($data['data']['phone'], $filter_mobile)){
274 throw new InquiryFilterException( '过滤电话:' . $filter_mobile); 279 throw new InquiryFilterException( '过滤电话:' . $filter_mobile);
275 } 280 }
276 } 281 }
@@ -278,7 +283,7 @@ class SyncSubmitTaskService @@ -278,7 +283,7 @@ class SyncSubmitTaskService
278 //过滤姓名 283 //过滤姓名
279 if($config['filter_names'] && !empty($data['data']['name'])){ 284 if($config['filter_names'] && !empty($data['data']['name'])){
280 foreach ($config['filter_names'] as $filter_name){ 285 foreach ($config['filter_names'] as $filter_name){
281 - if($data['data']['name'] == $filter_name){ 286 + if( Str::contains($data['data']['name'], $filter_name)){
282 throw new InquiryFilterException( '过滤姓名:' . $filter_name); 287 throw new InquiryFilterException( '过滤姓名:' . $filter_name);
283 } 288 }
284 } 289 }
@@ -258,7 +258,7 @@ Route::middleware(['bloginauth'])->group(function () { @@ -258,7 +258,7 @@ Route::middleware(['bloginauth'])->group(function () {
258 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd'); 258 Route::post('keyword/batchAdd', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchAdd'])->name('product_keyword_batchAdd');
259 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel'); 259 Route::post('keyword/batchDel', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchDel'])->name('product_keyword_batchDel');
260 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete'); 260 Route::any('keyword/delete', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'delete'])->name('product_keyword_delete');
261 - 261 + Route::any('keyword/batchKeywordFiled', [\App\Http\Controllers\Bside\Product\KeywordController::class, 'batchKeywordFiled'])->name('product_keyword_batchKeywordFiled');
262 //产品参数 262 //产品参数
263 Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr'); 263 Route::get('attr', [\App\Http\Controllers\Bside\Product\AttrController::class, 'index'])->name('product_attr');
264 Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info'); 264 Route::get('attr/info', [\App\Http\Controllers\Bside\Product\AttrController::class, 'info'])->name('product_attr_info');
@@ -396,6 +396,8 @@ Route::middleware(['bloginauth'])->group(function () { @@ -396,6 +396,8 @@ Route::middleware(['bloginauth'])->group(function () {
396 Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml'); 396 Route::any('/saveHtml', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'saveHtml'])->name('custom_saveHtml');
397 Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('custom_statusNum'); 397 Route::any('/statusNum', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'statusNumber'])->name('custom_statusNum');
398 Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del'); 398 Route::any('/del', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'del'])->name('custom_del');
  399 + Route::any('/rollbackVersion', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'rollbackVersion'])->name('custom_rollbackVersion');
  400 + Route::any('/getCustomTemplateLog', [\App\Http\Controllers\Bside\Template\CustomTemplateController::class, 'getCustomTemplateLog'])->name('custom_getCustomTemplateLog');
399 }); 401 });
400 // 菜单组 402 // 菜单组
401 Route::prefix('nav_group')->group(function () { 403 Route::prefix('nav_group')->group(function () {