更新:商家类型接口支持指定父级下的子分类
parent
35fe05805b
commit
90bdbe573f
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue