作者 赵彬吉
@@ -19,6 +19,7 @@ use App\Models\GoogleSearch\GoogleCodeCountry; @@ -19,6 +19,7 @@ use App\Models\GoogleSearch\GoogleCodeCountry;
19 use App\Models\Product\CategoryRelated; 19 use App\Models\Product\CategoryRelated;
20 use App\Models\Product\Keyword; 20 use App\Models\Product\Keyword;
21 use App\Models\Product\Product; 21 use App\Models\Product\Product;
  22 +use App\Models\Project\AggregateKeyword;
22 use App\Models\Project\AiBlogTask; 23 use App\Models\Project\AiBlogTask;
23 use App\Models\Project\DeployOptimize; 24 use App\Models\Project\DeployOptimize;
24 use App\Models\Project\Project; 25 use App\Models\Project\Project;
@@ -66,7 +67,36 @@ class UpdateRoute extends Command @@ -66,7 +67,36 @@ class UpdateRoute extends Command
66 */ 67 */
67 public function handle() 68 public function handle()
68 { 69 {
69 - return $this->_action(); 70 + return $this->keyword_actions();
  71 + }
  72 +
  73 + public function keyword_actions(){
  74 + $a = new AggregateKeyword();
  75 + $list = $a->formatQuery(['status'=>1])->pluck('project_id')->unique()->values()->toArray();
  76 + foreach ($list as $v){
  77 + echo date('Y-m-d H:i:s').' 执行的项目id:'.$v.PHP_EOL;
  78 + ProjectServer::useProject($v);
  79 + $keywordModel = new Keyword();
  80 + $keyList = $keywordModel->list(['status'=>1],'id',['id','title'],'asc');
  81 + foreach ($keyList as $keyV){
  82 + echo date('Y-m-d H:i:s').'对应数据id:'.$keyV['id'].PHP_EOL;
  83 + $keywordInfo = $keywordModel->read(['id'=>$keyV['id']],['id']);
  84 + if($keywordInfo !== false){
  85 + $keywordIds = $keywordModel->formatQuery(['id'=>['!=',$keyV['id'],'title'=>$keyV['title']]])->pluck('id')->toArray();
  86 + if(!empty($keywordIds)){
  87 + echo date('Y-m-d H:i:s').'清空对应重复的关键词....'.PHP_EOL;
  88 + $keywordModel->del(['id'=>['in',$keywordIds]]);
  89 + $routeMapModel = new RouteMap();
  90 + $routeMapModel->del(['source'=>'product_keyword','source_id'=>['in',$keywordIds]]);
  91 + }else{
  92 + echo date('Y-m-d H:i:s').'无重复关键词..'.PHP_EOL;
  93 + }
  94 + }else{
  95 + echo '当前关键词已被清除'.PHP_EOL;
  96 + }
  97 + }
  98 + DB::disconnect('custom_mysql');
  99 + }
70 } 100 }
71 101
72 /** 102 /**
@@ -58,8 +58,6 @@ class OptimizeSetKeywordSync extends Command @@ -58,8 +58,6 @@ class OptimizeSetKeywordSync extends Command
58 $item->status = AggregateKeyword::STATUS_FINISH; 58 $item->status = AggregateKeyword::STATUS_FINISH;
59 $item->save(); 59 $item->save();
60 } 60 }
61 - Common::del_user_cache('product_keyword',$this->user['project_id']);  
62 - NoticeLog::createLog(NoticeLog::TYPE_INIT_KEYWORD, ['project_id' => $this->user['project_id']]);  
63 return true; 61 return true;
64 } 62 }
65 63
@@ -71,7 +69,7 @@ class OptimizeSetKeywordSync extends Command @@ -71,7 +69,7 @@ class OptimizeSetKeywordSync extends Command
71 */ 69 */
72 public function syncKeyword($project_id, $keywords) 70 public function syncKeyword($project_id, $keywords)
73 { 71 {
74 - $keywords = explode("\n", $keywords); 72 + $keywords = explode("\r\n", $keywords);
75 $keywords = array_unique(array_filter($keywords)); 73 $keywords = array_unique(array_filter($keywords));
76 ProjectServer::useProject($project_id); 74 ProjectServer::useProject($project_id);
77 $keywordModel = new Keyword(); 75 $keywordModel = new Keyword();
@@ -43,6 +43,8 @@ class DomainInfoController extends BaseController @@ -43,6 +43,8 @@ class DomainInfoController extends BaseController
43 $lists['list'][$k]['company'] = $company; 43 $lists['list'][$k]['company'] = $company;
44 } 44 }
45 } 45 }
  46 + $lists['y_status'] = $domainModel->counts(['status'=>1]);
  47 + $lists['n_status'] = $domainModel->counts(['status'=>0]);
46 return $this->response('success', Code::SUCCESS, $lists); 48 return $this->response('success', Code::SUCCESS, $lists);
47 } 49 }
48 50
@@ -554,6 +554,8 @@ class ProductController extends BaseController @@ -554,6 +554,8 @@ class ProductController extends BaseController
554 } 554 }
555 if(!empty($v['og_image'])){ 555 if(!empty($v['og_image'])){
556 $v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']); 556 $v['og_image'] = getImageUrl($v['og_image'] ?? '',$this->user['storage_type'],$this->user['project_location']);
  557 + }else{
  558 + $v['og_image'] = $v['thumb']['url'] ?? '';
557 } 559 }
558 if(!empty($v['icon'])){ 560 if(!empty($v['icon'])){
559 foreach ($v['icon'] as $icon_k => $icon_v){ 561 foreach ($v['icon'] as $icon_k => $icon_v){
@@ -357,8 +357,10 @@ class ProductLogic extends BaseLogic @@ -357,8 +357,10 @@ class ProductLogic extends BaseLogic
357 $param['thumb'] = Arr::a2s([]); 357 $param['thumb'] = Arr::a2s([]);
358 $param['gallery'] = Arr::a2s([]); 358 $param['gallery'] = Arr::a2s([]);
359 } 359 }
360 - if(isset($param['og_image'])){ 360 + if(isset($param['og_image']) && !empty($param['og_image'])){
361 $param['og_image'] = str_replace_url($param['og_image'] ?? ''); 361 $param['og_image'] = str_replace_url($param['og_image'] ?? '');
  362 + }else{
  363 + $param['og_image'] = $param['thumb']['url'] ?? '';
362 } 364 }
363 if(isset($param['files'])){ 365 if(isset($param['files'])){
364 $param['files']['url'] = str_replace_url($param['files']['url'] ?? ''); 366 $param['files']['url'] = str_replace_url($param['files']['url'] ?? '');
@@ -156,8 +156,8 @@ class Keyword extends Base @@ -156,8 +156,8 @@ class Keyword extends Base
156 if(empty($v)){ 156 if(empty($v)){
157 continue; 157 continue;
158 } 158 }
159 - $info = $this->read(['title'=>$v],['id']);  
160 - if($info === false){ 159 + $info = $this->read(['title'=>trim($v)],['id']);
  160 + if($info == false){
161 $param['project_id'] = $project_id; 161 $param['project_id'] = $project_id;
162 $param['title'] = $v; 162 $param['title'] = $v;
163 $param['first_word'] = $this->first_word($param['title']); 163 $param['first_word'] = $this->first_word($param['title']);