作者 刘锟

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

@@ -119,14 +119,14 @@ class AiBlogAuthorTask extends Command @@ -119,14 +119,14 @@ class AiBlogAuthorTask extends Command
119 } 119 }
120 $aiBlogAuthorModel = new AiBlogAuthor(); 120 $aiBlogAuthorModel = new AiBlogAuthor();
121 foreach ($data as $v){ 121 foreach ($data as $v){
122 - //查询当前数据是否存在  
123 - $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);  
124 $param = [ 122 $param = [
125 'author_id'=>$v['id'], 123 'author_id'=>$v['id'],
126 'title'=>$v['title'], 124 'title'=>$v['title'],
127 'image'=>str_replace_url($v['picture']), 125 'image'=>str_replace_url($v['picture']),
128 'description'=>$v['description'], 126 'description'=>$v['description'],
129 ]; 127 ];
  128 + //查询当前数据是否存在
  129 + $info = $aiBlogAuthorModel->read(['author_id'=>$v['id']]);
130 try { 130 try {
131 if($info === false){ 131 if($info === false){
132 echo '执行新增'.PHP_EOL; 132 echo '执行新增'.PHP_EOL;
@@ -134,11 +134,11 @@ class AiBlogAuthorTask extends Command @@ -134,11 +134,11 @@ class AiBlogAuthorTask extends Command
134 $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 134 $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id);
135 $aiBlogAuthorModel->edit(['route'=>$param['route']],['id'=>$id]); 135 $aiBlogAuthorModel->edit(['route'=>$param['route']],['id'=>$id]);
136 }else{ 136 }else{
137 - $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $id, $project_id); 137 + $param['route'] = RouteMap::setRoute($v['route'] ?? $v['title'], RouteMap::SOURCE_AI_BLOG_AUTHOR, $info['id'], $project_id);
138 $aiBlogAuthorModel->edit($param,['id'=>$info['id']]); 138 $aiBlogAuthorModel->edit($param,['id'=>$info['id']]);
139 echo '执行更新'.PHP_EOL; 139 echo '执行更新'.PHP_EOL;
140 } 140 }
141 - $aiSettingInfo = $this->getSetting(); 141 + $aiSettingInfo = $this->getSetting($project_id);
142 $aiBlogService = new AiBlogService(); 142 $aiBlogService = new AiBlogService();
143 $aiBlogService->mch_id = $aiSettingInfo['mch_id']; 143 $aiBlogService->mch_id = $aiSettingInfo['mch_id'];
144 $aiBlogService->key = $aiSettingInfo['key']; 144 $aiBlogService->key = $aiSettingInfo['key'];
@@ -185,174 +185,27 @@ class DownloadProject extends Command @@ -185,174 +185,27 @@ class DownloadProject extends Command
185 return ['file_link'=>url('upload/excel/'.$filename)]; 185 return ['file_link'=>url('upload/excel/'.$filename)];
186 } 186 }
187 187
188 -// public function downloadItem($filed = ['id','depth','created_at','referrer_url','url','device_port','country','ip']){  
189 -// $visitModel = new Visit();  
190 -// $page = 1;  
191 -// $pageSize = 3000;  
192 -// $lists = $visitModel->lists(['updated_date'=>['between',['2025-02-01','2025-02-31']]],$page,$pageSize,'id',$filed);  
193 -// foreach ($lists as $v){  
194 -// $customer_visit_id[] = $v['id'];  
195 -// }  
196 -// $itemModel = new VisitItem();  
197 -// $itemList = $itemModel->list(['customer_visit_id'=>['in',$customer_visit_id]],['customer_visit_id','url']);  
198 -// foreach ($lists as $key => $value){  
199 -// $sub = [];  
200 -// foreach ($itemList as $sonValue){  
201 -// if($value['id'] == $sonValue['customer_visit_id']){  
202 -// $sub[] = $sonValue;  
203 -// }  
204 -// }  
205 -// $value['sub'] = $sub;  
206 -// $lists[$key] = $value;  
207 -// }  
208 -// return $lists;  
209 -// }  
210 -  
211 - public function workChatMessage($data,$project_id){  
212 - $data['main_lang_id'] = 8;  
213 - $arr = [];  
214 - $content = '';  
215 - $content1 = '';  
216 - if(!empty($data['inquiry_total'])){  
217 - $content1 .= '项目共计已收到询盘 '.$data['inquiry_total'].'条,';  
218 - if(!empty($data['week_inquiry_total'])){  
219 - $content1 .= '本周新收 '.$data['week_inquiry_total'].' 封询盘。';  
220 - }  
221 - if(!empty($data['inquiry_country'])){  
222 - $data['inquiry_country'] = json_decode($data['inquiry_country'],true);  
223 - arsort($data['inquiry_country']);  
224 - $data['inquiry_country'] = array_slice($data['inquiry_country'], 0, 4, true);  
225 - $country = '';  
226 - foreach ($data['inquiry_country'] as $k => $v){  
227 - $country .= $k.',';  
228 - };  
229 - $country = trim($country,',');  
230 - if(!empty($country)){  
231 - $content1 .= '询盘主要来源于'.$country.'等国家地区';  
232 - }  
233 - }  
234 - $content1 .= '如有高质量客户,请您密切关注与跟进;';  
235 - }  
236 - if(!empty($content1)){  
237 - $arr[] = $content1;  
238 - }  
239 - $content2 = '';  
240 - 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'])){  
241 - $content2 .= '项目截止目前';  
242 - if($data['main_lang_id'] == 8){  
243 - $title = 'Yandex';  
244 - }else{  
245 - $title = '谷歌';  
246 - }  
247 - if(!empty($data['google_indexed_num'])){  
248 - $content2 .= $title.'收录量:'.$data['google_indexed_num'].'条,';  
249 - }  
250 - if(!empty($data['google_links_num'])){  
251 - //获取上一次的外链数  
252 - $latestRecord = V6WeeklyReport::where(['project_id'=>$project_id])->orderBy('id', 'desc')->first();  
253 - if(!empty($latestRecord)){  
254 - if($latestRecord['google_links_num'] != $data['google_links_num']){  
255 - $content2 .= '外链量:'.$data['google_links_num'].'条,';  
256 - }  
257 - }else{  
258 - $content2 .= '外链量:'.$data['google_links_num'].'条,';  
259 - }  
260 - }  
261 - if(!empty($data['keyword_home_num']) || !empty($data['keyword_three_num']) || !empty($data['keyword_five_num']) || !empty($data['keyword_ten_num'])){  
262 - $content2 .= $title.'搜索排名';  
263 - if(!empty($data['keyword_home_num'])){  
264 - $content2 .= '首页关键词数量为:'.$data['keyword_home_num'].'个,';  
265 - }  
266 - if(!empty($data['keyword_three_num'])){  
267 - $content2 .= '前三页关键词数量为:'.$data['keyword_three_num'].'个,';  
268 - }  
269 - if(!empty($data['keyword_five_num'])){  
270 - $content2 .= '前五页关键词数量为:'.$data['keyword_five_num'].'个,';  
271 - }  
272 - if(!empty($data['keyword_ten_num'])){  
273 - $content2 .= '前十页关键词数量为:'.$data['keyword_ten_num'].'个,';  
274 - }  
275 - }  
276 - if(!empty($data['daily_average_num'])){  
277 - $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';  
278 - }  
279 - $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';  
280 - }  
281 - if(!empty($content2)){  
282 - $arr[] = $content2;  
283 - }  
284 - $content3 = '';  
285 - if(!empty($data['product_num']) || !empty($data['news_num']) || !empty($data['week_product_num']) || !empty($data['week_news_num'])){  
286 - if(!empty($data['product_num']) || !empty($data['news_num'])){  
287 - $content3 .= '项目截止目前';  
288 - if(!empty($data['product_num'])){  
289 - $content3 .= '发布产品:'.$data['product_num'].'条,';  
290 - }  
291 - if(!empty($data['news_num'])){  
292 - $content3 .= '发布新闻:'.$data['news_num'].'条。';  
293 - }  
294 - }  
295 - if(!empty($data['week_product_num']) || !empty($data['week_news_num'])){  
296 - $content3 .= '本周新增';  
297 - if(!empty($data['week_product_num'])){  
298 - $content3 .= '产品:'.$data['week_product_num'].'条,';  
299 - }  
300 - if(!empty($data['week_news_num'])){  
301 - $content3 .= '新闻:'.$data['week_news_num'].'条。'; 188 + public function downloadItem($filed = ['id','depth','created_at','referrer_url','url','device_port','country','ip']){
  189 + $visitModel = new Visit();
  190 + $page = 1;
  191 + $pageSize = 3000;
  192 + $lists = $visitModel->lists(['updated_date'=>['between',['2025-02-01','2025-02-31']]],$page,$pageSize,'id',$filed);
  193 + foreach ($lists as $v){
  194 + $customer_visit_id[] = $v['id'];
  195 + }
  196 + $itemModel = new VisitItem();
  197 + $itemList = $itemModel->list(['customer_visit_id'=>['in',$customer_visit_id]],['customer_visit_id','url']);
  198 + foreach ($lists as $key => $value){
  199 + $sub = [];
  200 + foreach ($itemList as $sonValue){
  201 + if($value['id'] == $sonValue['customer_visit_id']){
  202 + $sub[] = $sonValue;
302 } 203 }
303 } 204 }
304 - $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';  
305 - }  
306 - if(!empty($content3)){  
307 - $arr[] = $content3;  
308 - }  
309 - $content4 = '';  
310 - if(!empty($data['main_update_num'])){  
311 - $content4 .= '网站加载速度维护及主站页面更新'.$data['main_update_num'].'次。';  
312 - }  
313 - if(!empty($data['aggregation_update_num'])){  
314 - $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。';  
315 - }  
316 - if(!empty($data['aggregation_update_num'])){  
317 - $content4 .= '聚合页主站页面更新'.$data['aggregation_update_num'].'次。'; 205 + $value['sub'] = $sub;
  206 + $lists[$key] = $value;
318 } 207 }
319 - if(!empty($data['minor_update_num'])){  
320 - $content4 .= '小语种站页面更新'.$data['minor_update_num'].'次。';  
321 - }  
322 - if(!empty($data['aggregation_minor_update_num'])){  
323 - $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';  
324 - }  
325 - if(!empty($content4)){  
326 - $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;  
327 - }  
328 - if(!empty($content4)){  
329 - $arr[] = $content4;  
330 - }  
331 - if(empty($arr)){  
332 - return true;  
333 - }  
334 - foreach ($arr as $key => $val){  
335 - $content .= ($key+1).','.$val.PHP_EOL;  
336 - }  
337 - $timestamp = strtotime('tomorrow 9:00 AM');  
338 - $tomorrowNineAM = date('Y-m-d H:i:s', $timestamp);  
339 - if(empty($content)){  
340 - return true;  
341 - }  
342 - $tips = 'Tips:'.PHP_EOL.'1、全球搜V6.0系统提供网页TDK、H标签、Img标签等用户自定义编辑接口且辅以AI创作工具,用户可进一步对相关优化设置进行精细化优化与调整;'.PHP_EOL.'2、全球搜V6.0系统提供小语种页面精准校对翻译功能,用户可进一步对已翻译小语种页面进行人工翻译校对;'.PHP_EOL.'3、全球搜V6.0系统支持绑定Facebook、LinkedIn、X(原Twitter)等社媒账号,可一键同步转发网站上发布的产品和新闻至社媒账号动态,建议用户用起来哦;'.PHP_EOL.'4、如用户有较丰富的企业、产品、服务相关视频素材,全球搜建议用户及时创建YouTube主页,并在YouTube和网站相关网页上同步发布视频;';  
343 - $param = [  
344 - 'project_id'=>$project_id,  
345 - 'friend_id'=>17667,  
346 - 'type'=>MessagePush::TYPE_WEEK,  
347 - 'content'=>"【全球搜V6.0周报】--项目id:$project_id".PHP_EOL.$content.PHP_EOL.$tips,  
348 - 'ref_ids'=>'',  
349 - 'send_time'=>$tomorrowNineAM,  
350 - 'status'=>0,  
351 - ];  
352 - //写入一条推送消息 自动消费  
353 - $messagePushModel = new MessagePush();  
354 - $messagePushModel->add($param);  
355 - echo date('Y-m-d H:i:s') . '数据:'. $content . PHP_EOL;  
356 - return true; 208 + return $lists;
357 } 209 }
  210 +
