作者 赵彬吉
@@ -123,7 +123,8 @@ class AiBlogAuthorTask extends Command @@ -123,7 +123,8 @@ class AiBlogAuthorTask extends Command
123 'description'=>$v['description'], 123 'description'=>$v['description'],
124 ]; 124 ];
125 $id = $aiBlogAuthorModel->addReturnId($param); 125 $id = $aiBlogAuthorModel->addReturnId($param);
126 - $route = RouteMap::setRoute($v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 126 + $route = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
  127 + RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$project_id);//写一条列表页路由
127 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]); 128 $aiBlogAuthorModel->edit(['route'=>$route],['id'=>$id]);
128 } 129 }
129 } 130 }
1 -<?php  
2 -/**  
3 - * @remark :  
4 - * @name :AiBlogTask.php  
5 - * @author :lyh  
6 - * @method :post  
7 - * @time :2025/2/14 11:14  
8 - */  
9 -  
10 -namespace App\Console\Commands\AiBlog;  
11 -  
12 -use App\Models\Ai\AiBlog;  
13 -use App\Models\Ai\AiBlogAuthor;  
14 -use App\Models\Ai\AiBlogList;  
15 -use App\Models\Project\ProjectAiSetting;  
16 -use App\Models\RouteMap\RouteMap;  
17 -use App\Services\AiBlogService;  
18 -use App\Services\ProjectServer;  
19 -use Illuminate\Console\Command;  
20 -use App\Models\Project\AiBlogTask as AiBlogTaskModel;  
21 -use Illuminate\Support\Facades\Cache;  
22 -use Illuminate\Support\Facades\DB;  
23 -use function Symfony\Component\String\s;  
24 -  
25 -class AiBlogListTask extends Command  
26 -{  
27 - /**  
28 - * The name and signature of the console command.  
29 - *  
30 - * @var string  
31 - */  
32 - protected $signature = 'save_ai_blog_list';  
33 -  
34 - /**  
35 - * The console command description.  
36 - *  
37 - * @var string  
38 - */  
39 - protected $description = '查询ai_blog是否已经生成';  
40 -  
41 - public function handle(){  
42 - $aiBlogTaskModel = new AiBlogTaskModel();  
43 - $lists = $aiBlogTaskModel->list(['type'=>3,'status'=>1]);  
44 - foreach ($lists as $k => $v){  
45 - echo '开始->项目id:' . $v['project_id'] . PHP_EOL . date('Y-m-d H:i:s');  
46 - $projectAiSettingModel = new ProjectAiSetting();  
47 - $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$v['project_id']]);  
48 - if($aiSettingInfo === false){  
49 - continue;  
50 - }  
51 - $aiBlogService = new AiBlogService();  
52 - $aiBlogService->mch_id = $aiSettingInfo['mch_id'];  
53 - $aiBlogService->key = $aiSettingInfo['key'];  
54 - $page = 1;  
55 - $saveData = [];  
56 - $result = $aiBlogService->getAiBlogList($page,15);  
57 - if(!isset($result['status']) && $result['status'] != 200){  
58 - continue;  
59 - }  
60 - $total_page = $result['data']['total_page'];  
61 - //组装数据保存  
62 - $saveData[] = [  
63 - 'route'=>$page,  
64 - 'text'=>$result['data']['section'],  
65 - ];  
66 - while ($total_page > $page){  
67 - $page++;  
68 - $result = $aiBlogService->getAiBlogList($page,15);  
69 - if(isset($result['status']) && $result['status'] == 200){  
70 - $saveData[] = [  
71 - 'route'=>$page,  
72 - 'text'=>$result['data']['section'],  
73 - ];  
74 - }  
75 - }  
76 - //保存当前项目ai_blog数据  
77 - ProjectServer::useProject($v['project_id']);  
78 - $aiBlogListModel = new AiBlogList();  
79 - if(!empty($saveData)){  
80 - //写一条路由信息  
81 - RouteMap::setRoute('top-blog',RouteMap::SOURCE_AI_BLOG_LIST,0,$v['project_id']);  
82 - $aiBlogListModel->truncate();  
83 - $aiBlogListModel->insertAll($saveData);  
84 - }  
85 - DB::disconnect('custom_mysql');  
86 - //修改任务状态  
87 - $aiBlogTaskModel->edit(['status'=>2],['id'=>$v['id']]);  
88 - echo '结束->->项目id:' . $v['project_id'] . PHP_EOL . date('Y-m-d H:i:s');  
89 - }  
90 - return true;  
91 - }  
92 -}  
@@ -11,6 +11,7 @@ namespace App\Console\Commands\AiBlog; @@ -11,6 +11,7 @@ namespace App\Console\Commands\AiBlog;
11 11
12 use App\Models\Ai\AiBlog; 12 use App\Models\Ai\AiBlog;
13 use App\Models\Ai\AiBlogAuthor; 13 use App\Models\Ai\AiBlogAuthor;
  14 +use App\Models\Ai\AiBlogList;
