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.
53 lines
1008 B
53 lines
1008 B
4 months ago
|
package user
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
"product/backend/handlers/base"
|
||
|
"product/backend/models"
|
||
|
)
|
||
|
|
||
|
type PostReq struct {
|
||
|
models.User
|
||
|
Password string `json:"password"`
|
||
|
PasswordSalt string `json:"passwordSalt"`
|
||
|
PasswordAgain string `json:"passwordAgain"`
|
||
|
}
|
||
|
|
||
|
type PutReq struct {
|
||
|
ID uint `json:"id" binding:"required"`
|
||
|
Password string `json:"password"`
|
||
|
PasswordSalt string `json:"passwordSalt"`
|
||
|
models.User
|
||
|
}
|
||
|
|
||
|
type GetReq struct {
|
||
|
base.GetReq
|
||
|
//
|
||
|
}
|
||
|
|
||
|
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
|
||
|
}
|
||
|
|
||
|
type LoginReq struct {
|
||
|
Password string `json:"password"`
|
||
|
Name string `json:"name"`
|
||
|
}
|
||
|
|
||
|
type ChangePasswordReq struct {
|
||
|
UserID uint `json:"userID"`
|
||
|
OldPassword string `json:"oldPassword"`
|
||
|
NewPassword string `json:"newPassword"`
|
||
|
NewPasswordAgain string `json:"newPasswordAgain"`
|
||
|
}
|