Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangePassword ¶
ChangePassword godoc @tags user @summary 修改密码 @description 通过旧密码修改密码 @security ApiKeyAuth @accept json @produce json @param RequestBody body ChangePasswordReqBody true "Request Body" @router /user/{username}/password [put]
func Deactivate ¶
Deactivate godoc @tags user @summary 用户注销 @description 用户自行注销帐号 @security ApiKeyAuth @accept json @produce json @router /user/{username}/status [put]
func SignIn ¶
SignIn godoc @tags user @summary 获取 JSON Web Token @description 由用户输入帐号(手机号)和密码,验证后返回一个有效期为 3 小时的 JSON Web Token @accept json @produce json @param RequestBody body SignInReqBody true "Request Body" @router /users/token [post]
func SignUp ¶
SignUp godoc @tags user @summary 用户注册 @description 用户须输入真实姓名、密码、手机号码、年龄、性别、住址,返回新创建的用户的基本资料 @accept json @produce json @param RequestBody body SignUpReqBody true "Request Body" @router /users [post]
func UpdateProfile ¶
UpdateProfile godoc @tags user @summary 修改个人基本资料 @description 只能修改年龄和地址 @security ApiKeyAuth @accept json @produce json @param RequestBody body UpdateProfileReqBody true "Request Body" @router /user/{username}/profile [put]
Types ¶
type ChangePasswordReqBody ¶
type SignInReqBody ¶
type SignInReqBody struct { // Username 手机号,长度必须为 11 Username string `json:"username" binding:"required,len=11"` Password string `json:"password" binding:"required"` }
SignInReqBody 接收登录请求数据
type SignUpReqBody ¶
type SignUpReqBody struct { RealName string `json:"real_name" binding:"required,min=1,max=20"` Password string `json:"password" binding:"required"` PhoneNumber string `json:"phone_number" binding:"required,len=11"` Age uint8 `json:"age" binding:"required,min=0,max=255"` // Gender 1:男,0:女 Gender uint8 `json:"gender" binding:"oneof=0 1"` Address string `json:"address" binding:"required,min=1,max=100"` }
func (SignUpReqBody) CreateUser ¶
func (b SignUpReqBody) CreateUser(passwordHash []byte) user.User