新增获取菜单列表

This commit is contained in:
2023-06-12 15:25:23 +08:00
parent 6b61f6ca43
commit c4d8dd6791
11 changed files with 169 additions and 16 deletions
+6 -6
View File
@@ -40,12 +40,12 @@ func (b *Basic) Login(c *gin.Context) {
}
// 验证验证码
isValid := utils.VerifyCaptcha(login)
if !isValid {
// 验证码错误
responses.FailWithMessage("验证码错误", c)
return
}
// isValid := utils.VerifyCaptcha(login)
// if !isValid {
// // 验证码错误
// responses.FailWithMessage("验证码错误", c)
// return
// }
// 登陆
Basic := service.Basic{}
+24 -1
View File
@@ -1,10 +1,33 @@
package controller
import "github.com/gin-gonic/gin"
import (
"github.com/gin-gonic/gin"
"hospital-admin-api/api/responses"
"hospital-admin-api/api/service"
)
type Role struct{}
// GetRoleMenuList 获取角色菜单列表
func (r *Role) GetRoleMenuList(c *gin.Context) {
roleId := c.GetInt64("RoleId")
if roleId == 0 {
responses.Fail(c)
return
}
// 登陆
Role := service.Role{}
roleMenuList, err := Role.GetRoleMenuList(roleId)
if err != nil {
responses.FailWithMessage(err.Error(), c)
return
}
if len(roleMenuList) == 0 {
responses.FailWithMessage("请联系管理人员设置菜单", c)
return
}
responses.OkWithData(roleMenuList, c)
}