2024-01-19 12:06:30 +08:00
|
|
|
package role
|
2024-02-05 17:28:46 +08:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|