up
This commit is contained in:
@@ -341,17 +341,26 @@ class Crawler extends BaseController
|
|||||||
$treeData = $service->getPositionTree($dsdm, $examid, $bmid, $userid, (string)$aa, $cookies);
|
$treeData = $service->getPositionTree($dsdm, $examid, $bmid, $userid, (string)$aa, $cookies);
|
||||||
|
|
||||||
$zwdmList = [];
|
$zwdmList = [];
|
||||||
if (is_array($treeData)) {
|
$collectCodes = function (array $nodes) use (&$collectCodes, &$zwdmList) {
|
||||||
foreach ($treeData as $item) {
|
foreach ($nodes as $item) {
|
||||||
if (isset($item['CODE']) && !empty($item['CODE'])) {
|
|
||||||
// 跳过包含 nocheck: true 的节点(如分组节点,不参与爬取)
|
// 跳过包含 nocheck: true 的节点(如分组节点,不参与爬取)
|
||||||
if (!empty($item['nocheck'])) {
|
if (!empty($item['nocheck'])) {
|
||||||
|
if (!empty($item['children']) && is_array($item['children'])) {
|
||||||
|
$collectCodes($item['children']);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (isset($item['CODE']) && $item['CODE'] !== '') {
|
||||||
$zwdmList[] = $item['CODE'];
|
$zwdmList[] = $item['CODE'];
|
||||||
}
|
}
|
||||||
|
if (!empty($item['children']) && is_array($item['children'])) {
|
||||||
|
$collectCodes($item['children']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if (is_array($treeData)) {
|
||||||
|
$collectCodes($treeData);
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($zwdmList)) {
|
if (empty($zwdmList)) {
|
||||||
return json([
|
return json([
|
||||||
|
|||||||
Reference in New Issue
Block a user