作者 zhl

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

@@ -12,6 +12,7 @@ namespace App\Console\Commands\Ai; @@ -12,6 +12,7 @@ namespace App\Console\Commands\Ai;
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\Ai\AiBlogList;
  15 +use App\Models\Domain\DomainInfo;
15 use App\Models\Project\ProjectAiSetting; 16 use App\Models\Project\ProjectAiSetting;
16 use App\Models\RouteMap\RouteMap; 17 use App\Models\RouteMap\RouteMap;
17 use App\Services\AiBlogService; 18 use App\Services\AiBlogService;
@@ -51,6 +52,7 @@ class AiBlogListTask extends Command @@ -51,6 +52,7 @@ class AiBlogListTask extends Command
51 $projectAiSettingModel = new ProjectAiSetting(); 52 $projectAiSettingModel = new ProjectAiSetting();
52 $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]); 53 $aiSettingInfo = $projectAiSettingModel->read(['project_id'=>$project_id]);
53 $this->updateBlogList($aiSettingInfo); 54 $this->updateBlogList($aiSettingInfo);
  55 + $this->curlDelRoute($project_id);
54 DB::disconnect('custom_mysql'); 56 DB::disconnect('custom_mysql');
55 return true; 57 return true;
56 } 58 }
@@ -96,4 +98,24 @@ class AiBlogListTask extends Command @@ -96,4 +98,24 @@ class AiBlogListTask extends Command
96 } 98 }
97 return true; 99 return true;
98 } 100 }
  101 +
  102 + /**
  103 + * @remark :通知C端生成界面
  104 + * @name :sendNotice
  105 + * @author :lyh
  106 + * @method :post
  107 + * @time :2025/3/6 11:51
  108 + */
  109 + public function curlDelRoute($project_id){
  110 + $domainModel = new DomainInfo();
  111 + //获取项目域名
  112 + $domain = $domainModel->getProjectIdDomain($project_id);
  113 + if(!empty($domain)){
  114 + $url = $domain.'api/update_page/?project_id='.$project_id.'&route=7';
  115 + shell_exec('curl -k "'.$url.'"');
  116 + }else{
  117 + echo '域名不存在:' . $project_id . PHP_EOL . date('Y-m-d H:i:s');
  118 + }
  119 + return true;
  120 + }