14 use App\Models\Project\ProjectAiSetting; 15 use App\Models\Project\ProjectAiSetting;
15 use App\Models\RouteMap\RouteMap; 16 use App\Models\RouteMap\RouteMap;
16 use App\Services\AiBlogService; 17 use App\Services\AiBlogService;
@@ -76,6 +77,7 @@ class AiBlogTask extends Command @@ -76,6 +77,7 @@ class AiBlogTask extends Command
76 } 77 }
77 $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$info['task_id']]); 78 $aiBlogModel->edit(['new_title'=>$result['data']['title'], 'image'=>$result['data']['thumb'], 'text'=>$result['data']['section'], 'author_id'=>$result['data']['author_id'], 'route'=>$route ,'status'=>2], ['task_id'=>$info['task_id']]);
78 $this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']); 79 $this->updateAiBlogAuthor($aiSettingInfo,$result['data']['author_id']);
  80 + $this->updateBlogList($aiSettingInfo);
79 DB::disconnect('custom_mysql'); 81 DB::disconnect('custom_mysql');
80 //修改任务状态 82 //修改任务状态
81 $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]); 83 $aiBlogTaskModel->edit(['status'=>2],['id'=>$info['id']]);
@@ -128,4 +130,46 @@ class AiBlogTask extends Command @@ -128,4 +130,46 @@ class AiBlogTask extends Command
128 } 130 }
129 return true; 131 return true;
130 } 132 }
  133 +
  134 + /**
  135 + * @remark :更新列表页
  136 + * @name :updateBlogList
  137 + * @author :lyh
  138 + * @method :post
  139 + * @time :2025/2/26 15:42
  140 + */
  141 + public function updateBlogList($aiSettingInfo){
  142 + $aiBlogService = new AiBlogService();
  143 + $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
  144 + $aiBlogService->key = $aiSettingInfo['key'];
  145 + $page = 1;
  146 + $saveData = [];
  147 + $result = $aiBlogService->getAiBlogList($page,15);
  148 + if(!isset($result['status']) && $result['status'] != 200){
  149 + return true;
  150 + }
  151 + $total_page = $result['data']['total_page'];
  152 + //组装数据保存
  153 + $saveData[] = [
  154 + 'route'=>$page,
  155 + 'text'=>$result['data']['section'],
  156 + ];
  157 + while ($total_page > $page){
  158 + $page++;
  159 + $result = $aiBlogService->getAiBlogList($page,15);
  160 + if(isset($result['status']) && $result['status'] == 200){
  161 + $saveData[] = [
  162 + 'route'=>$page,
  163 + 'text'=>$result['data']['section'],
  164 + ];
  165 + }
  166 + }
  167 + $aiBlogListModel = new AiBlogList();
  168 + if(!empty($saveData)){
  169 + //写一条路由信息
  170 + $aiBlogListModel->truncate();
  171 + $aiBlogListModel->insertAll($saveData);
  172 + }
  173 + return true;
  174 + }
131 } 175 }
@@ -10,10 +10,13 @@ @@ -10,10 +10,13 @@
10 namespace App\Console\Commands\LyhTest; 10 namespace App\Console\Commands\LyhTest;
11 11
12 use App\Helper\Common; 12 use App\Helper\Common;
  13 +use App\Models\Com\V6WeeklyReport;
