master
cody 2 weeks ago
parent 2ec2e7ad3b
commit 1ce011e08b

@ -43,8 +43,8 @@ class UpdateCompany extends Command
public function handle() public function handle()
{ {
$user_id = $this->option('user_id'); $user_id = $this->option('user_id');
$updateLocal = (int) $this->option('address'); $updateLocal = (int)$this->option('address');
$updateMarket = (int) $this->option('market'); $updateMarket = (int)$this->option('market');
// 更新公司信息 // 更新公司信息
$this->compnay($user_id); $this->compnay($user_id);
// 更新经纬度信息(可选) // 更新经纬度信息(可选)
@ -142,6 +142,8 @@ class UpdateCompany extends Command
// 更新用户关联 // 更新用户关联
$user->company_id = $company->id; $user->company_id = $company->id;
$user->save(); $user->save();
// 更新上市状态
$this->updateMarketStatus($company->id);
$bar->setMessage($result['enterpriseName'] . ' 更新成功', 'status'); $bar->setMessage($result['enterpriseName'] . ' 更新成功', 'status');
$bar->advance(); $bar->advance();
} }
@ -203,14 +205,18 @@ class UpdateCompany extends Command
* 根据 company_tag 更新上市状态 * 根据 company_tag 更新上市状态
* 判断是否包含上市代码标签,如 688001.SH、000001.SZ、830001.BJ 等 * 判断是否包含上市代码标签,如 688001.SH、000001.SZ、830001.BJ 等
*/ */
public function updateMarketStatus() public function updateMarketStatus($companyId = null)
{ {
$this->info('开始更新上市状态...'); $this->info('开始更新上市状态...');
// 获取所有有 company_tag 的公司 // 获取所有有 company_tag 的公司
$companies = Company::whereNotNull('company_tag') if ($companyId) {
->where('company_tag', '!=', '') $companies = Company::where('id', $companyId)->get();
->get(); } else {
$companies = Company::whereNotNull('company_tag')
->where('company_tag', '!=', '')
->get();
}
$total = $companies->count(); $total = $companies->count();
if ($total == 0) { if ($total == 0) {

Loading…
Cancel
Save