作者 刘锟

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

@@ -124,6 +124,7 @@ class AiBlogAuthorTask extends Command @@ -124,6 +124,7 @@ class AiBlogAuthorTask extends Command
124 ]; 124 ];
125 $id = $aiBlogAuthorModel->addReturnId($param); 125 $id = $aiBlogAuthorModel->addReturnId($param);
126 $route = RouteMap::setRoute($v['route'] ?? $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,126 @@ class DownloadProject extends Command @@ -202,4 +207,126 @@ 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 +// //项目是否有绑定群
  214 +// $friend_id = ProjectAssociation::where('project_id', $project_id)
  215 +// ->where('status', ProjectAssociation::STATUS_NORMAL)
  216 +// ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
  217 +// ->value('friend_id');
  218 +// if(!$friend_id){
  219 +// echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
  220 +// return false;
  221 +// }
  222 + $content = '';
  223 + $content1 = '';
  224 + if(!empty($data['inquiry_total'])){
  225 + $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
  226 + if(!empty($data['week_inquiry_total'])){
  227 + $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';
  228 + }
  229 + if(!empty($data['inquiry_country'])){
  230 + $data['inquiry_country'] = json_decode($data['inquiry_country']);
  231 + arsort($data['inquiry_country']);
  232 + $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);
  233 + $country = '';
  234 + foreach ($data['inquiry_country'] as $k => $v){
  235 + $country .= $k.'、';
  236 + };
  237 + trim($country,'、');
  238 + $content1 = '询盘主要来源于'.$country.'等国家地区';
  239 + }
  240 + $content1 .= '如有高质量客户,请您密切关注与跟进;';
  241 + }
  242 + if(!empty($content1)){
  243 + $arr[] = $content1;
  244 + }
  245 + $content2 = '';
  246 + 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'])){
  247 + $content2 .= '项目截止目前';
  248 + if(!empty($data['google_indexed_num'])){
  249 + $content2 .= '谷歌收录量:'.$data['google_indexed_num'].'条,';
  250 + }
  251 + if(!empty($data['google_links_num'])){
  252 + $content2 .= '外链量:'.$data['google_links_num'].'条,';
  253 + }
  254 + if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){
  255 + $content2 .= '谷歌搜索排名';
  256 + if(!empty($data['keyword_home_num'])){
  257 + $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';
  258 + }
  259 + if(!empty($data['keyword_three_num'])){
  260 + $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';
  261 + }
  262 + if(!empty($data['keyword_five_num'])){
  263 + $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';
  264 + }
  265 + if(!empty($data['keyword_ten_num'])){
  266 + $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,';
  267 + }
  268 + }
  269 + if(!empty($data['daily_average_num'])){
  270 + $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
  271 + }
  272 + $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
  273 + }
  274 + if(!empty($content2)){
  275 + $arr[] = $content2;
  276 + }
  277 + $content3 = '';
  278 + if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){
  279 + if(!empty($data['product_num']) || !empty($data['news_num'])){
  280 + $content3 .= '项目截止目前';
  281 + if(!empty($data['product_num'])){
  282 + $content3 .= '发布产品:'.$data['product_num'].'条,';
  283 + }
  284 + if(!empty($data['news_num'])){
  285 + $content3 .= '发布新闻:'.$data['news_num'].'条。';
  286 + }
  287 + }
  288 + if(!empty($data['week_product_num']) || !empty($data['week_news_num'])){
  289 + $content3 .= '本周新增';
  290 + if(!empty($data['week_product_num'])){
  291 + $content3 .= '产品:'.$data['week_product_num'].'条,';
  292 + }
  293 + if(!empty($data['week_news_num'])){
  294 + $content3 .= '新闻:'.$data['week_news_num'].'条。';
  295 + }
  296 + }
  297 + }
  298 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
  299 + $data[] = $content3;
  300 + $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。';
  301 + if(!empty($data['main_update_num'])){
  302 + $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';
  303 + }
  304 + if(!empty($data['aggregation_update_num'])){
  305 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  306 + }
  307 + if(!empty($data['aggregation_update_num'])){
  308 + $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';
  309 + }
  310 + if(!empty($data['minor_update_num'])){
  311 + $content4 .= '小语种站页面更新'.$data['minor_update_num'].'次。';
  312 + }
  313 + if(!empty($data['aggregation_minor_update_num'])){
  314 + $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
  315 + }
  316 + $data[] = $content4;
  317 + foreach ($data as $key => $val){
  318 + $content = $key.','.$val;
  319 + }
  320 + $timestamp = strtotime('tomorrow 9:00 AM');
  321 + $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
  322 +// $param = [
  323 +// 'project_id'=>$project_id,
  324 +// 'friend_id'=>$friend_id,
  325 +// 'type'=>MessagePush::TYPE_WEEK,
  326 +// 'content'=>$content,
  327 +// 'ref_ids'=>'',
  328 +// 'send_time'=>$tomorrowNineAM
  329 +// ];
  330 + echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL;
  331 + }