13 use App\Models\Product\Category; 14 use App\Models\Product\Category;
14 use App\Models\Product\CategoryRelated; 15 use App\Models\Product\CategoryRelated;
15 use App\Models\Product\Product; 16 use App\Models\Product\Product;
  17 +use App\Models\ProjectAssociation\ProjectAssociation;
16 use App\Models\RouteMap\RouteMap; 18 use App\Models\RouteMap\RouteMap;
  19 +use App\Models\Workchat\MessagePush;
17 use App\Services\ProjectServer; 20 use App\Services\ProjectServer;
18 use Illuminate\Console\Command; 21 use Illuminate\Console\Command;
19 use Illuminate\Support\Facades\DB; 22 use Illuminate\Support\Facades\DB;
@@ -37,12 +40,14 @@ class DownloadProject extends Command @@ -37,12 +40,14 @@ class DownloadProject extends Command
37 protected $description = '导出项目数据'; 40 protected $description = '导出项目数据';
38 41
39 public function handle(){ 42 public function handle(){
40 - ProjectServer::useProject(1646); 43 + ProjectServer::useProject(5);
41 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 44 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
42 - $data = $this->downloadProduct(); 45 + $v6WeekModel = new V6WeeklyReport();
  46 + $data = $v6WeekModel->read(['id'=>28058]);
  47 + $data = $this->workChatMessage($data,5);
43 DB::disconnect('custom_mysql'); 48 DB::disconnect('custom_mysql');
44 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 49 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
45 - return $this->exportData($data); 50 + return true;
46 } 51 }
47 52
48 public function downloadProduct() 53 public function downloadProduct()
@@ -202,4 +207,121 @@ class DownloadProject extends Command @@ -202,4 +207,121 @@ class DownloadProject extends Command
202 // } 207 // }
203 // return $lists; 208 // return $lists;
204 // } 209 // }
  210 +
  211 + public function workChatMessage($data,$project_id){
  212 + $arr = [];
  213 + $content = '';
  214 + $content1 = '';
  215 + if(!empty($data['inquiry_total'])){
  216 + $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
  217 + if(!empty($data['week_inquiry_total'])){
  218 + $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
  219 + }
  220 + if(!empty($data['inquiry_country'])){
  221 + $data['inquiry_country'] = json_decode($data['inquiry_country'],true);
  222 + arsort($data['inquiry_country']);
  223 + $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
  224 + $country = '';
  225 + foreach ($data['inquiry_country'] as $k => $v){
  226 + $country .= $k.'、';
  227 + };
  228 + $country = trim($country,'、');
  229 + $content1 = '询盘主要来源于'.$country.'等国家地区';
  230 + }
  231 + $content1 .= '如有高质量客户,请您密切关注与跟进;';
  232 + }
  233 + if(!empty($content1)){
  234 + $arr[] = $content1;
  235 + }
  236 + $content2 = '';
  237 + if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
  238 + $content2 .= '项目截止目前';
  239 + if(!empty($data['google_indexed_num'])){
  240 + $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
  241 + }
  242 + if(!empty($data['google_links_num'])){
  243 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  244 + }
  245 + if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
  246 + $content2 .= '谷歌搜索排名';
  247 + if(!empty($data['keyword_home_num'])){
  248 + $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
  249 + }
  250 + if(!empty($data['keyword_three_num'])){
  251 + $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';
  252 + }
  253 + if(!empty($data['keyword_five_num'])){
  254 + $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';
  255 + }
  256 + if(!empty($data['keyword_ten_num'])){
  257 + $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,';
  258 + }
  259 + }
  260 + if(!empty($data['daily_average_num'])){
  261 + $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
  262 + }
  263 + $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
  264 + }
  265 + if(!empty($content2)){
  266 + $arr[] = $content2;
  267 + }
  268 + $content3 = '';
  269 + if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){
  270 + if(!empty($data['product_num']) || !empty($data['news_num'])){
  271 + $content3 .= '项目截止目前';
  272 + if(!empty($data['product_num'])){
  273 + $content3 .= '发布产品:'.$data['product_num'].'条,';
  274 + }
  275 + if(!empty($data['news_num'])){
  276 + $content3 .= '发布新闻:'.$data['news_num'].'条。';
  277 + }
  278 + }
  279 + if(!empty($data['week_product_num']) || !empty($data['week_news_num'])){
  280 + $content3 .= '本周新增';
  281 + if(!empty($data['week_product_num'])){
  282 + $content3 .= '产品:'.$data['week_product_num'].'条,';
  283 + }
  284 + if(!empty($data['week_news_num'])){
  285 + $content3 .= '新闻:'.$data['week_news_num'].'条。';
  286 + }
  287 + }
  288 + }
  289 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
  290 + $arr[] = $content3;
  291 + $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。';
  292 + if(!empty($data['main_update_num'])){
  293 + $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
  294 + }
  295 + if(!empty($data['aggregation_update_num'])){
  296 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  297 + }
  298 + if(!empty($data['aggregation_update_num'])){
  299 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  300 + }
  301 + if(!empty($data['minor_update_num'])){
  302 + $content4 .= '小语种站页面更新'.$data['minor_update_num'].'次。';
  303 + }
  304 + if(!empty($data['aggregation_minor_update_num'])){
  305 + $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
  306 + }
  307 + $arr[] = $content4;
  308 + foreach ($arr as $key => $val){
  309 + $content .= ($key+1).','.$val;
  310 + }
  311 + $timestamp = strtotime('tomorrow 9:00 AM');
  312 + $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
  313 + $param = [
  314 + 'project_id'=>$project_id,
  315 + 'friend_id'=>1,
  316 + 'type'=>MessagePush::TYPE_WEEK,
  317 + 'content'=>$content,
  318 + 'ref_ids'=>'',
  319 + 'send_time'=>$tomorrowNineAM,
  320 + 'status'=>3,
  321 + ];
  322 + //写入一条推送消息 自动消费
  323 + $messagePushModel = new MessagePush();
  324 + $messagePushModel->add($param);
  325 + echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL;
  326 + }
