62 lines
2.1 KiB
Go
62 lines
2.1 KiB
Go
package controllers
|
|
|
|
import (
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
|
"git.rosy.net.cn/jx-callback/business/model"
|
|
"github.com/astaxie/beego"
|
|
)
|
|
|
|
type PowerController struct {
|
|
beego.Controller
|
|
}
|
|
|
|
// @Title 添加功能(菜单)
|
|
// @Description 添加功能(菜单)
|
|
// @Param token header string true "认证token"
|
|
// @Param payload formData string true "Menu json实体"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /AddMenu [post]
|
|
func (c *PowerController) AddMenu() {
|
|
c.callAddMenu(func(params *tPowerAddMenuParams) (retVal interface{}, errCode string, err error) {
|
|
menu := &model.Menu{}
|
|
if err = utils.UnmarshalUseNumber([]byte(params.Payload), menu); err == nil {
|
|
err = cms.AddMenu(params.Ctx, menu)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 查询功能(菜单)
|
|
// @Description 查询功能(菜单)
|
|
// @Param token header string true "认证token"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /GetMenu [post]
|
|
func (c *PowerController) GetMenu() {
|
|
c.callGetMenu(func(params *tPowerGetMenuParams) (retVal interface{}, errCode string, err error) {
|
|
retVal, err = cms.GetMenu(params.Ctx)
|
|
return retVal, "", err
|
|
})
|
|
}
|
|
|
|
// @Title 修改功能(菜单)
|
|
// @Description 修改功能(菜单)
|
|
// @Param token header string true "认证token"
|
|
// @Param payload formData string true "Menu json实体"
|
|
// @Param menuID formData int true "菜单ID"
|
|
// @Param isDelete formData bool true "是否是删除"
|
|
// @Success 200 {object} controllers.CallResult
|
|
// @Failure 200 {object} controllers.CallResult
|
|
// @router /UpdateMenu [put]
|
|
func (c *PowerController) UpdateMenu() {
|
|
c.callUpdateMenu(func(params *tPowerUpdateMenuParams) (retVal interface{}, errCode string, err error) {
|
|
payload := make(map[string]interface{})
|
|
if err = utils.UnmarshalUseNumber([]byte(params.Payload), payload); err == nil {
|
|
retVal, err = cms.UpdateMenu(params.Ctx, params.MenuID, payload, params.IsDelete)
|
|
}
|
|
return retVal, "", err
|
|
})
|
|
}
|