205 } 332 }
@@ -131,6 +131,7 @@ class WeekProject extends Command @@ -131,6 +131,7 @@ class WeekProject extends Command
131 * @time :2025/2/26 10:15 131 * @time :2025/2/26 10:15
132 */ 132 */
133 public function workChatMessage($data,$project_id){ 133 public function workChatMessage($data,$project_id){
  134 + $arr = [];
134 //项目是否有绑定群 135 //项目是否有绑定群
135 $friend_id = ProjectAssociation::where('project_id', $project_id) 136 $friend_id = ProjectAssociation::where('project_id', $project_id)
136 ->where('status', ProjectAssociation::STATUS_NORMAL) 137 ->where('status', ProjectAssociation::STATUS_NORMAL)
@@ -140,6 +141,7 @@ class WeekProject extends Command @@ -140,6 +141,7 @@ class WeekProject extends Command
140 echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL; 141 echo date('Y-m-d H:i:s') . '没有绑定企微群:'.$project_id . PHP_EOL;
141 return false; 142 return false;
142 } 143 }
  144 + $content = '';
143 $content1 = ''; 145 $content1 = '';
144 if(!empty($data['inquiry_total'])){ 146 if(!empty($data['inquiry_total'])){
145 $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,'; 147 $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';
@@ -159,6 +161,9 @@ class WeekProject extends Command @@ -159,6 +161,9 @@ class WeekProject extends Command
159 } 161 }
160 $content1 .= '如有高质量客户,请您密切关注与跟进;'; 162 $content1 .= '如有高质量客户,请您密切关注与跟进;';
161 } 163 }
  164 + if(!empty($content1)){
  165 + $arr[] = $content1;
  166 + }
162 $content2 = ''; 167 $content2 = '';
163 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'])){ 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'])){
164 $content2 .= '项目截止目前'; 169 $content2 .= '项目截止目前';
@@ -168,35 +173,84 @@ class WeekProject extends Command @@ -168,35 +173,84 @@ class WeekProject extends Command
168 if(!empty($data['google_links_num'])){ 173 if(!empty($data['google_links_num'])){
169 $content2 .= '外链量:'.$data['google_links_num'].'条,'; 174 $content2 .= '外链量:'.$data['google_links_num'].'条,';
170 } 175 }
171 - if(!empty($data['keyword_home_num'])){  
172 - $content2 .= '谷歌搜索排名首页关键词数量为:'.$data['keyword_home_num'].'个,';  
173 - }  
174 - if(!empty($data['keyword_three_num'])){  
175 - $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';  
176 - }  
177 - if(!empty($data['keyword_five_num'])){  
178 - $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';  
179 - }  
180 - if(!empty($data['keyword_ten_num'])){  
181 - $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,'; 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 + }
182 } 190 }
183 if(!empty($data['daily_average_num'])){ 191 if(!empty($data['daily_average_num'])){
184 $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。'; 192 $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
185 } 193 }
186 $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;'; 194 $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
187 } 195 }
  196 + if(!empty($content2)){
  197 + $arr[] = $content2;
  198 + }
188 $content3 = ''; 199 $content3 = '';
189 if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){ 200 if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){
190 - 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 + }
191 } 219 }
  220 + $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
  221 + $data[] = $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 + $data[] = $content4;
  239 + foreach ($data as $key => $val){
  240 + $content = $key.','.$val;
  241 + }
  242 + $timestamp = strtotime('tomorrow 9:00 AM');
  243 + $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);
192 $param = [ 244 $param = [
193 'project_id'=>$project_id, 245 'project_id'=>$project_id,
194 'friend_id'=>$friend_id, 246 'friend_id'=>$friend_id,
195 'type'=>MessagePush::TYPE_WEEK, 247 'type'=>MessagePush::TYPE_WEEK,
196 - 'content'=>'', 248 + 'content'=>$content,
  249 + 'ref_ids'=>'',
  250 + 'send_time'=>$tomorrowNineAM
197 ]; 251 ];
198 //写入一条推送消息 自动消费 252 //写入一条推送消息 自动消费
199 $messagePushModel = new MessagePush(); 253 $messagePushModel = new MessagePush();
200 - 254 + $messagePushModel->add($param);
201 } 255 }
202 } 256 }
@@ -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 }