go-wxhelper/api/admin/role/role.go

28 lines
597 B
Go
Raw Normal View History

2024-01-19 12:06:30 +08:00
package role
import (
"github.com/gin-gonic/gin"
roleParam "wechat-robot/model/param/role"
"wechat-robot/pkg/response"
roleService "wechat-robot/service/role"
)
// GetAll
// @description: 获取所有角色
// @param ctx
func GetAll(ctx *gin.Context) {
var p roleParam.GetAll
if err := ctx.ShouldBind(&p); err != nil {
response.New(ctx).SetMsg("参数错误").SetError(err).Fail()
return
}
records, err := roleService.GetAll(p)
if err != nil {
response.New(ctx).SetMsg("获取所有角色失败").SetError(err).Fail()
return
}
response.New(ctx).SetData(records).Success()
}