作者 赵彬吉
@@ -40,7 +40,7 @@ class AiBlogTask extends Command @@ -40,7 +40,7 @@ class AiBlogTask extends Command
40 while (true){ 40 while (true){
41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first(); 41 $info = $aiBlogTaskModel->where('status',1)->orderBy('id','asc')->first();
42 if($info === false){ 42 if($info === false){
43 - sleep(20); 43 + sleep(30);
44 continue; 44 continue;
45 } 45 }
46 $info = $info->toArray(); 46 $info = $info->toArray();
1 -<?php  
2 -  
3 -namespace App\Console\Commands\DayCount;  
4 -  
5 -use App\Models\Inquiry\InquiryInfo;  
6 -use Illuminate\Console\Command;  
7 -  
8 -/**  
9 - * @remark :  
10 - * @class :InquiryDelay.php  
11 - * @author :lyh  
12 - * @time :2023/7/14 10:16  
13 - */  
14 -class InquiryDelay extends Command  
15 -{  
16 - /**  
17 - * The name and signature of the console command.  
18 - *  
19 - * @var string  
20 - */  
21 - protected $signature = 'inquiry_delay';  
22 -  
23 - /**  
24 - * The console command description.  
25 - *  
26 - * @var string  
27 - */  
28 - protected $description = '延时询盘转发(暂时弃用)';  
29 -  
30 - /**  
31 - * @remark :延时询盘转发  
32 - * @name :handle  
33 - * @author :lyh  
34 - * @method :post  
35 - * @time :2023/7/14 10:17  
36 - */  
37 - public function handle()  
38 - {  
39 - $inquiryInfoModel = new InquiryInfo();  
40 - $param = $inquiryInfoModel->formatQuery(['status'=>$inquiryInfoModel::STATUS_FOUR])->orderBy('send_time','asc')->first();  
41 - if(!empty($param)){  
42 - $time = date('Y-m-d H:i:s');  
43 - if($time >= $param['send_time']){  
44 - $data = [];  
45 - //TODO::处理转发的url  
46 - $arr_url = explode(',',$param['forward_url']);  
47 - foreach ($arr_url as $v){  
48 - $data['url'] = $v;  
49 - $this->inquiryForward($data);  
50 - }  
51 - $inquiryInfoModel->edit(['status'=>$inquiryInfoModel::STATUS_THREE],['id'=>$param['id']]);  
52 - }  
53 - }  
54 - return true;  
55 - }  
56 -  
57 - /**  
58 - * @remark :询盘转发  
59 - * @name :inquiryForward  
60 - * @author :lyh  
61 - * @method :post  
62 - * @time :2023/7/13 14:39  
63 - */  
64 - public function inquiryForward($post_data){  
65 - $url = 'https://form.globalso.com/api/external-interface/add/fa043f9cbec6b38f';  
66 - $post_data_new = [];  
67 - $post_data_new['refer'] = $post_data['url'];  
68 - $post_data_new['name'] = $post_data['name'];  
69 - $post_data_new['email'] = $post_data['email'];  
70 - $post_data_new['phone'] = $post_data['phone'];  
71 - $post_data_new['ip'] = $post_data['ip'];  
72 - $post_data_new['message'] = $post_data['message'];  
73 - $post_data_new['submit_time'] = date('Y-m-d H:i:s',time()+20);  
74 - $token = md5($post_data_new['refer'].$post_data_new['name'].$post_data_new['ip'].date("Y-m-d",time()));  
75 - $post_data_new['token'] = $token;  
76 - $header = array(  
77 - 'CLIENT-IP: '.$post_data['ip'],  
78 - 'X-FORWARDED-FOR: '.$post_data['ip']  
79 - );  
80 - return http_post($url,$post_data_new,$header);  
81 - }  
82 -  
83 -}  
@@ -71,76 +71,95 @@ class SyncInquiryRelay extends Command @@ -71,76 +71,95 @@ class SyncInquiryRelay extends Command
71 */ 71 */
72 public function getInquirySzcm() 72 public function getInquirySzcm()
73 { 73 {
74 - $max_origin_key = InquiryInfo::where('type', 4)->orderBy('origin_key', 'desc')->value('origin_key'); 74 + $max_origin_key = InquiryInfo::where('type', InquiryInfo::TYPE_SPIDER)->orderBy('origin_key', 'desc')->value('origin_key');
75 if ($max_origin_key) { 75 if ($max_origin_key) {
76 $start_id = $max_origin_key + 1; 76 $start_id = $max_origin_key + 1;
77 } else { 77 } else {
78 $start_id = 65029; 78 $start_id = 65029;
79 } 79 }
80 80
  81 + // TODO 由于该渠道数据不规则, 可能某个ID获取不到数据, 无法判断是因为已经没有数据了, 还是因为解析问题导致, 所以当未获取到数据时, 多向后取几次数据, 连续几次没有数据, 就认为已经获取到最大数据。
81 $service = new InquiryRelayService(); 82 $service = new InquiryRelayService();
  83 + $pre = 0;
82 while ($start_id > 0) { 84 while ($start_id > 0) {
83 $result = $service->getInquirySzcm($start_id); 85 $result = $service->getInquirySzcm($start_id);
  86 + if (empty($result) && $pre <= 3) {
  87 + $start_id++;
  88 + $pre++;
  89 + continue;
  90 + }
  91 +
84 if ($result) { 92 if ($result) {
85 - $this->saveDate($result, 4);  
86 - $start_id += 1;  
87 - } else {  
88 - $start_id = 0; 93 + $this->saveDate($result, InquiryInfo::TYPE_SPIDER);
  94 + $start_id++;
  95 + $pre = 0;
89 } 96 }
  97 +
  98 + if ($pre > 3)
  99 + break;
90 } 100 }
  101 + return true;
91 } 102 }
92 103
  104 + /**
  105 + * 询盘数据入库
  106 + * @param $data
  107 + * @param $type
  108 + * @return bool
  109 + */
93 public function saveDate($data, $type) 110 public function saveDate($data, $type)
94 { 111 {
95 $model = new InquiryInfo(); 112 $model = new InquiryInfo();
96 $message_sign = md5($data['name'] . $data['email'] . $data['phone'] . $data['ip'] . $data['time']); 113 $message_sign = md5($data['name'] . $data['email'] . $data['phone'] . $data['ip'] . $data['time']);
97 $inquiry_info = $model->where('message_sign', $message_sign)->first(); 114 $inquiry_info = $model->where('message_sign', $message_sign)->first();
98 - if (!$inquiry_info) {  
99 - //没有IP,根据submit_country获取  
100 - if (empty($data['ip']) && isset($data['submit_country']) && $data['submit_country']) {  
101 - $chinese_name = DB::table('gl_world_country_city')->where('pid', 0)->where('iso2', $data['submit_country'])->value('chinese_name');  
102 - $data['ip'] = $this->getIpData($chinese_name);  
103 - } 115 + if ($inquiry_info)
  116 + return true;
104 117
105 - //获取country  
106 - $country = '';  
107 - if ($data['ip']) {  
108 - $country = file_get_contents("http://ip.globalso.com?ip=" . $data['ip']);  
109 - } 118 + //没有IP,根据submit_country获取
  119 + if (empty($data['ip']) && isset($data['submit_country']) && $data['submit_country']) {
  120 + $chinese_name = DB::table('gl_world_country_city')->where('pid', 0)->where('iso2', $data['submit_country'])->value('chinese_name');
  121 + $data['ip'] = $this->getIpData($chinese_name);
  122 + }
110 123
111 - //翻译message  
112 - $message_cn = '';  
113 - $re_message_trans = Translate::translate($data['message'], 'zh');  
114 - if (isset($re_message_trans[0]['code']) && $re_message_trans[0]['code'] == 200) {  
115 - $message_cn = $re_message_trans[0]['texts'];  
116 - } 124 + //获取country
  125 + $country = '';
  126 + if ($data['ip']) {
  127 + $country = file_get_contents("http://ip.globalso.com?ip=" . $data['ip']);
  128 + }
117 129
118 - //获取页面上title和keywords  
119 - $html = curl_c($data['refer'], false); 130 + //翻译message
  131 + $message_cn = '';
  132 + $re_message_trans = Translate::translate($data['message'], 'zh');
  133 + if (isset($re_message_trans[0]['code']) && $re_message_trans[0]['code'] == 200) {
  134 + $message_cn = $re_message_trans[0]['texts'];
  135 + }
120 136
121 - if (empty($data['title'])) {  
122 - preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches);  
123 - if (!empty($matches[1])) {  
124 - $data['title'] = substr($matches[1][0], 0, 255);  
125 - }  
126 - } 137 + //获取页面上title和keywords
  138 + $html = curl_c($data['refer'], false);
127 139
128 - $keywords = '';  
129 - preg_match_all('/<meta\s+[^>]*?name=[\'|\"]keywords[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches); 140 + if (empty($data['title'])) {
  141 + preg_match_all('/<title>([\w\W]*?)<\/title>/', $html, $matches);
130 if (!empty($matches[1])) { 142 if (!empty($matches[1])) {
131 - $keywords = substr($matches[1][0], 0, 255); 143 + $data['title'] = substr($matches[1][0], 0, 255);
132 } 144 }
  145 + }
133 146
134 - if (empty($data['origin_key'])) {  
135 - $data['origin_key'] = 0;  
136 - } 147 + $keywords = '';
  148 + preg_match_all('/<meta\s+[^>]*?name=[\'|\"]keywords[\'|\"]\s+[^>]*?content=[\'|\"]([\w\W]*?)[\'|\"]/', $html, $matches);
  149 + if (!empty($matches[1])) {
  150 + $keywords = substr($matches[1][0], 0, 255);
  151 + }
137 152
138 - if (empty($data['image'])) {  
139 - $data['image'] = '';  
140 - } 153 + if (empty($data['origin_key'])) {
  154 + $data['origin_key'] = 0;
  155 + }
141 156
142 - $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image']); 157 + if (empty($data['image'])) {
  158 + $data['image'] = '';
143 } 159 }
  160 +
  161 + $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image']);
  162 + return true;
144 } 163 }
145 164
146 /** 165 /**
@@ -477,6 +477,17 @@ class UpdateSeoTdk extends Command @@ -477,6 +477,17 @@ class UpdateSeoTdk extends Command
477 $prompt = str_replace($val, $keyword, $prompt); 477 $prompt = str_replace($val, $keyword, $prompt);
478 } 478 }
479 } 479 }
  480 +
  481 + // 多个核心关键词
  482 + if(strpos($prompt, '{core keywords 8}') !== false) {
  483 + $main_keyword = $this->mainKeywords($project_id, 8);
  484 + if(!$main_keyword){
  485 + echo '核心关键词为空 跳过' . PHP_EOL;
  486 + return false;
  487 + }
  488 + $prompt = str_replace('{core keywords 8}', $main_keyword, $prompt);
  489 + }
  490 +
480 $prompt .= '.Please answer in ' . $this->getLang(); 491 $prompt .= '.Please answer in ' . $this->getLang();
481 return $prompt; 492 return $prompt;
482 } 493 }
@@ -12,10 +12,12 @@ use App\Models\Product\Keyword; @@ -12,10 +12,12 @@ use App\Models\Product\Keyword;
12 use App\Models\Product\KeywordRelated; 12 use App\Models\Product\KeywordRelated;
13 use App\Models\Product\Product; 13 use App\Models\Product\Product;
14 use App\Models\Project\Project; 14 use App\Models\Project\Project;
  15 +use App\Models\Project\ProjectUpdateTdk;
15 use App\Models\WebSetting\WebLanguage; 16 use App\Models\WebSetting\WebLanguage;
16 use App\Services\BatchExportService; 17 use App\Services\BatchExportService;
17 use App\Services\ProjectServer; 18 use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 19 use Illuminate\Console\Command;
  20 +use Illuminate\Support\Facades\DB;
19 21
20 class Temp extends Command 22 class Temp extends Command
21 { 23 {
@@ -35,7 +37,43 @@ class Temp extends Command @@ -35,7 +37,43 @@ class Temp extends Command
35 37
36 public function handle() 38 public function handle()
37 { 39 {
38 - $this->create_update_keyword_page(); 40 + $this->check_no_cname_projects();
  41 + }
  42 +
  43 + /**
  44 + * 2025-02-05 日以来的项目,重写tdk(keyword_title)
  45 + * @author Akun
  46 + * @date 2025/02/15 10:58
  47 + */
  48 + public function product_keyword_rewrite()
  49 + {
  50 + $products = ProjectUpdateTdk::where('created_at', '>=', '2025-02-05 00:00:00')->pluck('project_id')->toArray();
  51 + $products_ids = array_unique($products);
  52 +
  53 + $success_json = file_get_contents(storage_path('logs/lk/success.log'));
  54 + $success = json_decode($success_json, true) ?: [];
  55 +
  56 + foreach ($products_ids as $project_id) {
  57 + if (in_array($project_id, $success)) {
  58 + $this->output($project_id . ' | 已执行,跳过');
  59 + continue;
  60 + }
  61 +
  62 + ProjectServer::useProject($project_id);
  63 + DB::connection('custom_mysql')->table('gl_product_keyword')->update(['keyword_title' => '']);
  64 +
  65 + try {
  66 + ProjectUpdateTdk::add_task($project_id);
  67 + } catch (\Exception $e) {
  68 + $this->output($project_id . ' | ' . $e->getMessage());
  69 + }
  70 +
  71 + DB::disconnect('custom_mysql');
  72 + array_push($success, $project_id);
  73 + file_put_contents(storage_path('logs/lk/success.log'), json_encode($success));
  74 + }
  75 +
  76 + $this->output('success');
39 } 77 }
40 78
41 /** 79 /**
@@ -342,8 +380,8 @@ class Temp extends Command @@ -342,8 +380,8 @@ class Temp extends Command
342 */ 380 */
343 public function check_no_cname_projects() 381 public function check_no_cname_projects()
344 { 382 {
345 - $server_id = 15;  
346 - $server_name = '美服1'; 383 + $server_id = 1;
  384 + $server_name = '硅谷云服务器';
347 385
348 $server_ip_model = new ServersIp(); 386 $server_ip_model = new ServersIp();
349 387
@@ -575,7 +613,7 @@ class Temp extends Command @@ -575,7 +613,7 @@ class Temp extends Command
575 */ 613 */
576 public function create_update_keyword_page() 614 public function create_update_keyword_page()
577 { 615 {
578 - $ids_arr = ["46","83","91","150","190","206","219","221","232","233","238","287","290","299","319","321","353","356","388","389","456","457","475","491","518","535","554","600","624","650","728","732","783","807","835","881","896","913","947","1001","1320","1336","1373","1424","1442","1455","1466","1505","1584","1597","1617","1682","1770","1816","1824","1835","1860","1870","1896","1913","1989","1991","1992","2022","2037","2059","2060","2062","2104","2115","2129","2131","2135","2191","2204","2217","2245","2257","2287","2309","2313","2330","2336","2337","2338","2351","2391","2418","2423","2435","2462","2496","2504","2505","2660","2768","2811","2874","3157"]; 616 + $ids_arr = ["46", "83", "91", "150", "190", "206", "219", "221", "232", "233", "238", "287", "290", "299", "319", "321", "353", "356", "388", "389", "456", "457", "475", "491", "518", "535", "554", "600", "624", "650", "728", "732", "783", "807", "835", "881", "896", "913", "947", "1001", "1320", "1336", "1373", "1424", "1442", "1455", "1466", "1505", "1584", "1597", "1617", "1682", "1770", "1816", "1824", "1835", "1860", "1870", "1896", "1913", "1989", "1991", "1992", "2022", "2037", "2059", "2060", "2062", "2104", "2115", "2129", "2131", "2135", "2191", "2204", "2217", "2245", "2257", "2287", "2309", "2313", "2330", "2336", "2337", "2338", "2351", "2391", "2418", "2423", "2435", "2462", "2496", "2504", "2505", "2660", "2768", "2811", "2874", "3157"];
579 $project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get(); 617 $project_list = Project::select(['id', 'serve_id'])->whereIn('id', $ids_arr)->get();
580 618
581 $domain_model = new DomainInfo(); 619 $domain_model = new DomainInfo();
@@ -367,16 +367,16 @@ class ProjectUpdate extends Command @@ -367,16 +367,16 @@ class ProjectUpdate extends Command
367 'six_read' => 1, 367 'six_read' => 1,
368 'route' => $route 368 'route' => $route
369 ]); 369 ]);
370 - if(!empty($content)){ 370 + if (!empty($content)) {
371 $data_s = [ 371 $data_s = [
372 - 'product_id'=>$id,  
373 - 'column_id'=>1,  
374 - 'text_type'=>1,  
375 - 'title'=>'product detail',  
376 - 'sort'=>1,  
377 - 'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),  
378 - 'created_at'=>date('Y-m-d H:i:s'),  
379 - 'updated_at'=>date('Y-m-d H:i:s') 372 + 'product_id' => $id,
  373 + 'column_id' => 1,
  374 + 'text_type' => 1,
  375 + 'title' => 'product detail',
  376 + 'sort' => 1,
  377 + 'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
  378 + 'created_at' => date('Y-m-d H:i:s'),
  379 + 'updated_at' => date('Y-m-d H:i:s')
380 ]; 380 ];
381 $detailModel = new Detail(); 381 $detailModel = new Detail();
382 $detailModel->insert($data_s); 382 $detailModel->insert($data_s);
@@ -407,18 +407,18 @@ class ProjectUpdate extends Command @@ -407,18 +407,18 @@ class ProjectUpdate extends Command
407 'sort' => $item['sort'] ?? 0, 407 'sort' => $item['sort'] ?? 0,
408 'files' => $files, 408 'files' => $files,
409 ], ['id' => $id]); 409 ], ['id' => $id]);
410 - if(!empty($content)){ 410 + if (!empty($content)) {
411 $detailModel = new Detail(); 411 $detailModel = new Detail();
412 - $detailModel->del(['product_id'=>$id,'column_id'=>1]); 412 + $detailModel->del(['product_id' => $id, 'column_id' => 1]);
413 $data_s = [ 413 $data_s = [
414 - 'product_id'=>$id,  
415 - 'column_id'=>1,  
416 - 'text_type'=>1,  
417 - 'title'=>'product detail',  
418 - 'sort'=>1,  
419 - 'content'=>json_encode(['content'=>$content ?? ''],JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),  
420 - 'created_at'=>date('Y-m-d H:i:s'),  
421 - 'updated_at'=>date('Y-m-d H:i:s') 414 + 'product_id' => $id,
  415 + 'column_id' => 1,
  416 + 'text_type' => 1,
  417 + 'title' => 'product detail',
  418 + 'sort' => 1,
  419 + 'content' => json_encode(['content' => $content ?? ''], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES),
  420 + 'created_at' => date('Y-m-d H:i:s'),
  421 + 'updated_at' => date('Y-m-d H:i:s')
422 ]; 422 ];
423 $detailModel->insert($data_s); 423 $detailModel->insert($data_s);
424 } 424 }
@@ -706,14 +706,20 @@ class ProjectUpdate extends Command @@ -706,14 +706,20 @@ class ProjectUpdate extends Command
706 $route = $this->get_url_route($item['url'] ?? ''); 706 $route = $this->get_url_route($item['url'] ?? '');
707 if ($route) { 707 if ($route) {
708 //分类 708 //分类
  709 + $category_custom = $category_model->read(['route' => $custom_info['route']], 'id');
  710 + $category_model_id = $category_custom ? $category_custom['id'] : 0;
  711 +
709 $category_id = ''; 712 $category_id = '';
710 if ($item['category'] ?? []) { 713 if ($item['category'] ?? []) {
711 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]); 714 $category_arr = $category_model->list(['original_id' => ['in', array_column($item['category'], 'id')]]);
712 - $category_id = implode(',', array_column($category_arr, 'id')); 715 + $category_id_arr = array_column($category_arr, 'id');
  716 + if ($category_model_id > 0 && (!in_array($category_model_id, $category_id_arr))) {
  717 + array_push($category_id_arr, $category_model_id);
  718 + }
  719 + $category_id = implode(',', $category_id_arr);
713 } else { 720 } else {
714 - $category_custom = $category_model->read(['route' => $custom_info['route']], 'id');  
715 - if ($category_custom) {  
716 - $category_id = $category_custom['id']; 721 + if ($category_model_id > 0) {
  722 + $category_id = $category_model_id;
717 } 723 }
718 } 724 }
719 if ($category_id) { 725 if ($category_id) {
@@ -20,13 +20,11 @@ class Kernel extends ConsoleKernel @@ -20,13 +20,11 @@ class Kernel extends ConsoleKernel
20 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块 20 $schedule->command('template_label')->dailyAt('01:00')->withoutOverlapping(1);//最新模块
21 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块 21 $schedule->command('popular_template_label')->dailyAt('01:30')->withoutOverlapping(1);//热门模块
22 // $schedule->command('inspire')->hourly(); 22 // $schedule->command('inspire')->hourly();
23 -// $schedule->command('remain_day')->dailyAt('09:30')->withoutOverlapping(1); // 项目剩余服务时长  
24 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务 23 $schedule->command('rank_data_task')->everyMinute()->withoutOverlapping(1); // 排名数据更新任务
25 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次 24 $schedule->command('service_count')->dailyAt('01:00')->withoutOverlapping(1); //服务器使用情况,每天凌晨1点执行一次
26 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 25 // $schedule->command('web_traffic_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
27 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流 26 // $schedule->command('web_traffic_russia_special')->everyMinute()->withoutOverlapping(1); // 特殊引流
28 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次 27 $schedule->command('sync_channel')->dailyAt('06:00')->withoutOverlapping(1); // 渠道信息,每天执行一次
29 -// $schedule->command('inquiry_delay')->everyMinute()->withoutOverlapping(1);//TODO::上线放开,转发询盘,每分钟执行一次  
30 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次 28 $schedule->command('inquiry_count')->dailyAt('01:00')->withoutOverlapping(1); // 询盘统计数据,每天凌晨执行一次
31 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次 29 // $schedule->command('domain_info')->dailyAt('01:20')->withoutOverlapping(1);// 更新域名|证书结束时间,每天凌晨1点执行一次
32 $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次 30 $schedule->command('share_user')->dailyAt('01:20')->withoutOverlapping(1);// 每天凌晨1点执行一次
@@ -35,6 +35,12 @@ class AiBlogController extends BaseController @@ -35,6 +35,12 @@ class AiBlogController extends BaseController
35 */ 35 */
36 public function getAiBlog(AiBlog $aiBlog){ 36 public function getAiBlog(AiBlog $aiBlog){
37 $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','new_title','task_id','status','created_at','updated_at']); 37 $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','new_title','task_id','status','created_at','updated_at']);
  38 + if(!empty($lists) && !empty($lists['list'])){
  39 + foreach ($lists['list'] as $k => $v){
  40 + $v['image'] = getImageUrl($v['url'],$this->user['storage_type'],$this->user['project_location']);
  41 + $lists['list'][$k] = $v;
  42 + }
  43 + }
38 $this->response('success',Code::SUCCESS,$lists); 44 $this->response('success',Code::SUCCESS,$lists);
39 } 45 }
40 46
@@ -12,7 +12,6 @@ namespace App\Http\Controllers\Bside\BCom; @@ -12,7 +12,6 @@ namespace App\Http\Controllers\Bside\BCom;
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Helper\Arr; 13 use App\Helper\Arr;
14 use App\Http\Controllers\Bside\BaseController; 14 use App\Http\Controllers\Bside\BaseController;
15 -use App\Jobs\UpdatePageJob;  
16 use App\Models\Blog\Blog; 15 use App\Models\Blog\Blog;
17 use App\Models\Blog\BlogCategory; 16 use App\Models\Blog\BlogCategory;
18 use App\Models\Com\NoticeLog; 17 use App\Models\Com\NoticeLog;
@@ -34,10 +34,11 @@ class KeywordPrefixLogic extends BaseLogic @@ -34,10 +34,11 @@ class KeywordPrefixLogic extends BaseLogic
34 $data = [ 34 $data = [
35 'project_id'=>$this->param['project_id'] ?? 0, 35 'project_id'=>$this->param['project_id'] ?? 0,
36 'keyword'=>$v, 36 'keyword'=>$v,
37 - 'type'=>$this->param['type'] 37 + 'type'=>$this->param['type'],
38 ]; 38 ];
39 $prefixInfo = $this->model->read($data); 39 $prefixInfo = $this->model->read($data);
40 if($prefixInfo == false){ 40 if($prefixInfo == false){
  41 + $data['remark'] = $this->param['remark'] ?? '';
41 $this->model->add($data); 42 $this->model->add($data);
42 } 43 }
43 } 44 }
@@ -99,6 +99,9 @@ class ProjectLogic extends BaseLogic @@ -99,6 +99,9 @@ class ProjectLogic extends BaseLogic
99 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){ 99 if(isset($info['deploy_build']['other_project']) && !empty($info['deploy_build']['other_project'])){
100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']); 100 $info['deploy_build']['other_project']= json_decode($info['deploy_build']['other_project']);
101 } 101 }
  102 + if(isset($info['project_keyword']['operator_log']) && !empty($info['project_keyword']['operator_log'])){
  103 + $info['project_keyword']['operator_log'] = json_decode($info['project_keyword']['operator_log']);
  104 + }
102 //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0" 105 //is_product:"0",is_news:"0",is_blogs:"0",is_module:"0"
103 //获取小语种 106 //获取小语种
104 $info['minor_languages'] = $this->getProjectMinorLanguages($id); 107 $info['minor_languages'] = $this->getProjectMinorLanguages($id);
@@ -439,6 +442,9 @@ class ProjectLogic extends BaseLogic @@ -439,6 +442,9 @@ class ProjectLogic extends BaseLogic
439 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '', 442 'customer_keywords'=>$project_keyword['customer_keywords'] ?? '',
440 'search_keywords'=>$project_keyword['search_keywords'] ?? '', 443 'search_keywords'=>$project_keyword['search_keywords'] ?? '',
441 ]; 444 ];
  445 + if(isset($project_keyword['operator_log']) && !empty($project_keyword['operator_log'])){
  446 + $data['operator_log'] = json_encode($project_keyword['operator_log'] ?? []);
  447 + }
442 if($info === false){ 448 if($info === false){
443 $data['project_id'] = $project_id; 449 $data['project_id'] = $project_id;
444 $projectKeywordModel->addReturnId($data); 450 $projectKeywordModel->addReturnId($data);
@@ -28,8 +28,11 @@ class AiBlogLogic extends BaseLogic @@ -28,8 +28,11 @@ class AiBlogLogic extends BaseLogic
28 * @time :2023/7/5 14:46 28 * @time :2023/7/5 14:46
29 */ 29 */
30 public function blogSave(){ 30 public function blogSave(){
31 - $this->param['project_id'] = $this->user['project_id'];  
32 - $rs = $this->model->add($this->param); 31 + if(!empty($this->param['image'])){
  32 + $this->param['image'] = str_replace_url($this->param['image']);
  33 + }
  34 + $this->param['route'] = RouteMap::setRoute($this->param['route'], RouteMap::SOURCE_PRODUCT, $this->param['id'], $this->user['project_id']);
  35 + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]);
33 if($rs === false){ 36 if($rs === false){
34 $this->fail('error'); 37 $this->fail('error');
35 } 38 }
@@ -57,15 +60,13 @@ class AiBlogLogic extends BaseLogic @@ -57,15 +60,13 @@ class AiBlogLogic extends BaseLogic
57 } 60 }
58 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']); 61 $result = $aiBlogService->createTask($this->param['keyword'],$this->param['type']);
59 if($result['status'] == 200){ 62 if($result['status'] == 200){
60 - try {  
61 - $aiBlogTaskModel = new AiBlogTask();  
62 - $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]);  
63 - $aiBlogModel = new AiBlog();  
64 - $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],  
65 - ]);  
66 - }catch (\Exception $e){  
67 - $this->fail('请求ai_blog失败,请联系管理员');  
68 - } 63 + $aiBlogTaskModel = new AiBlogTask();
  64 + $aiBlogTaskModel->addReturnId(['project_id'=>$this->user['project_id'],'task_id'=>$result['data']['task_id'],'status'=>$result['data']['status']]);
  65 + $aiBlogModel = new AiBlog();
  66 + $aiBlogId = $aiBlogModel->addReturnId(['keyword'=>$this->param['keyword'], 'status'=>$result['data']['status'], 'task_id'=>$result['data']['task_id'],'project_id'=>$this->user['project_id'],
  67 + ]);
  68 + $route = RouteMap::setRoute($aiBlogService->route, RouteMap::SOURCE_AI_BLOG, $aiBlogId, $this->user['project_id']);
  69 + $aiBlogModel->edit(['route'=>$route],['id'=>$aiBlogId]);
69 } 70 }
70 return $this->success(); 71 return $this->success();
71 } 72 }
@@ -33,6 +33,8 @@ class RouteMap extends Base @@ -33,6 +33,8 @@ class RouteMap extends Base
33 const SOURCE_NEWS_CATE = 'news_category'; 33 const SOURCE_NEWS_CATE = 'news_category';
34 //自定义模块 34 //自定义模块
35 const SOURCE_MODULE = 'module'; 35 const SOURCE_MODULE = 'module';
  36 +
  37 + const SOURCE_AI_BLOG = 'ai_blog';
36 //自定义模块分类 38 //自定义模块分类
37 const SOURCE_MODULE_CATE = 'module_category'; 39 const SOURCE_MODULE_CATE = 'module_category';
38 40