|
@@ -10,7 +10,7 @@ use think\response\Json;
|
|
|
class MenuLogic extends BaseLogic
|
|
|
{
|
|
|
|
|
|
- //获取菜单列表
|
|
|
+ //获取用户菜单列表
|
|
|
public static function List(): Json
|
|
|
{
|
|
|
//menu_action是一个视图
|
|
@@ -45,6 +45,25 @@ class MenuLogic extends BaseLogic
|
|
|
|
|
|
}
|
|
|
|
|
|
+ //获取全部菜单
|
|
|
+ public static function All(): Json
|
|
|
+ {
|
|
|
+ $list = AdminMenuModel::field('id,menu_name,menu_img,menu_route,status')
|
|
|
+ ->where('pid', 0)
|
|
|
+ ->append(['child'])
|
|
|
+ ->withAttr('child', function ($val, $data) {
|
|
|
+ return AdminMenuModel::field('id,menu_name,menu_img,menu_route,status')
|
|
|
+ ->where('pid', $data['id'])
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+ })
|
|
|
+ ->select()
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
+ return json_show(CommonModel::$success, '获取成功', $list);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
//添加菜单
|
|
|
public static function Add(array $data = []): Json
|
|
|
{
|