作者 Your Name
... ... @@ -59,20 +59,20 @@ class RecommendedSuppliers extends Command
if(empty($info)){
continue;
}
$keywordInfo = $this->getPurchaser($info['title']);
$keywordInfo = $this->getPurchaser($info->title,$v['project_id']);
if($keywordInfo !== false){
continue;
}
echo date('Y-m-d H:i:s') . '开始:'.$v['project_id'] . PHP_EOL;
$this->savePurchaser($v['id'],$info['title']);
$this->savePurchaser($v['project_id'],$info->title);
DB::disconnect('custom_mysql');
}
return true;
}
public function getPurchaser($keyword){
public function getPurchaser($keyword,$project_id){
$purchaserModel = new Purchaser();
return $purchaserModel->read(['keyword'=>$keyword]);
return $purchaserModel->read(['keyword'=>$keyword,'project_id'=>$project_id]);
}
/**
... ... @@ -97,6 +97,7 @@ class RecommendedSuppliers extends Command
'total'=>$this->param['row'] ?? 10,
];
$res = http_post($url,json_encode($param));
echo date('Y-m-d H:i:s') . $res . PHP_EOL;
if(!empty($res) && $res['code'] == 200){
$saveData = [
'project_id'=>$project_id,
... ...