user.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package models
  2. //User 用户数据映射模型
  3. type User struct {
  4. Password string `gorm:"password"`
  5. UserName string `gorm:"user_name"`
  6. Role *uint8 `gorm:"role" `
  7. Id string `gorm:"id"`
  8. }
  9. type UserRegister struct {
  10. Id string `json:"id"`
  11. UserName string `json:"userName" binding:"required"`
  12. Password string `json:"password" binding:"required"`
  13. Role *uint8 `json:"role" binding:"required,gte=0" `
  14. }
  15. type UserLogin struct {
  16. Username string `json:"username" binding:"required"`
  17. Password string `json:"password" binding:"required"`
  18. Role *uint8 `json:"role" binding:"required,gte=0"`
  19. }
  20. type ResetPassword struct {
  21. Username string `json:"username" binding:"required"`
  22. UsernameInit string `json:"usernameInit" binding:"required"`
  23. }
  24. type UserListParam struct {
  25. PageNum int `json:"pageNum" binding:"required,gt=0"`
  26. PageSize int `json:"pageSize" binding:"required,gt=1"`
  27. UserName string `json:"userName"`
  28. Role *uint8 `json:"role" binding:"required,gte=0"`
  29. }
  30. type ChangePassword struct {
  31. UserName string `json:"userName" binding:"required"`
  32. Password string `json:"password" binding:"required"`
  33. NewPassword string `json:"newPassword" binding:"required"`
  34. }