package models import "gorm.io/gorm" //User 用户数据映射模型 type User struct { gorm.Model Password string `gorm:"password type:varchar(50) not null comment '密码'" ` UserName string `gorm:"user_name"` Phone string `gorm:"phone"` Role *uint8 `gorm:"role" ` Gender string `gorm:"gender type:varchar(2) comment '性别:1男 0女'"` Age string `gorm:"age type:varchar(10) comment '年龄'"` Height string `gorm:"height type:varchar(10) comment '身高:cm'"` Weight string `gorm:"weight type:varchar(10) comment '体重'"` } type UserRegister struct { Phone string `json:"phone" binding:"required"` UserName string `json:"userName" binding:"required"` Password string `json:"password" binding:"required"` Role *uint8 `json:"role" binding:"required,gte=0" ` } type UserLogin struct { Phone string `json:"phone" binding:"required"` Password string `json:"password" binding:"required"` Role *uint8 `json:"role" binding:"required,gte=0"` } type ResetPassword struct { Phone string `json:"phone" binding:"required"` PhoneInit string `json:"phoneInit" binding:"required"` } type UserListParam struct { PageNum int `json:"pageNum" binding:"required,gt=0"` PageSize int `json:"pageSize" binding:"required,gt=1"` UserName string `json:"userName"` Role *uint8 `json:"role" binding:"required,gte=0"` } type ChangePassword struct { Phone string `json:"phone" binding:"required"` Password string `json:"password" binding:"required"` NewPassword string `json:"newPassword" binding:"required"` } type WriteData struct { UserName string `json:"userName" binding:"required"` Gender int64 `json:"gender"` Height int64 `json:"height"` Weight int64 `json:"weight"` Age int64 `json:"age"` Mac string `json:"mac" binding:"required"` }