MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / UpdateMenu

Method UpdateMenu

internal/api/menu.go:89–117  ·  view source on GitHub ↗

UpdateMenu 更新菜单

(c *gin.Context)

Source from the content-addressed store, hash-verified

87
88// UpdateMenu 更新菜单
89func (m *MenuHandler) UpdateMenu(c *gin.Context) {
90 var req req.UpdateMenuRequest
91 if err := c.ShouldBindJSON(&req); err != nil {
92 m.l.Error("绑定请求参数失败", zap.Error(err))
93 apiresponse.Error(c)
94 return
95 }
96
97 // 构建更新的菜单对象
98 menu := &domain.Menu{
99 ID: req.Id,
100 Name: req.Name,
101 Path: req.Path,
102 Component: req.Component,
103 SortOrder: req.SortOrder,
104 ParentID: req.ParentId,
105 Icon: req.Icon,
106 Hidden: req.Hidden,
107 RouteName: req.RouteName,
108 }
109
110 if err := m.svc.UpdateMenu(c.Request.Context(), menu); err != nil {
111 m.l.Error("更新菜单失败", zap.Error(err))
112 apiresponse.Error(c)
113 return
114 }
115
116 apiresponse.Success(c)
117}
118
119// DeleteMenu 删除菜单
120func (m *MenuHandler) DeleteMenu(c *gin.Context) {

Callers

nothing calls this directly

Calls 3

ErrorFunction · 0.92
SuccessFunction · 0.92
UpdateMenuMethod · 0.65

Tested by

no test coverage detected