You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
549 B
42 lines
549 B
package role
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"product/backend/handlers/base"
|
|
"product/backend/models"
|
|
)
|
|
|
|
// 请求结构体
|
|
type WithParam struct {
|
|
}
|
|
|
|
type PostReq struct {
|
|
models.Role
|
|
WithParam
|
|
}
|
|
|
|
type PutReq struct {
|
|
ID uint `json:"id" binding:"required"`
|
|
models.Role
|
|
WithParam
|
|
}
|
|
|
|
type GetReq struct {
|
|
base.GetReq
|
|
WithParam
|
|
}
|
|
|
|
func (getReq *GetReq) BindAndInit(ctx *gin.Context) error {
|
|
if err := ctx.ShouldBindQuery(&getReq); err != nil {
|
|
return err
|
|
}
|
|
|
|
getReq.GetReq.Init()
|
|
|
|
return nil
|
|
}
|
|
|
|
type DelReq struct {
|
|
base.DelReq
|
|
}
|