205 } 327 }
@@ -16,13 +16,16 @@ use App\Models\HomeCount\Count; @@ -16,13 +16,16 @@ use App\Models\HomeCount\Count;
16 use App\Models\News\News; 16 use App\Models\News\News;
17 use App\Models\Product\Product; 17 use App\Models\Product\Product;
18 use App\Models\Project\Project; 18 use App\Models\Project\Project;
  19 +use App\Models\ProjectAssociation\ProjectAssociation;
19 use App\Models\RankData\ExternalLinks; 20 use App\Models\RankData\ExternalLinks;
20 use App\Models\RankData\RankData; 21 use App\Models\RankData\RankData;
21 use App\Models\RankData\RankWeek; 22 use App\Models\RankData\RankWeek;
  23 +use App\Models\Workchat\MessagePush;
22 use App\Services\ProjectServer; 24 use App\Services\ProjectServer;
23 use Carbon\Carbon; 25 use Carbon\Carbon;
24 use Illuminate\Console\Command; 26 use Illuminate\Console\Command;
25 use Illuminate\Support\Facades\DB; 27 use Illuminate\Support\Facades\DB;
  28 +use Illuminate\Support\Facades\Log;
26 29
27 class WeekProject extends Command 30 class WeekProject extends Command
28 { 31 {
@@ -49,7 +52,7 @@ class WeekProject extends Command @@ -49,7 +52,7 @@ class WeekProject extends Command
49 */ 52 */
50 public function handle(){ 53 public function handle(){
51 $projectModel = new Project(); 54 $projectModel = new Project();
52 - $list = $projectModel->list(['delete_status'=>0,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']); 55 + $list = $projectModel->list(['delete_status'=>0,'is_weekly_report'=>1,'type'=>['in',[1,2,3,4,6]]],'id',['id','title']);
53 foreach ($list as $k => $v){ 56 foreach ($list as $k => $v){
54 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 57 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
55 ProjectServer::useProject($v['id']); 58 ProjectServer::useProject($v['id']);
@@ -97,8 +100,10 @@ class WeekProject extends Command @@ -97,8 +100,10 @@ class WeekProject extends Command
97 $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0; 100 $data['keyword_ten_num'] = $rankInfo['first_ten_pages_num'] ?? 0;
98 $productModel = new Product(); 101 $productModel = new Product();
99 $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0; 102 $data['product_num'] = $productModel->counts(['status'=>1]) ?? 0;
  103 + $data['week_product_num'] = $productModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0;
100 $newsModel = new News(); 104 $newsModel = new News();
101 $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0; 105 $data['news_num'] = $newsModel->counts(['status'=>1]) ?? 0;
  106 + $data['week_news_num'] = $newsModel->counts(['status'=>1,'created_at'=>['between',[$startOfLastWeek,$endOfLastWeek]]]) ?? 0;
102 $blogModel = new Blog(); 107 $blogModel = new Blog();
103 $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0; 108 $data['blog_num'] = $blogModel->counts(['status'=>1]) ?? 0;
104 $notifyModel = new Notify(); 109 $notifyModel = new Notify();
@@ -115,6 +120,138 @@ class WeekProject extends Command @@ -115,6 +120,138 @@ class WeekProject extends Command
115 } 120 }
116 $v6WeeklyReportModel = new V6WeeklyReport(); 121 $v6WeeklyReportModel = new V6WeeklyReport();
117 $v6WeeklyReportModel->add($data); 122 $v6WeeklyReportModel->add($data);
  123 + $this->workChatMessage($data,$value['id']);
118 return true; 124 return true;
119 } 125 }
  126 +
  127 + /**
  128 + * @remark :推送消息
  129 + * @name :workChatMessage
  130 + * @author :lyh
  131 + * @method :post
  132 + * @time :2025/2/26 10:15
  133 + */
  134 + public function workChatMessage($data,$project_id){
  135 + $arr = [];
  136 + //项目是否有绑定群
  137 + $friend_id = ProjectAssociation::where('project_id', $project_id)
  138 + ->where('status', ProjectAssociation::STATUS_NORMAL)
  139 + ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
  140 + ->value('friend_id');
  141 + if(!$friend_id){
  142 + echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
  143 + return false;
  144 + }
  145 + $content1 = '';
  146 + if(!empty($data['inquiry_total'])){
  147 + $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
  148 + if(!empty($data['week_inquiry_total'])){
  149 + $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
  150 + }
  151 + if(!empty($data['inquiry_country'])){
  152 + $data['inquiry_country'] = json_decode($data['inquiry_country']);
  153 + arsort($data);
  154 + $data['inquiry_country'] = array_slice($data, 0, 4, true);
  155 + $country = '';
  156 + foreach ($data['inquiry_country'] as $k => $v){
  157 + $country .= $k.'、';
  158 + };
  159 + $country = trim($country,'、');
  160 + $content1 .= '询盘主要来源于'.$country.'等国家地区';
  161 + }
  162 + $content1 .= '如有高质量客户,请您密切关注与跟进;';
  163 + }
  164 + if(!empty($content1)){
  165 + $arr[] = $content1;
  166 + }
  167 + $content2 = '';
  168 + if(!empty($data['google_indexed_num']) || !empty($data['google_links_num']) || !empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num']) || !empty($data['daily_average_num'])){
  169 + $content2 .= '项目截止目前';
  170 + if(!empty($data['google_indexed_num'])){
  171 + $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
  172 + }
  173 + if(!empty($data['google_links_num'])){
  174 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  175 + }
  176 + if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
  177 + $content2 .= '谷歌搜索排名';
  178 + if(!empty($data['keyword_home_num'])){
  179 + $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
  180 + }
  181 + if(!empty($data['keyword_three_num'])){
  182 + $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';
  183 + }
  184 + if(!empty($data['keyword_five_num'])){
  185 + $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';
  186 + }
  187 + if(!empty($data['keyword_ten_num'])){
  188 + $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,';
  189 + }
  190 + }
  191 + if(!empty($data['daily_average_num'])){
  192 + $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
  193 + }
  194 + $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
  195 + }
  196 + if(!empty($content2)){
  197 + $arr[] = $content2;
  198 + }
  199 + $content3 = '';
  200 + if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){
  201 + if(!empty($data['product_num']) || !empty($data['news_num'])){
  202 + $content3 .= '项目截止目前';
  203 + if(!empty($data['product_num'])){
  204 + $content3 .= '发布产品:'.$data['product_num'].'条,';
  205 + }
  206 + if(!empty($data['news_num'])){
  207 + $content3 .= '发布新闻:'.$data['news_num'].'条。';
  208 + }
  209 + }
  210 + if(!empty($data['week_product_num']) || !empty($data['week_news_num'])){
  211 + $content3 .= '本周新增';
  212 + if(!empty($data['week_product_num'])){
  213 + $content3 .= '产品:'.$data['week_product_num'].'条,';
  214 + }
  215 + if(!empty($data['week_news_num'])){
  216 + $content3 .= '新闻:'.$data['week_news_num'].'条。';
  217 + }
  218 + }
  219 + }
  220 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
  221 + $arr[] = $content3;
  222 + $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。';
  223 + if(!empty($data['main_update_num'])){
  224 + $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
  225 + }
  226 + if(!empty($data['aggregation_update_num'])){
  227 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  228 + }
  229 + if(!empty($data['aggregation_update_num'])){
  230 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  231 + }
  232 + if(!empty($data['minor_update_num'])){
  233 + $content4 .= '小语种站页面更新'.$data['minor_update_num'].'次。';
  234 + }
  235 + if(!empty($data['aggregation_minor_update_num'])){
  236 + $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
  237 + }
  238 + $arr[] = $content4;
  239 + foreach ($arr as $key => $val){
  240 + $content .= ($key + 1) .','.$val;
  241 + }
  242 + $timestamp = strtotime('tomorrow 9:00 AM');
  243 + $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
  244 + $param = [
  245 + 'project_id'=>$project_id,
  246 + 'friend_id'=>$friend_id,
  247 + 'type'=>MessagePush::TYPE_WEEK,
  248 + 'content'=>'【全球搜V6.0周报】'.$content,
  249 + 'ref_ids'=>'',
  250 + 'send_time'=>$tomorrowNineAM
  251 + ];
  252 + //写入一条推送消息 自动消费
  253 + $messagePushModel = new MessagePush();
  254 + echo date('Y-m-d H:i:s') . '生成推送消息:'.$project_id . PHP_EOL;
  255 + return $messagePushModel->add($param);
  256 + }
120 } 257 }
@@ -538,6 +538,15 @@ class UpdateSeoTdk extends Command @@ -538,6 +538,15 @@ class UpdateSeoTdk extends Command
538 return $str; 538 return $str;
539 $keyword = array_slice($fix_keyword, 0, $num); 539 $keyword = array_slice($fix_keyword, 0, $num);
540 $str = implode(", ", $keyword); 540 $str = implode(", ", $keyword);
  541 +
  542 + // 前后缀内部去重
  543 + foreach ($keyword as $k=>$v){
  544 + $tmp = rtrim($v, 's');
  545 + if (substr_count($str, $tmp) > 1) {
  546 + unset($keyword[$k]);
  547 + $str = implode(", ", $keyword);
  548 + }
  549 + }
