feat(user): 实现基础用户系统

- 实现用户手机验证码、密码登录功能,支持 JWT 认证
- 实现用户注册功能
- 实现jwt中获取用户信息
This commit is contained in:
2024-11-03 19:06:09 +08:00
parent cca66faed5
commit d09e7a08cf
23 changed files with 168 additions and 246 deletions

View File

@@ -8,14 +8,16 @@ info (
)
type User {
Id int64 `json:"id"`
Mobile string `json:"mobile"`
Id int64 `json:"id"`
Mobile string `json:"mobile"`
NickName string `json:"nickName"`
}
type (
RegisterReq {
Mobile string `json:"mobile" validate:"required,mobile"`
Password string `json:"password" validate:"required"`
Password string `json:"password" validate:"required,min=11,max=11,password"`
Code string `json:"code" validate:"required"`
}
RegisterResp {
AccessToken string `json:"accessToken"`
@@ -25,11 +27,23 @@ type (
)
type (
LoginReq {
Mobile string `json:"mobile"`
Password string `json:"password"`
MobileLoginReq {
Mobile string `json:"mobile" validate:"required,mobile"`
Password string `json:"password" validate:"required"`
}
LoginResp {
MobileLoginResp {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`
}
)
type (
MobileCodeLoginReq {
Mobile string `json:"mobile"`
Code string `json:"code" validate:"required"`
}
MobileCodeLoginResp {
AccessToken string `json:"accessToken"`
AccessExpire int64 `json:"accessExpire"`
RefreshAfter int64 `json:"refreshAfter"`