|
...
|
...
|
@@ -9,14 +9,13 @@ |
|
|
|
|
|
|
|
namespace App\Console\Commands\Suppliers;
|
|
|
|
|
|
|
|
use App\Models\Com\Purchaser;
|
|
|
|
use App\Models\Product\Keyword;
|
|
|
|
use App\Models\Project\DeployBuild;
|
|
|
|
use App\Models\Project\Project;
|
|
|
|
use App\Models\Purchaser\Purchaser;
|
|
|
|
use App\Models\Purchaser\PurchaserInfo;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
|
|
|
|
class RecommendedSuppliers extends Command
|
|
|
|
{
|
|
...
|
...
|
@@ -98,7 +97,8 @@ class RecommendedSuppliers extends Command |
|
|
|
];
|
|
|
|
$res = http_post($url,json_encode($param));
|
|
|
|
echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL;
|
|
|
|
if(!empty($res) && $res['code'] == 200){
|
|
|
|
if(!empty($res) && $res['code'] == 200 && !empty($res['data'])){
|
|
|
|
//保存多条数据
|
|
|
|
$saveData = [
|
|
|
|
'project_id'=>$project_id,
|
|
|
|
'keyword'=>$keyword,
|
|
...
|
...
|
@@ -106,7 +106,31 @@ class RecommendedSuppliers extends Command |
|
|
|
];
|
|
|
|
$purchaserModel = new Purchaser();
|
|
|
|
$purchaserModel->add($saveData);
|
|
|
|
$this->savePurchaserInfo($project_id,$keyword,$res['data']);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存供应商详情
|
|
|
|
* @name :savePurchaserInfo
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/5/29 16:38
|
|
|
|
*/
|
|
|
|
public function savePurchaserInfo($project_id,$keyword,$data){
|
|
|
|
$param = [];
|
|
|
|
foreach ($data as $k =>$v){
|
|
|
|
$v['project_id'] = $project_id;
|
|
|
|
$v['keyword'] = $keyword;
|
|
|
|
$v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
|
|
$v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
|
|
$v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
|
|
|
|
$v['created_at'] = date('Y-m-d H:i:s');
|
|
|
|
$v['updated_at'] = $v['created_at'];
|
|
|
|
$param[] = $v;
|
|
|
|
}
|
|
|
|
$purchaserInfoModel = new PurchaserInfo();
|
|
|
|
return $purchaserInfoModel->insert($param);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|