|
|
|
@ -73,7 +73,7 @@ class Company extends SoftDeletesModel
|
|
|
|
if ($hasSuzhouOut) {
|
|
|
|
if ($hasSuzhouOut) {
|
|
|
|
// 苏州市外:排除 company_area 参数接口返回的苏州市内选项,以及虎丘区
|
|
|
|
// 苏州市外:排除 company_area 参数接口返回的苏州市内选项,以及虎丘区
|
|
|
|
$excludeAreas = Parameter::where('number', 'company_area')
|
|
|
|
$excludeAreas = Parameter::where('number', 'company_area')
|
|
|
|
->with(['detail' => fn ($q) => $q->orderBy('sort', 'asc')])
|
|
|
|
->with(['detail' => fn($q) => $q->orderBy('sort', 'asc')])
|
|
|
|
->first();
|
|
|
|
->first();
|
|
|
|
$excludeList = [];
|
|
|
|
$excludeList = [];
|
|
|
|
if ($excludeAreas && $excludeAreas->detail) {
|
|
|
|
if ($excludeAreas && $excludeAreas->detail) {
|
|
|
|
@ -360,36 +360,29 @@ class Company extends SoftDeletesModel
|
|
|
|
public static function updateMarketStatus($companyId)
|
|
|
|
public static function updateMarketStatus($companyId)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$company = Company::find($companyId);
|
|
|
|
$company = Company::find($companyId);
|
|
|
|
if (!$company || empty($company->company_tag)) {
|
|
|
|
if (!$company) {
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 上市代码正则:匹配全球各地上市公司股票代码后缀
|
|
|
|
if (empty($company->company_tag)) {
|
|
|
|
$stockCodePattern = '/\.(SWR|SW|WR|SS|RS|SB|PK|TO|AX|WS|PR|DB|UN|RT|WT|SH|SZ|BJ|TW|HK|SG|US|DE|FR|JP|KR|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z)(?![A-Za-z0-9])/i';
|
|
|
|
$newMarketStatus = 0;
|
|
|
|
|
|
|
|
|
|
|
|
$hasStockCode = preg_match($stockCodePattern, $company->company_tag);
|
|
|
|
if ($company->company_market != $newMarketStatus) {
|
|
|
|
|
|
|
|
$company->company_market = $newMarketStatus;
|
|
|
|
|
|
|
|
$company->save();
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 不属于新三板上市公司的关键字(需要排除)
|
|
|
|
return false;
|
|
|
|
$excludeXinsanbanKeywords = [
|
|
|
|
}
|
|
|
|
'新三板摘牌',
|
|
|
|
|
|
|
|
'新三板挂牌审核',
|
|
|
|
|
|
|
|
'新三板终止',
|
|
|
|
|
|
|
|
'新三板退市',
|
|
|
|
|
|
|
|
'新三板撤销',
|
|
|
|
|
|
|
|
'新三板注销',
|
|
|
|
|
|
|
|
'新三板中止',
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否包含排除关键字
|
|
|
|
// 上市代码正则:匹配全球各地上市公司股票代码后缀
|
|
|
|
$hasExcludeKeyword = array_reduce($excludeXinsanbanKeywords, function ($carry, $keyword) use ($company) {
|
|
|
|
$stockCodePattern = '/\.(SWR|SW|WR|SS|RS|SB|PK|TO|AX|WS|PR|DB|UN|RT|WT|SH|SZ|BJ|TW|HK|SG|US|DE|FR|JP|KR|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|U|V|W|X|Y|Z)(?![A-Za-z0-9])/i';
|
|
|
|
return $carry || strpos($company->company_tag, $keyword) !== false;
|
|
|
|
|
|
|
|
}, false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 检查是否包含"新三板",且不包含排除关键字
|
|
|
|
$hasStockCode = preg_match($stockCodePattern, $company->company_tag);
|
|
|
|
$hasXinsanban = !$hasExcludeKeyword && strpos($company->company_tag, '新三板') !== false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 如果匹配到股票代码或包含"新三板"(且非排除关键字),则标记为上市
|
|
|
|
// 仅按股票代码判断上市状态,新三板标签不再计入上市公司
|
|
|
|
$newMarketStatus = ($hasStockCode || $hasXinsanban) ? 1 : 0;
|
|
|
|
$newMarketStatus = $hasStockCode ? 1 : 0;
|
|
|
|
|
|
|
|
|
|
|
|
// 只有状态变化才更新
|
|
|
|
// 只有状态变化才更新
|
|
|
|
if ($company->company_market != $newMarketStatus) {
|
|
|
|
if ($company->company_market != $newMarketStatus) {
|
|
|
|
|