用户juese

This commit is contained in:
苏尹岚
2020-09-27 17:21:03 +08:00
parent 9ba9d8e807
commit e9d391ea98
3 changed files with 65 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ 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/jxutils"
"git.rosy.net.cn/jx-callback/business/model"
"github.com/astaxie/beego"
)
@@ -102,3 +103,38 @@ func (c *PowerController) UpdateRole() {
return retVal, "", err
})
}
// @Title 查询用户角色
// @Description查询用户角色
// @Param token header string true "认证token"
// @Param userID formData string false "用户ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /GetUserRole [put]
func (c *PowerController) GetUserRole() {
c.callGetUserRole(func(params *tPowerGetUserRoleParams) (retVal interface{}, errCode string, err error) {
retVal, err = cms.GetUserRole(params.Ctx, params.UserID)
return retVal, "", err
})
}
// @Title 修改用户角色
// @Description 修改用户角色
// @Param token header string true "认证token"
// @Param userIDs formData string true "用户IDs"
// @Param roleIDs formData string true "角色IDs"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /UpdateUserRole [put]
func (c *PowerController) UpdateUserRole() {
c.callUpdateUserRole(func(params *tPowerUpdateUserRoleParams) (retVal interface{}, errCode string, err error) {
var (
userIDs []string
roleIDs []int
)
if err = jxutils.Strings2Objs(params.UserIDs, &userIDs, params.RoleIDs, roleIDs); err == nil {
err = cms.UpdateUserRole(params.Ctx, userIDs, roleIDs)
}
return retVal, "", err
})
}