358 } 211 }
@@ -52,9 +52,9 @@ class LyhImportTest extends Command @@ -52,9 +52,9 @@ class LyhImportTest extends Command
52 * @time :2023/11/20 15:13 52 * @time :2023/11/20 15:13
53 */ 53 */
54 public function handle(){ 54 public function handle(){
55 - ProjectServer::useProject(2837); 55 + ProjectServer::useProject(3283);
56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 56 echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
57 - $this->importCustomModule('https://ecdn6.globalso.com/upload/p/2837/file/2025-03/2.csv',2837); 57 + $this->importProductCategory('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/zy_boss_pricelistcat.csv',3283);
58 DB::disconnect('custom_mysql'); 58 DB::disconnect('custom_mysql');
59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
60 } 60 }
@@ -94,18 +94,18 @@ class LyhImportTest extends Command @@ -94,18 +94,18 @@ class LyhImportTest extends Command
94 try { 94 try {
95 $id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$val[1],'seo_title'=>$val[0],'seo_keyword'=>$val[2]]); 95 $id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$val[1],'seo_title'=>$val[0],'seo_keyword'=>$val[2]]);
96 $pid = 0; 96 $pid = 0;
97 - if($val[2] != 0){  
98 - //查询上级id  
99 - $pidCate = $categoryModel->read(['seo_title'=>$val[2]]);  
100 - if($pidCate !== false){  
101 - $pid = $pidCate['id'];  
102 - }  
103 - } 97 +// if($val[2] != 0){
  98 +// //查询上级id
  99 +// $pidCate = $categoryModel->read(['seo_title'=>$val[2]]);
  100 +// if($pidCate !== false){
  101 +// $pid = $pidCate['id'];
  102 +// }
  103 +// }
