正在显示
1 个修改的文件
包含
10 行增加
和
2 行删除
| @@ -58,12 +58,20 @@ class RecommendedSuppliers extends Command | @@ -58,12 +58,20 @@ class RecommendedSuppliers extends Command | ||
| 58 | if(empty($keywordInfo)){ | 58 | if(empty($keywordInfo)){ |
| 59 | continue; | 59 | continue; |
| 60 | } | 60 | } |
| 61 | - $this->getPurchaser($v['id'],$keywordInfo['title']); | 61 | + $keywordInfo = $this->getPurchaser($keywordInfo['title']); |
| 62 | + if($keywordInfo !== false){ | ||
| 63 | + continue; | ||
| 64 | + } | ||
| 65 | + $this->savePurchaser($v['id'],$keywordInfo['title']); | ||
| 62 | DB::disconnect('custom_mysql'); | 66 | DB::disconnect('custom_mysql'); |
| 63 | } | 67 | } |
| 64 | return true; | 68 | return true; |
| 65 | } | 69 | } |
| 66 | 70 | ||
| 71 | + public function getPurchaser($keyword){ | ||
| 72 | + $purchaserModel = new Purchaser(); | ||
| 73 | + return $purchaserModel->read(['keyword'=>$keyword]); | ||
| 74 | + } | ||
| 67 | 75 | ||
| 68 | /** | 76 | /** |
| 69 | * @remark :保存供应商 | 77 | * @remark :保存供应商 |
| @@ -72,7 +80,7 @@ class RecommendedSuppliers extends Command | @@ -72,7 +80,7 @@ class RecommendedSuppliers extends Command | ||
| 72 | * @method :post | 80 | * @method :post |
| 73 | * @time :2024/3/5 11:38 | 81 | * @time :2024/3/5 11:38 |
| 74 | */ | 82 | */ |
| 75 | - public function getPurchaser($project_id,$keyword,$row = 10){ | 83 | + public function savePurchaser($project_id,$keyword,$row = 10){ |
| 76 | $url = 'https://admin.hagro.cn/api/company_list'; | 84 | $url = 'https://admin.hagro.cn/api/company_list'; |
| 77 | $data = [ | 85 | $data = [ |
| 78 | 'prod_desc'=>$keyword, | 86 | 'prod_desc'=>$keyword, |
-
请 注册 或 登录 后发表评论