|
|
|
|
@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
|
|
|
|
|
|
use App\Models\Company;
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
use App\Repositories\MeetRepository;
|
|
|
|
|
use App\Repositories\YuanheRepository;
|
|
|
|
|
@ -15,7 +16,7 @@ class UpdateCompany extends Command
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
|
|
|
|
protected $signature = 'update_company';
|
|
|
|
|
protected $signature = 'update_company {--user_id=}';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The console command description.
|
|
|
|
|
@ -41,14 +42,54 @@ class UpdateCompany extends Command
|
|
|
|
|
*/
|
|
|
|
|
public function handle()
|
|
|
|
|
{
|
|
|
|
|
$users = User::get();
|
|
|
|
|
$user_id = $this->option('user_id');
|
|
|
|
|
$users = User::where(function ($query) use ($user_id) {
|
|
|
|
|
if ($user_id) {
|
|
|
|
|
$query->where('id', $user_id);
|
|
|
|
|
}
|
|
|
|
|
})->get();
|
|
|
|
|
$YuanheRepository = new YuanheRepository();
|
|
|
|
|
foreach ($users as $user) {
|
|
|
|
|
$result = $YuanheRepository->companyInfo(['enterpriseName' => $user->company_name]);
|
|
|
|
|
dd($result);
|
|
|
|
|
|
|
|
|
|
if (!$result) {
|
|
|
|
|
$this->info($user->company_name . '公司不存在');
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
$where = ['company_name' => $result['enterpriseName']];
|
|
|
|
|
$data = [
|
|
|
|
|
'company_address' => $result['address'],
|
|
|
|
|
'business_scope' => $result['businessScope'],
|
|
|
|
|
'company_city' => $result['city'],
|
|
|
|
|
'contact_mail' => $result['contactMail'],
|
|
|
|
|
'contact_phone' => $result['contactPhone'],
|
|
|
|
|
'company_area' => $result['country'],
|
|
|
|
|
'credit_code' => $result['creditCode'],
|
|
|
|
|
'enterprise_id' => $result['enterpriseId'],
|
|
|
|
|
'company_name' => $result['enterpriseName'],
|
|
|
|
|
'is_abroad' => $result['isAbroad'],
|
|
|
|
|
'company_market' => $result['isOnStock'],
|
|
|
|
|
'is_yh_invested' => $result['isYhInvested'],
|
|
|
|
|
'logo' => $result['logo'],
|
|
|
|
|
'company_legal_representative' => $result['operName'],
|
|
|
|
|
'company_province' => $result['province'],
|
|
|
|
|
'company_industry' => $result['qccIndustry'],
|
|
|
|
|
'regist_amount' => $result['registAmount'],
|
|
|
|
|
'regist_capi_type' => $result['registCapiType'],
|
|
|
|
|
'company_date' => $result['startDate'],
|
|
|
|
|
'status' => $result['status'],
|
|
|
|
|
'stock_date' => $result['stockDate'],
|
|
|
|
|
'currency_type' => $result['currencyType'],
|
|
|
|
|
'stock_number' => $result['stockNumber'],
|
|
|
|
|
'stock_type' => $result['stockType'],
|
|
|
|
|
'company_tag' => $result['tagList'],
|
|
|
|
|
];
|
|
|
|
|
$company = Company::updateOrCreate($where, $data);
|
|
|
|
|
// 更新用户关联
|
|
|
|
|
$user->company_id = $company->id;
|
|
|
|
|
$user->save();
|
|
|
|
|
$this->info($result['enterpriseName'] . '-更新成功');
|
|
|
|
|
}
|
|
|
|
|
return $this->info('更新完成');
|
|
|
|
|
return $this->info('全部更新完成');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|