用户修改头像、昵称、绑定手机号、获取用户详细信息

This commit is contained in:
chy
2025-06-06 15:48:05 +08:00
parent 01b898163a
commit e40f9987db
12 changed files with 280 additions and 19 deletions

View File

@ -12,4 +12,8 @@ import (
type IUserV1 interface {
List(ctx context.Context, req *v1.ListReq) (res *v1.ListRes, err error)
Info(ctx context.Context, req *v1.InfoReq) (res *v1.InfoRes, err error)
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
BindPhone(ctx context.Context, req *v1.BindPhoneReq) (res *v1.BindPhoneRes, err error)
GetPhoneCode(ctx context.Context, req *v1.GetPhoneCodeReq) (res *v1.GetPhoneCodeRes, err error)
}

View File

@ -11,3 +11,50 @@ type ListRes struct {
List interface{} `json:"list"`
Total int `json:"total"`
}
type InfoReq struct {
g.Meta `path:"/user/info" method:"get" tags:"User" summary:"获取用户信息"`
OpenId string `json:"openId" v:"required#OpenId不能为空" dc:"OpenId"`
}
type InfoRes struct {
Id int `json:"id"`
WxOpenId string `json:"wxOpenId"`
Username string `json:"username"`
Nickname string `json:"nickname"`
Avatar string `json:"avatar"`
Email string `json:"email"`
PhoneNumber string `json:"phoneNumber"`
WxPopenId string `json:"wxPopenId"`
QQPopenId string `json:"qqPopenId"`
RoleId int `json:"roleId"`
}
type UpdateReq struct {
g.Meta `path:"/user" method:"put" tags:"User" summary:"更新用户头像,昵称"`
Avatar string `json:"avatar" v:"required#头像不能为空" dc:"头像"`
Nickname string `json:"nickname" v:"required#昵称不能为空" dc:"昵称"`
}
type UpdateRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type BindPhoneReq struct {
g.Meta `path:"/user/bindPhone" method:"post" tags:"User" summary:"绑定手机号"`
Phone string `json:"phone" v:"required#手机号不能为空" dc:"手机号"`
Code string `json:"code" v:"required#验证码不能为空" dc:"验证码"`
}
type BindPhoneRes struct {
Success bool `json:"success" dc:"是否成功"`
}
type GetPhoneCodeReq struct {
g.Meta `path:"/user/getPhoneCode" method:"post" tags:"User" summary:"获取手机验证码"`
Phone string `json:"phone" v:"required#手机号不能为空" dc:"手机号"`
}
type GetPhoneCodeRes struct {
Success bool `json:"success" dc:"是否成功"`
}