99 } 121 }
@@ -51,14 +51,63 @@ class LyhImportTest extends Command @@ -51,14 +51,63 @@ class LyhImportTest extends Command
51 * @time :2023/11/20 15:13 51 * @time :2023/11/20 15:13
52 */ 52 */
53 public function handle(){ 53 public function handle(){
54 -// ProjectServer::useProject(3283);  
55 -// echo date('Y-m-d H:i:s') . 'start' . PHP_EOL; 54 + ProjectServer::useProject(3283);
  55 + echo date('Y-m-d H:i:s') . 'start' . PHP_EOL;
  56 + $this->importProductCategory('https://ecdn6.globalso.com/upload/p/3283/file/2025-03/zy_boss_pricelistcat_202503131025.csv','3283');
56 // $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283); 57 // $this->importProduct('https://ecdn6.globalso.com/upload/p/1/file/2025-03/zy_boss_price_copy1.csv',3283);
57 -// DB::disconnect('custom_mysql'); 58 + DB::disconnect('custom_mysql');
58 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL; 59 echo date('Y-m-d H:i:s') . 'end' . PHP_EOL;
59 } 60 }
60 61
61 /** 62 /**
  63 + * @remark :导入产品分类
  64 + * @name :productCategory
  65 + * @author :lyh
  66 + * @method :post
  67 + * @time :2025/3/13 9:58
  68 + */
  69 + public function importProductCategory($url,$project_id){
  70 + $line_of_text = [];
  71 + $opts = [
  72 + 'http' => [
  73 + 'method' => 'GET',
  74 + 'header' => 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'
  75 + ],
  76 + 'ssl' => [
  77 + 'verify_peer' => false,
  78 + 'verify_peer_name' => false
  79 + ]
  80 + ];
  81 + $file_handle = fopen($url, 'r', null, stream_context_create($opts));
  82 + while (!feof($file_handle)) {
  83 + $line_of_text[] = fgetcsv($file_handle, 0, ',');
  84 + }
  85 + fclose($file_handle);
  86 + $categoryModel = new Category();
  87 + foreach ($line_of_text as $k => $val){
  88 + if($k < 1){
  89 + continue;
  90 + }
  91 + if(empty($val[1])){
  92 + continue;
  93 + }
  94 + $id = $categoryModel->addReturnId(['project_id'=>$project_id,'title'=>$val[1],'seo_title'=>$val[0],'seo_keyword'=>$val[2]]);
  95 + $pid = 0;
  96 + if($val[2] != 0){
  97 + //查询上级id
  98 + $pidCate = $categoryModel->read(['seo_title'=>$val[2]]);
  99 + if($pidCate !== false){
  100 + $pid = $pidCate['id'];
  101 + }
  102 + }
  103 + $route = RouteMap::setRoute($val[1],RouteMap::SOURCE_PRODUCT_CATE,$id,$project_id);
  104 + $categoryModel->edit(['route'=>$route,'pid'=>$pid],['id'=>$id]);
  105 + echo date('Y-m-d H:i:s') . '产品分类id:'. $id;
  106 + }
  107 + return true;
  108 + }
  109 +
  110 + /**
62 * @remark :导入分类 111 * @remark :导入分类
63 * @name :importProductCategory 112 * @name :importProductCategory
64 * @author :lyh 113 * @author :lyh
@@ -85,7 +134,6 @@ class LyhImportTest extends Command @@ -85,7 +134,6 @@ class LyhImportTest extends Command
85 $cateModel = new Category(); 134 $cateModel = new Category();
86 $productModel = new Product(); 135 $productModel = new Product();
87 $detailModel = new Detail(); 136 $detailModel = new Detail();
88 - $columnModel = new Column();  
89 foreach ($line_of_text as $k => $val){ 137 foreach ($line_of_text as $k => $val){
90 if($k < 2){ 138 if($k < 2){
91 continue; 139 continue;
@@ -106,8 +154,8 @@ class LyhImportTest extends Command @@ -106,8 +154,8 @@ class LyhImportTest extends Command
106 $saveData['content'] = $val[3]; 154 $saveData['content'] = $val[3];
107 $seo = ['seo_title'=>$val[5]]; 155 $seo = ['seo_title'=>$val[5]];
108 $saveData['seo_mate'] = json_encode($seo,true); 156 $saveData['seo_mate'] = json_encode($seo,true);
109 - $thumb = ['alt'=>'主图','url'=>str_replace('/public','',$val[6])];  
110 - $gallery = [['alt'=>'主图','url'=>str_replace('/public','',$val[6])]]; 157 + $thumb = ['alt'=>'主图','url'=>str_replace('/public','/upload/p/3283',$val[6])];
  158 + $gallery = [['alt'=>'主图','url'=>str_replace('/public','/upload/p/3283',$val[6])]];
111 $saveData['thumb'] = json_encode($thumb,true); 159 $saveData['thumb'] = json_encode($thumb,true);
112 $saveData['gallery'] = json_encode($gallery,true); 160 $saveData['gallery'] = json_encode($gallery,true);
113 $id = $productModel->addReturnId($saveData); 161 $id = $productModel->addReturnId($saveData);
@@ -127,22 +175,16 @@ class LyhImportTest extends Command @@ -127,22 +175,16 @@ class LyhImportTest extends Command
127 'content'=>json_encode(['content'=>$val[3]]) 175 'content'=>json_encode(['content'=>$val[3]])
128 ]; 176 ];
129 $detailModel->addReturnId($detail); 177 $detailModel->addReturnId($detail);
130 - //扩展描述设置  
131 - $detailFaq = [  
132 - 'column_name'=>'FAQs',  
133 - 'product_id'=>$id  
134 - ];  
135 - $faqId = $columnModel->addReturnId($detailFaq);  
136 -  
137 $faqsDetail = json_decode($val[4],true); 178 $faqsDetail = json_decode($val[4],true);
138 - $faqContent = '';  
139 if(!empty($faqsDetail) && is_array($faqsDetail)){ 179 if(!empty($faqsDetail) && is_array($faqsDetail)){
  180 + $faqContent = '<div>';
140 foreach ($faqsDetail as $faq_Val){ 181 foreach ($faqsDetail as $faq_Val){
141 - $faqContent .= "question:".$faq_Val['question'] . "<br />" . "answer:".$faq_Val['answer']. "<br />"; 182 + $faqContent .= "<span>question:".$faq_Val['question'] . "</span><br /><span>" . "answer:".$faq_Val['answer']. "</span><br />";
142 } 183 }
  184 + $faqContent .= '</div>';
143 $detailFaqInfo = [ 185 $detailFaqInfo = [
144 'product_id'=>$id, 186 'product_id'=>$id,
145 - 'column_id'=>$faqId, 187 + 'column_id'=>1,
146 'text_type'=>1, 188 'text_type'=>1,
147 'content'=>json_encode(['content'=>$faqContent]) 189 'content'=>json_encode(['content'=>$faqContent])
148 ]; 190 ];
@@ -226,7 +226,7 @@ class WeekProject extends Command @@ -226,7 +226,7 @@ class WeekProject extends Command
226 if(!empty($data['daily_average_num'])){ 226 if(!empty($data['daily_average_num'])){
227 $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。'; 227 $content2 .= '本周日均访客量:'.$data['daily_average_num'].'+。';
228 } 228 }
229 - $content2 .= '全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;'; 229 + $content2 .= PHP_EOL.'全球搜建议用户持续分析、选择、添加企业、产品、服务等相关关键词进行优化和监控,以覆盖更多相关排名和流量;';
230 } 230 }
231 if(!empty($content2)){ 231 if(!empty($content2)){
232 $arr[] = $content2; 232 $arr[] = $content2;
@@ -251,7 +251,7 @@ class WeekProject extends Command @@ -251,7 +251,7 @@ class WeekProject extends Command
251 $content3 .= '新闻:'.$data['week_news_num'].'条。'; 251 $content3 .= '新闻:'.$data['week_news_num'].'条。';
252 } 252 }
253 } 253 }
254 - $content3 .= '全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;'; 254 + $content3 .= PHP_EOL.'全球搜建议用户保持网站内容的持续更新与完善,可参考谷歌关于创建实用、可靠、以用户为中心的内容的相关建议:https://developers.google.com/search/docs/fundamentals/creating-helpful-content?hl=zh-cn;';
255 } 255 }
256 if(!empty($content3)){ 256 if(!empty($content3)){
257 $arr[] = $content3; 257 $arr[] = $content3;
@@ -270,7 +270,7 @@ class WeekProject extends Command @@ -270,7 +270,7 @@ class WeekProject extends Command
270 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。'; 270 $content4 .= '聚合页小语种站页面'.$data['aggregation_minor_update_num'].'次。';
271 } 271 }
272 if(!empty($content4)){ 272 if(!empty($content4)){
273 - $content4 = '本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4; 273 + $content4 = PHP_EOL.'本周主要优化工作包括:TDK、H标签、Img标签等优化设置排查与进一步完善,Sitemap更新与网页收录提交,外链新增与排查。'.$content4;
274 } 274 }
275 if(!empty($content4)){ 275 if(!empty($content4)){
276 $arr[] = $content4; 276 $arr[] = $content4;
@@ -9,10 +9,6 @@ use App\Http\Requests\Bside\Ai\AiBlogRequest; @@ -9,10 +9,6 @@ use App\Http\Requests\Bside\Ai\AiBlogRequest;
9 use App\Models\Ai\AiBlog; 9 use App\Models\Ai\AiBlog;
10 use App\Models\Ai\AiBlogAuthor; 10 use App\Models\Ai\AiBlogAuthor;
11 use App\Models\Ai\AiBlogList; 11 use App\Models\Ai\AiBlogList;
12 -use App\Models\RouteMap\RouteMap;  
13 -use App\Services\AiBlogService;  
14 -use App\Services\ProjectServer;  
15 -use Illuminate\Support\Facades\DB;  
16 12
17 class AiBlogController extends BaseController 13 class AiBlogController extends BaseController
18 { 14 {
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :KeywordUrlController.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/3/12 17:01
  8 + */
  9 +
  10 +namespace App\Http\Controllers\Bside\Product;
  11 +
  12 +use App\Enums\Common\Code;
  13 +use App\Http\Controllers\Bside\BaseController;
  14 +use App\Http\Logic\Bside\Product\KeywordUrlLogic;
  15 +use App\Models\Product\KeywordUrl;
  16 +
  17 +/**
  18 + * @remark :关键词设置
  19 + * @name :KeywordUrlController
  20 + * @author :lyh
  21 + * @method :post
  22 + * @time :2025/3/12 17:01
  23 + */
  24 +class KeywordUrlController extends BaseController
  25 +{
  26 + /**
  27 + * @remark :关键词设置列表
  28 + * @name :lists
  29 + * @author :lyh
  30 + * @method :post
  31 + * @time :2025/3/12 17:01
  32 + * @param :keyword->关键字
  33 + */
  34 + public function lists(KeywordUrl $keywordUrl){
  35 + if(isset($this->map['keyword']) && !empty($this->map['keyword'])){
  36 + $this->map['keyword'] = ['like','%'.$this->map['keyword'].'%'];
  37 + }
  38 + $filed = ['id','keyword','url','created_at','updated_at'];
  39 + $lists = $keywordUrl->lists($this->map,$this->page,$this->row,$this->order,$filed);
  40 + $this->response('success',Code::SUCCESS,$lists);
  41 + }
  42 +
  43 + /**
  44 + * @remark :获取数据详情
  45 + * @name :info
  46 + * @author :lyh
  47 + * @method :post
  48 + * @time :2025/3/12 17:25
  49 + */
  50 + public function info(KeywordUrl $keywordUrl){
  51 + $this->request->validate([
  52 + 'id'=>['required'],
  53 + ],[
  54 + 'id.required' => 'id不能为空',
  55 + ]);
  56 + $lists = $keywordUrl->read(['id'=>$this->param['id']]);
  57 + $this->response('success',Code::SUCCESS,$lists);
  58 + }
  59 +
  60 + /**
  61 + * @remark :保存数据
  62 + * @name :save
  63 + * @author :lyh
  64 + * @method :post
  65 + * @time :2025/3/12 17:02
  66 + * @param :keyword->关键词; url->对应路由
  67 + */
  68 + public function save(KeywordUrlLogic $keywordUrlLogic){
  69 + $this->request->validate([
  70 + 'keyword'=>['required'],
  71 + 'url'=>['required'],
  72 + ],[
  73 + 'keyword.required' => 'keyword不能为空',
  74 + 'url.required' => 'url不能为空',
  75 + ]);
  76 + $result = $keywordUrlLogic->saveKeywordUrl();
  77 + $this->response('success',Code::SUCCESS,$result);
  78 + }
  79 +
  80 + /**
  81 + * @remark :删除数据
  82 + * @name :del
  83 + * @author :lyh
  84 + * @method :post
  85 + * @time :2025/3/12 17:02
  86 + */
  87 + public function del(KeywordUrl $keywordUrl){
  88 + $this->request->validate([
  89 + 'id'=>['required'],
  90 + ],[
  91 + 'id.required' => 'id不能为空',
  92 + ]);
  93 + $result = $keywordUrl->del($this->param);
  94 + $this->response('success',Code::SUCCESS,$result);
  95 + }
  96 +}
