🎨 完善用户相关接口
This commit is contained in:
@@ -3,49 +3,64 @@ package request
|
||||
import "git.echol.cn/loser/lckt/model/common/request"
|
||||
|
||||
type SendCodeReq struct {
|
||||
Phone string `json:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
}
|
||||
|
||||
type CodeLoginReq struct {
|
||||
Phone string `json:"phone" vd:"@:len($)>0; msg:'请输入手机号码'"`
|
||||
Code string `json:"code" vd:"@:len($)>0; msg:'请输入短信验证码'"`
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'请输入手机号码'"`
|
||||
Code string `json:"code" form:"code" vd:"@:len($)>0; msg:'请输入短信验证码'"`
|
||||
}
|
||||
|
||||
type InviteLoginReq struct {
|
||||
Phone string `json:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Code string `json:"code" vd:"@:len($)>0; msg:'验证码不能为空'"`
|
||||
Type string `json:"type" vd:"@:len($)>0; msg:'邀请类型不能为空'"`
|
||||
Token string `json:"token" vd:"@:len($)>0; msg:'token不能为空'"`
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Code string `json:"code" form:"code" vd:"@:len($)>0; msg:'验证码不能为空'"`
|
||||
Type string `json:"type" form:"type" vd:"@:len($)>0; msg:'邀请类型不能为空'"`
|
||||
Token string `json:"token" form:"token" vd:"@:len($)>0; msg:'token不能为空'"`
|
||||
}
|
||||
|
||||
type WxLoginReq struct {
|
||||
OpenId string `json:"openId" binding:"required"`
|
||||
NickName string `json:"nickName"`
|
||||
Gender int `json:"gender"`
|
||||
UnionId string `json:"unionId" binding:"required"`
|
||||
AvatarUrl string `json:"avatarUrl"`
|
||||
Province string `json:"province"`
|
||||
City string `json:"city"`
|
||||
OpenId string `json:"openId" form:"openId" binding:"required"`
|
||||
NickName string `json:"nickName" form:"nickName"`
|
||||
Gender int `json:"gender" form:"gender"`
|
||||
UnionId string `json:"unionId" form:"unionId" binding:"required"`
|
||||
AvatarUrl string `json:"avatarUrl" form:"avatarUrl"`
|
||||
Province string `json:"province" form:"province"`
|
||||
City string `json:"city" form:"city"`
|
||||
}
|
||||
|
||||
type BindWechatReq struct {
|
||||
Id int `json:"id" vd:"@:len($)>0; msg:'id不能为空'"`
|
||||
Openid string `json:"openid" vd:"@:len($)>0; msg:'OpenId不能为空'"`
|
||||
UnionId string `json:"unionId" gorm:"type:varchar(64);comment:用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的 unionid 是唯一的。"`
|
||||
Id int `json:"id" form:"id" vd:"@:len($)>0; msg:'id不能为空'"`
|
||||
Openid string `json:"openid" form:"openid" vd:"@:len($)>0; msg:'OpenId不能为空'"`
|
||||
UnionId string `json:"unionId" form:"unionId" gorm:"type:varchar(64);comment:用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的 unionid 是唯一的。"`
|
||||
}
|
||||
|
||||
type BindPhoneReq struct {
|
||||
Id int `json:"id" vd:"@:len($)>0; msg:'用户ID不能为空'"`
|
||||
Phone string `json:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Id int `json:"id" form:"id" vd:"@:len($)>0; msg:'用户ID不能为空'"`
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
}
|
||||
|
||||
type GetUserListReq struct {
|
||||
request.PageInfo
|
||||
Type int `json:"type"`
|
||||
UserLabel string `json:"user_label" `
|
||||
Type int `json:"type" form:"type"`
|
||||
UserLabel string `json:"user_label" form:"user_label" `
|
||||
Status int `json:"status" form:"status"`
|
||||
}
|
||||
|
||||
type SetBalanceReq struct {
|
||||
Id int `json:"id" vd:"@:len($)>0; msg:'用户ID不能为空'"`
|
||||
Balance float32 `json:"balance" vd:"@:len($)>0; msg:'余额不能为空'"`
|
||||
Id int `json:"id" form:"id" vd:"@:len($)>0; msg:'用户ID不能为空'"`
|
||||
Balance float32 `json:"balance" form:"balance" vd:"@:len($)>0; msg:'余额不能为空'"`
|
||||
}
|
||||
|
||||
type PwdLoginReq struct {
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Password string `json:"password" form:"password" vd:"@:len($)>0; msg:'密码不能为空'"`
|
||||
NickName string `json:"nick_name" form:"nick_name"`
|
||||
}
|
||||
|
||||
type RegisterReq struct {
|
||||
Phone string `json:"phone" form:"phone" vd:"@:len($)>0; msg:'手机号码不能为空'"`
|
||||
Password string `json:"password" form:"password" vd:"@:len($)>0; msg:'密码不能为空'"`
|
||||
NickName string `json:"nick_name" form:"nick_name"`
|
||||
UserType int8 `json:"user_type" form:"user_type" vd:"@:len($)>0; msg:'用户类型不能为空'"`
|
||||
UserLabel int64 `json:"user_label" form:"user_label" vd:"@:len($)>0; msg:'用户标签不能为空'"`
|
||||
}
|
||||
|
@@ -4,18 +4,21 @@ import "git.echol.cn/loser/lckt/global"
|
||||
|
||||
type User struct {
|
||||
global.GVA_MODEL
|
||||
NickName string `json:"nick_name" gorm:"comment:用户昵称"`
|
||||
Phone string `json:"phone" gorm:"comment:用户手机号"`
|
||||
UnionId string `json:"union_id" gorm:"type:varchar(255) comment '微信UnionId'"`
|
||||
NickName string `json:"nick_name" form:"nick_name" gorm:"comment:用户昵称"`
|
||||
Phone string `json:"phone" form:"phone" gorm:"comment:用户手机号"`
|
||||
UnionId string `json:"union_id" form:"union_id" gorm:"type:varchar(255) comment '微信UnionId'"`
|
||||
OpenId string `gorm:"column:open_id;default:'';comment:'openId'" json:"-"`
|
||||
Avatar string `json:"avatar" gorm:"comment:用户头像"`
|
||||
Status int8 `gorm:"column:status;default:1;NOT NULL;comment:'用户状态 0 封禁 1 正常'" json:"status"`
|
||||
Password string `json:"password" form:"password" gorm:"comment:用户密码"`
|
||||
Avatar string `json:"avatar" form:"avatar" gorm:"comment:用户头像"`
|
||||
Status int8 `gorm:"column:status;default:1;NOT NULL;comment:'用户状态 0 封禁 1 正常'" json:"status" form:"status"`
|
||||
//邀请码
|
||||
InviteCode *string `json:"invite_code" gorm:"type:varchar(255) comment '用户专属邀请码'"`
|
||||
Balance float32 `json:"balance" gorm:"type:decimal(10,2);comment:学员余额"`
|
||||
CommenderId int `json:"commender_id" gorm:"comment:推荐人ID"`
|
||||
UserLabel string `json:"user_label" gorm:"type:varchar(255) comment '用户标签 普通/VIP/SVIP'"`
|
||||
UserType int8 `gorm:"column:user_type;default:1;NOT NULL;comment:'用户类型 1 用户 2 讲师'" json:"user_type"`
|
||||
InviteCode *string `json:"invite_code" form:"invite_code" gorm:"type:varchar(255) comment '用户专属邀请码'"`
|
||||
Balance float32 `json:"balance" form:"balance" gorm:"type:decimal(10,2);comment:学员余额"`
|
||||
CommenderId int `json:"commender_id" form:"commender_id" gorm:"comment:推荐人ID"`
|
||||
UserLabel int64 `json:"user_label" form:"user_label" gorm:"comment:用户标签 1 普通用户 2 Vip 3 Svip"`
|
||||
UserType int8 `gorm:"column:user_type;default:1;NOT NULL;comment:'用户类型 1 用户 2 讲师'" json:"user_type" form:"user_type" `
|
||||
IsVip int8 `gorm:"column:is_vip;default:0;NOT NULL;comment:'是否是VIP 0 否 1 是'" json:"is_vip" form:"is_vip"`
|
||||
VipExpireTime string `json:"vip_expire_time" form:"vip_expire_time" gorm:"comment:VIP过期时间"`
|
||||
}
|
||||
|
||||
func (User) TableName() string {
|
||||
|
Reference in New Issue
Block a user