更新:商家类型接口支持指定父级下的子分类

master
zwesy 2021-11-29 16:43:47 +08:00
parent 35fe05805b
commit 90bdbe573f
1 changed files with 10 additions and 4 deletions

View File

@ -95,13 +95,19 @@ class Dictionary extends Base
public function getBusinessTypeList(): Json public function getBusinessTypeList(): Json
{ {
$recursionChildren = $this->request->param('recursion/d', 0); $recursionChildren = $this->request->param('recursion/d', 0);
$pid = $this->request->param('pid/d', 0);
$repo = DictionaryRepository::getInstance(); $whereMap = [];
$items = $repo->getBusinessTypeList([], [], null, ['pid'=>'asc']); if ($pid > 0) {
$whereMap[] = ['pid', '=', $pid];
}
$list = $items->toArray(); $repo = DictionaryRepository::getInstance();
$items = $repo->getBusinessTypeList($whereMap, [], null, ['pid'=>'asc']);
$list = $items->toArray();
if ($recursionChildren > 0) { if ($recursionChildren > 0) {
$list = $repo->recursionChildrenList($list, 0, 'pid', 'id'); $list = $repo->recursionChildrenList($list, $pid, 'pid', 'id');
} }
return $this->json(0, 'success', $list); return $this->json(0, 'success', $list);