up
This commit is contained in:
@@ -196,6 +196,38 @@ class CrawlerService
|
||||
return $codes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从职位树数据中收集可爬取的职位列表(排除 nocheck: true 的节点),用于下拉/勾选展示
|
||||
* @param array $treeData getPositionTree 的返回值
|
||||
* @return array[] 每项为 [ 'zwdm' => CODE, 'title' => TITLE ]
|
||||
*/
|
||||
public function collectPositionListExcludingNocheck(array $treeData): array
|
||||
{
|
||||
$list = [];
|
||||
$nodes = $treeData;
|
||||
if (isset($treeData['data']) && is_array($treeData['data'])) {
|
||||
$nodes = $treeData['data'];
|
||||
} elseif (isset($treeData['tree']) && is_array($treeData['tree'])) {
|
||||
$nodes = $treeData['tree'];
|
||||
}
|
||||
foreach ($nodes as $item) {
|
||||
if (!is_array($item)) {
|
||||
continue;
|
||||
}
|
||||
$nocheck = $item['nocheck'] ?? $item['noCheck'] ?? null;
|
||||
if ($nocheck === true || $nocheck === 1 || (is_string($nocheck) && strtolower($nocheck) === 'true')) {
|
||||
continue;
|
||||
}
|
||||
if (isset($item['CODE']) && $item['CODE'] !== '') {
|
||||
$list[] = [
|
||||
'zwdm' => $item['CODE'],
|
||||
'title' => $item['TITLE'] ?? $item['CODE'],
|
||||
];
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取职位详细信息
|
||||
* @param string $zwdm 职位代码
|
||||
|
||||
Reference in New Issue
Block a user