104 $route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id); 104 $route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
105 $categoryModel->edit(['route'=>$route,'pid'=>$pid],['id'=>$id]); 105 $categoryModel->edit(['route'=>$route,'pid'=>$pid],['id'=>$id]);
106 echo date('Y-m-d H:i:s') . '产品分类id:'. $id.PHP_EOL; 106 echo date('Y-m-d H:i:s') . '产品分类id:'. $id.PHP_EOL;
107 }catch (\Exception $e){ 107 }catch (\Exception $e){
108 - echo date('Y-m-d H:i:s') . '跳过的产品名称:'. $val[1]; 108 + echo date('Y-m-d H:i:s') . '跳过的名称:'. $val[1];
109 continue; 109 continue;
110 } 110 }
111 } 111 }
@@ -368,7 +368,7 @@ class UpdateSeoTdk extends Command @@ -368,7 +368,7 @@ class UpdateSeoTdk extends Command
368 } 368 }
369 } else if ($table == 'gl_product_keyword' && $field == 'seo_title') { 369 } else if ($table == 'gl_product_keyword' && $field == 'seo_title') {
370 # TODO 聚合页seo title 特殊处理 前缀_1 . 关键词 . 后缀_2 370 # TODO 聚合页seo title 特殊处理 前缀_1 . 关键词 . 后缀_2
371 - $seo_title = ''; 371 + $seo_title = $v[$this->topic_fields[$table]];;
372 //只有推广项目才加 前后缀 372 //只有推广项目才加 前后缀
373 if($project->type == Project::TYPE_TWO) { 373 if($project->type == Project::TYPE_TWO) {
374 $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1); 374 $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1);
@@ -377,7 +377,7 @@ class UpdateSeoTdk extends Command @@ -377,7 +377,7 @@ class UpdateSeoTdk extends Command
377 continue; 377 continue;
378 } 378 }
379 379
380 - $title = $v[$this->topic_fields[$table]]; 380 + $title = $seo_title;
381 381
382 $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $title); 382 $prefix = $this->getPrefixKeyword($project_id, 'prefix', 1, $title);
383 //in,for,with,to,near,from 这些介词 只拼前缀,不拼后缀 383 //in,for,with,to,near,from 这些介词 只拼前缀,不拼后缀
@@ -30,8 +30,9 @@ class CategoryController extends BaseController @@ -30,8 +30,9 @@ class CategoryController extends BaseController
30 public function index(Category $category) 30 public function index(Category $category)
31 { 31 {
32 $this->map = $this->searchParam(); 32 $this->map = $this->searchParam();
33 - $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route','keywords', 'describe', 'status','created_at','sort']; 33 + $filed = ['id', 'project_id', 'pid', 'title', 'image', 'route', 'status','created_at','sort'];
34 $this->map['deleted_at'] = null; 34 $this->map['deleted_at'] = null;
  35 + $this->map['pid'] = $this->map['pid'] ?? 0;
35 $list = $category->list($this->map,['sort','id'],$filed); 36 $list = $category->list($this->map,['sort','id'],$filed);
36 $data = []; 37 $data = [];
37 if(!empty($list)){ 38 if(!empty($list)){
@@ -43,11 +44,7 @@ class CategoryController extends BaseController @@ -43,11 +44,7 @@ class CategoryController extends BaseController
43 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']); 44 $v['is_renovation'] = $this->getIsRenovation(BTemplate::SOURCE_PRODUCT,BTemplate::IS_LIST,$template_id,$v['id']);
44 $list[$k] = $v; 45 $list[$k] = $v;
45 } 46 }
46 - if(!isset($this->map['title'])){  
47 - $data = $this->getListSon($list);  
48 - }else{  
49 - $data = $list;  
50 - } 47 + $data = $list;
51 } 48 }
52 return $this->response('success',Code::SUCCESS,$data); 49 return $this->response('success',Code::SUCCESS,$data);
53 } 50 }