28 lines
597 B
Go
28 lines
597 B
Go
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()
|
|
}
|