liujiandao
2024-03-30 1e65185f0ecb8d4f8f1fd9ea822137e0c841a47f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package v1
 
import (
    "aps_crm/model/response"
    "aps_crm/pkg/contextx"
    "aps_crm/pkg/ecode"
    "github.com/gin-gonic/gin"
)
 
type MenuApi struct{}
 
// List
//
//    @Tags        Menu
//    @Summary    获取菜单树
//    @Security    ApiKeyAuth
//    @param        Authorization    header    string    true    "Authorization"
//    @Produce    application/json
//    @Success    200    {object}    contextx.Response{data=response.MenuTreeResponse}
//    @Router        /api/menu/getMenu [get]
func (m *MenuApi) List(c *gin.Context) {
    ctx, ok := contextx.NewContext(c, nil)
    if !ok {
        return
    }
 
    list, errCode := menuService.GetMenuTree()
    if errCode != ecode.OK {
        ctx.Fail(errCode)
        return
    }
 
    ctx.OkWithDetailed(response.MenuTreeResponse{
        List: list,
    })
}