作者 lyh

gx

@@ -107,11 +107,30 @@ class RecommendedSuppliers extends Command @@ -107,11 +107,30 @@ class RecommendedSuppliers extends Command
107 $purchaserModel = new Purchaser(); 107 $purchaserModel = new Purchaser();
108 $purchaserModel->add($saveData); 108 $purchaserModel->add($saveData);
109 $this->savePurchaserInfo($project_id,$keyword,$res['data']); 109 $this->savePurchaserInfo($project_id,$keyword,$res['data']);
  110 + }else{
  111 + $title = $this->getKeywords($project_id);
  112 + $this->savePurchaser($project_id,$title);
110 } 113 }
111 return true; 114 return true;
112 } 115 }
113 116
114 /** 117 /**
  118 + * @remark :取关键词
  119 + * @name :getKeywords
  120 + * @author :lyh
  121 + * @method :post
  122 + * @time :2024/7/1 18:07
  123 + */
  124 + public function getKeywords($project_id){
  125 + $info = Keyword::inRandomOrder()->first();
  126 + $keywordInfo = $this->getPurchaser($info->title,$project_id);
  127 + if($keywordInfo !== false){
  128 + $this->getKeywords($project_id);
  129 + }
  130 + return $info->title;
  131 + }
  132 +
  133 + /**
115 * @remark :保存供应商详情 134 * @remark :保存供应商详情
116 * @name :savePurchaserInfo 135 * @name :savePurchaserInfo
117 * @author :lyh 136 * @author :lyh
@@ -50,7 +50,7 @@ class UpdateProductCategory extends Command @@ -50,7 +50,7 @@ class UpdateProductCategory extends Command
50 public function handle(){ 50 public function handle(){
51 //获取所有项目 51 //获取所有项目
52 $projectModel = new Project(); 52 $projectModel = new Project();
53 - $list = $projectModel->list(['id'=>['!=',[1515]],'type'=>['!=',0]],'id',['id']); 53 + $list = $projectModel->list(['id'=>978],'id',['id']);
54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL; 54 echo date('Y-m-d H:i:s') . ' start: ' . json_encode($list) . PHP_EOL;
55 try { 55 try {
56 foreach ($list as $v) { 56 foreach ($list as $v) {