user.go 1.2 KB

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