更新 'app/common/model/Category.php'

update
wysf
liuqing 9 months ago
parent 7d91da0207
commit 6b6d11e579
  1. 11
      app/common/model/Category.php

@ -69,6 +69,17 @@ class Category extends BaseModel
return $this->getTreeData($list); return $this->getTreeData($list);
} }
public function getChildrenList(array $param = []): array
{
$list = $this->getAll($param)->toArray();
foreach ($list as &$item) {
$item['children'] = $this->getAll(
[ 'category_id' =>$item['category_id']],
)->toArray();
}
return $list;
}
/** /**
* 获取所有记录 * 获取所有记录
* @param array $param * @param array $param

Loading…
Cancel
Save