@@ -202,7 +202,7 @@ class InquiryForwardLogic extends BaseLogic @@ -202,7 +202,7 @@ class InquiryForwardLogic extends BaseLogic
202 } 202 }
203 203
204 //更改询盘状态及转发数量 204 //更改询盘状态及转发数量
205 - $this->model->edit(['status' => InquiryInfo::STATUS_FINISH, 'num' => $num], ['id' => $this->param['id']]); 205 + $this->model->edit(['status' => InquiryInfo::STATUS_FINISH, 'num' => $num, 'operator_id' => $this->manager['id']], ['id' => $this->param['id']]);
206 206
207 DB::commit(); 207 DB::commit();
208 } catch (\Exception $e) { 208 } catch (\Exception $e) {
@@ -364,7 +364,7 @@ class InquiryForwardLogic extends BaseLogic @@ -364,7 +364,7 @@ class InquiryForwardLogic extends BaseLogic
364 $status = InquiryInfo::STATUS_INVALID; 364 $status = InquiryInfo::STATUS_INVALID;
365 $remark = '手动置为无效'; 365 $remark = '手动置为无效';
366 } 366 }
367 - $rs = $this->model->edit(['status' => $status, 'remark' => $remark], ['id' => $this->param['id']]); 367 + $rs = $this->model->edit(['status' => $status, 'remark' => $remark, 'operator_id' => $this->manager['id']], ['id' => $this->param['id']]);
368 368
369 if ($rs === false) { 369 if ($rs === false) {
370 $this->fail('设置失败'); 370 $this->fail('设置失败');
@@ -243,7 +243,7 @@ class ProjectLogic extends BaseLogic @@ -243,7 +243,7 @@ class ProjectLogic extends BaseLogic
243 $aiSettingInfo = $aiSettingModel->read(['project_id'=>$project_id]); 243 $aiSettingInfo = $aiSettingModel->read(['project_id'=>$project_id]);
244 if($aiSettingInfo === false){ 244 if($aiSettingInfo === false){
245 $aiBlogService = new AiBlogService(); 245 $aiBlogService = new AiBlogService();
246 - $result = $aiBlogService->createProject($title,$languageInfo['short'],$projectInfo['company']); 246 + $result = $aiBlogService->createProject($projectInfo['company'] ?? $title,$languageInfo['short'],$projectInfo['company']);
247 if(isset($result['status']) && $result['status'] == 200){ 247 if(isset($result['status']) && $result['status'] == 200){
248 //查看当前项目是否已有记录 248 //查看当前项目是否已有记录
249 $resData = [ 249 $resData = [
@@ -6,9 +6,7 @@ use App\Helper\Translate; @@ -6,9 +6,7 @@ use App\Helper\Translate;
6 use App\Http\Logic\Bside\BaseLogic; 6 use App\Http\Logic\Bside\BaseLogic;
7 use App\Models\Ai\AiBlog; 7 use App\Models\Ai\AiBlog;
8 use App\Models\Ai\AiBlogAuthor; 8 use App\Models\Ai\AiBlogAuthor;
9 -use App\Models\Ai\AiBlogList;  
10 use App\Models\Project\AiBlogTask; 9 use App\Models\Project\AiBlogTask;
11 -use App\Models\Project\Project;  
12 use App\Models\Project\ProjectAiSetting; 10 use App\Models\Project\ProjectAiSetting;
13 use App\Models\RouteMap\RouteMap; 11 use App\Models\RouteMap\RouteMap;
14 use App\Services\AiBlogService; 12 use App\Services\AiBlogService;
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :KeywordUrlLogic.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/3/12 17:06
  8 + */
  9 +
  10 +namespace App\Http\Logic\Bside\Product;
  11 +
  12 +use App\Http\Logic\Bside\BaseLogic;
  13 +use App\Models\Product\KeywordUrl;
  14 +
  15 +/**
  16 + * @remark :关键词设置
  17 + * @name :KeywordUrlLogic
  18 + * @author :lyh
  19 + * @method :post
  20 + * @time :2025/3/12 17:07
  21 + */
  22 +class KeywordUrlLogic extends BaseLogic
  23 +{
  24 + public function __construct()
  25 + {
  26 + parent::__construct();
  27 + $this->param = $this->requestAll;
  28 + $this->model = new KeywordUrl();
  29 + }
  30 +
  31 + /**
  32 + * @remark :保存数据
  33 + * @name :saveKeywordUrl
  34 + * @author :lyh
  35 + * @method :post
  36 + * @time :2025/3/12 17:08
  37 + */
  38 + public function saveKeywordUrl(){
  39 + if(isset($this->param['id']) && !empty($this->param['id'])){
  40 + $id = $this->param['id'];
  41 + $this->model->edit($this->param,['id'=>$this->param['id']]);
  42 + }else{
  43 + $id = $this->model->addReturnId($this->param);
  44 + }
  45 + return $this->success(['id'=>$id]);
  46 + }
  47 +
  48 +
  49 +}
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :KeywordUrl.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2025/3/12 16:59
  8 + */
  9 +
  10 +namespace App\Models\Product;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +/**
  15 + * @remark :关键词设置
  16 + * @name :KeywordUrl
  17 + * @author :lyh
  18 + * @method :post
  19 + * @time :2025/3/12 17:00
  20 + */
  21 +class KeywordUrl extends Base
  22 +{
  23 + //设置关联表名
  24 + protected $table = 'gl_keyword_url';
  25 + //连接数据库
  26 + protected $connection = 'custom_mysql';
  27 +}
@@ -673,6 +673,14 @@ Route::middleware(['bloginauth'])->group(function () { @@ -673,6 +673,14 @@ Route::middleware(['bloginauth'])->group(function () {
673 Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'getYoutubeInfo'])->name('youtube_getYoutubeInfo'); 673 Route::any('/info', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'getYoutubeInfo'])->name('youtube_getYoutubeInfo');
674 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'saveYoutube'])->name('youtube_saveYoutube'); 674 Route::any('/save', [\App\Http\Controllers\Bside\Setting\WebSettingYoutubeController::class, 'saveYoutube'])->name('youtube_saveYoutube');
675 }); 675 });
  676 +
  677 + //seo白帽 关键词设置
  678 + Route::prefix('keyword_url')->group(function () {
  679 + Route::any('/', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'lists'])->name('keyword_url_lists');
  680 + Route::any('/info', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'info'])->name('keyword_url_info');
  681 + Route::any('/save', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'save'])->name('keyword_url_save');
  682 + Route::any('/del', [\App\Http\Controllers\Bside\Product\KeywordUrlController::class, 'del'])->name('keyword_url_del');
  683 + });
676 }); 684 });
677 //无需登录验证的路由组 685 //无需登录验证的路由组
678 Route::group([], function () { 686 Route::group([], function () {