feat(base): 添加邮箱注册码功能及用户注册接口 - 在 `sessionManager` 中新增邮件注册码缓存管理实例和相关方法 - 实现生成、保存、验证、删除邮件注册码的逻辑 - 新增 `/reg` 和 `/email` 接口用于用户注册和发送验证码 - 引入 `golang-lru` 依赖以支持限流缓存功能 - 调整包导入顺序,优化代码结构 ```
37 lines
1.3 KiB
Go
37 lines
1.3 KiB
Go
package v1
|
|
|
|
import "github.com/gogf/gf/v2/frame/g"
|
|
|
|
// login 接口请求
|
|
type BaseOpenLoginReq struct {
|
|
g.Meta `path:"/login" method:"POST"`
|
|
Username string `json:"username" p:"username" v:"required"`
|
|
Password string `json:"password" p:"password" v:"required"`
|
|
CaptchaId string `json:"captchaId" p:"captchaId" v:"required"`
|
|
VerifyCode string `json:"verifyCode" p:"verifyCode" v:"required"`
|
|
}
|
|
type BaseOpenRegReq struct {
|
|
g.Meta `path:"/reg" method:"POST"`
|
|
Username string `json:"username" p:"username" v:"required"`
|
|
Password string `json:"password" p:"password" v:"required"`
|
|
//CaptchaId string `json:"captchaId" p:"captchaId" v:"required"`
|
|
//VerifyCode string `json:"verifyCode" p:"verifyCode" v:"required"`
|
|
}
|
|
|
|
type BaseOpenEmailReq struct {
|
|
g.Meta `path:"/email" method:"POST"`
|
|
Email string `json:"email" p:"email" v:"required"`
|
|
//Username string `json:"username" p:"username" v:"required"`
|
|
// Password string `json:"password" p:"password" v:"required"`
|
|
//CaptchaId string `json:"captchaId" p:"captchaId" v:"required"`
|
|
//VerifyCode string `json:"verifyCode" p:"verifyCode" v:"required"`
|
|
}
|
|
|
|
// captcha 验证码接口
|
|
|
|
type BaseOpenCaptchaReq struct {
|
|
g.Meta `path:"/captcha" method:"GET"`
|
|
Height int `json:"height" in:"query" default:"40"`
|
|
Width int `json:"width" in:"query" default:"150"`
|
|
}
|