作者 lyh

gx

@@ -16,7 +16,7 @@ use App\Models\CustomModule\CustomModuleCategory; @@ -16,7 +16,7 @@ use App\Models\CustomModule\CustomModuleCategory;
16 class CustomModuleCategoryController extends BaseController 16 class CustomModuleCategoryController extends BaseController
17 { 17 {
18 /** 18 /**
19 - * @remark :获取自定义模块列表 19 + * @remark :获取自定义模块分类列表
20 * @name :ModuleList 20 * @name :ModuleList
21 * @author :lyh 21 * @author :lyh
22 * @method :post 22 * @method :post
@@ -30,8 +30,34 @@ class CustomModuleCategoryController extends BaseController @@ -30,8 +30,34 @@ class CustomModuleCategoryController extends BaseController
30 ]); 30 ]);
31 $this->map['project_id'] = $this->user['project_id']; 31 $this->map['project_id'] = $this->user['project_id'];
32 $this->map['status'] = 0; 32 $this->map['status'] = 0;
33 - $lists = $customModuleCategory->lists($this->map,$this->page,$this->row,$this->order);  
34 - $this->response('success',Code::SUCCESS,$lists); 33 + $list = $customModuleCategory->list($this->map);
  34 + if(!empty($list)){
  35 + foreach ($list as $k => $v){
  36 + $v['url'] = $this->user['domain'].$v['route'];
  37 + $list[$k] = $v;
  38 + }
  39 + }
  40 + $data = $this->getListSon($list);
  41 + $this->response('success',Code::SUCCESS,$data);
  42 + }
  43 +
  44 + /**
  45 + * @remark :无分页子集处理
  46 + * @name :getListSon
  47 + * @author :lyh
  48 + * @method :post
  49 + * @time :2023/8/17 11:12
  50 + */
  51 + public function getListSon($list){
  52 + $data = array();
  53 + foreach ($list as $v){
  54 + $v = (array)$v;
  55 + if ($v['pid'] == 0) {
  56 + $v['sub'] = _get_child($v['id'], $list);
  57 + $data[] = $v;
  58 + }
  59 + }
  60 + return $data;
35 } 61 }
36 62
37 /** 63 /**