541 } 550 }
542 return $str; 551 return $str;
543 } 552 }
@@ -1104,6 +1104,14 @@ function getPrefixKeyword($project_id, $type, $num) @@ -1104,6 +1104,14 @@ function getPrefixKeyword($project_id, $type, $num)
1104 return $str; 1104 return $str;
1105 $keyword = array_slice($fix_keyword, 0, $num); 1105 $keyword = array_slice($fix_keyword, 0, $num);
1106 $str = implode(", ", $keyword); 1106 $str = implode(", ", $keyword);
  1107 +
  1108 + foreach ($keyword as $k=>$v){
  1109 + $tmp = rtrim($v, 's');
  1110 + if (substr_count($str, $tmp) > 1) {
  1111 + unset($keyword[$k]);
  1112 + $str = implode(", ", $keyword);
  1113 + }
  1114 + }
1107 } 1115 }
1108 return $str; 1116 return $str;
1109 } 1117 }
@@ -64,7 +64,9 @@ class AiBlogController extends BaseController @@ -64,7 +64,9 @@ class AiBlogController extends BaseController
64 if(!empty($lists) && !empty($lists['list'])){ 64 if(!empty($lists) && !empty($lists['list'])){
65 foreach ($lists['list'] as $k => $v){ 65 foreach ($lists['list'] as $k => $v){
66 $v['image'] = getImageUrl($v['image']); 66 $v['image'] = getImageUrl($v['image']);
67 - $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route']; 67 + if(!empty($v['route'])){
  68 + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
  69 + }
68 $lists['list'][$k] = $v; 70 $lists['list'][$k] = $v;
69 } 71 }
70 } 72 }
@@ -171,7 +173,9 @@ class AiBlogController extends BaseController @@ -171,7 +173,9 @@ class AiBlogController extends BaseController
171 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']); 173 $lists = $aiBlogList->lists($this->map,$this->page,$this->row,'id',['id','route','created_at','updated_at']);
172 if(!empty($lists) && !empty($lists['list'])){ 174 if(!empty($lists) && !empty($lists['list'])){
173 foreach ($lists['list'] as $k => $v){ 175 foreach ($lists['list'] as $k => $v){
174 - $v['route'] = $this->user['test_domain'] . 'top-blog/' . $v['route']; 176 + if(!empty($v['route'])){
  177 + $v['route'] = $this->user['test_domain'] . 'blog/' . $v['route'];
  178 + }
175 $lists['list'][$k] = $v; 179 $lists['list'][$k] = $v;
176 } 180 }
177 } 181 }
@@ -25,7 +25,7 @@ class WebSettingTextLogic extends BaseLogic @@ -25,7 +25,7 @@ class WebSettingTextLogic extends BaseLogic
25 */ 25 */
26 public function setting_read(){ 26 public function setting_read(){
27 $web_setting = new WebSetting(); 27 $web_setting = new WebSetting();
28 - $setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting','anchor_is_enable','anchor_num','anchor_page_num']); 28 + $setting_info = $web_setting->read(['project_id'=>$this->user['project_id']],['anchor_setting','anchor_is_enable','anchor_keyword_is_enable','anchor_num','anchor_page_num']);
29 if($setting_info === false){ 29 if($setting_info === false){
30 $setting_info = []; 30 $setting_info = [];
31 } 31 }
@@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic @@ -60,11 +60,15 @@ class WebSettingTextLogic extends BaseLogic
60 DB::beginTransaction(); 60 DB::beginTransaction();
61 try { 61 try {
62 //更新描文本设置 62 //更新描文本设置
  63 + if($this->param['anchor_is_enable'] == 0){
  64 + $this->param['anchor_keyword_is_enable'] = 0;
  65 + }
63 $data = [ 66 $data = [
64 'anchor_setting'=>$this->param['anchor_setting'], 67 'anchor_setting'=>$this->param['anchor_setting'],
65 'anchor_is_enable'=>$this->param['anchor_is_enable'], 68 'anchor_is_enable'=>$this->param['anchor_is_enable'],
66 'anchor_num'=>$this->param['anchor_num'] ?? 0, 69 'anchor_num'=>$this->param['anchor_num'] ?? 0,
67 - 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0 70 + 'anchor_page_num'=>$this->param['anchor_page_num'] ?? 0,
  71 + 'anchor_keyword_is_enable'=>$this->param['anchor_keyword_is_enable'] ?? 0
68 ]; 72 ];
69 $web_setting->edit($data,['project_id'=>$this->user['project_id']]); 73 $web_setting->edit($data,['project_id'=>$this->user['project_id']]);
70 $this->model->del(['project_id'=>$this->user['project_id']]); 74 $this->model->del(['project_id'=>$this->user['project_id']]);
@@ -90,7 +90,8 @@ class Project extends Base @@ -90,7 +90,8 @@ class Project extends Base
90 11 => '俄语标准版', 90 11 => '俄语标准版',
91 12 => '俄语商务版', 91 12 => '俄语商务版',
92 14 => '俄语旗舰版', 92 14 => '俄语旗舰版',
93 - 13 => '体验版' 93 + 13 => '体验版',
  94 + 15 => '白帽 SEO'
94 ]; 95 ];
95 } 96 }
96 97
@@ -25,7 +25,7 @@ class MessagePush extends Base @@ -25,7 +25,7 @@ class MessagePush extends Base
25 const STATUS_ERROR = 9; 25 const STATUS_ERROR = 9;
26 26
27 const TYPE_INQUIRY = 'inquiry'; 27 const TYPE_INQUIRY = 'inquiry';
28 - 28 + const TYPE_WEEK = 'week';
29 //设置关联表名 29 //设置关联表名
30 /** 30 /**
31 * @var mixed 31 * @var mixed