master
cody 2 weeks ago
parent 2ec2e7ad3b
commit 1ce011e08b

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

Loading…
Cancel
Save