mirror of
https://gitee.com/blackfox/geekai.git
synced 2024-12-04 05:09:12 +08:00
chore: rename bind username api
This commit is contained in:
parent
069ad6a09a
commit
b1ee34ba0c
@ -379,8 +379,8 @@ func (h *UserHandler) ResetPass(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// BindMobile 绑定手机号
|
// BindUsername 重置账号
|
||||||
func (h *UserHandler) BindMobile(c *gin.Context) {
|
func (h *UserHandler) BindUsername(c *gin.Context) {
|
||||||
var data struct {
|
var data struct {
|
||||||
Username string `json:"username"`
|
Username string `json:"username"`
|
||||||
Code string `json:"code"`
|
Code string `json:"code"`
|
||||||
@ -394,7 +394,7 @@ func (h *UserHandler) BindMobile(c *gin.Context) {
|
|||||||
key := CodeStorePrefix + data.Username
|
key := CodeStorePrefix + data.Username
|
||||||
code, err := h.redis.Get(c, key).Result()
|
code, err := h.redis.Get(c, key).Result()
|
||||||
if err != nil || code != data.Code {
|
if err != nil || code != data.Code {
|
||||||
resp.ERROR(c, "短信验证码错误")
|
resp.ERROR(c, "验证码错误")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -402,7 +402,7 @@ func (h *UserHandler) BindMobile(c *gin.Context) {
|
|||||||
var item model.User
|
var item model.User
|
||||||
res := h.db.Where("username = ?", data.Username).First(&item)
|
res := h.db.Where("username = ?", data.Username).First(&item)
|
||||||
if res.Error == nil {
|
if res.Error == nil {
|
||||||
resp.ERROR(c, "该手机号已经被其他账号绑定")
|
resp.ERROR(c, "该账号已经被其他账号绑定")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,7 +195,7 @@ func main() {
|
|||||||
group.GET("profile", h.Profile)
|
group.GET("profile", h.Profile)
|
||||||
group.POST("profile/update", h.ProfileUpdate)
|
group.POST("profile/update", h.ProfileUpdate)
|
||||||
group.POST("password", h.UpdatePass)
|
group.POST("password", h.UpdatePass)
|
||||||
group.POST("bind/mobile", h.BindMobile)
|
group.POST("bind/username", h.BindUsername)
|
||||||
group.POST("resetPass", h.ResetPass)
|
group.POST("resetPass", h.ResetPass)
|
||||||
}),
|
}),
|
||||||
fx.Invoke(func(s *core.AppServer, h *chatimpl.ChatHandler) {
|
fx.Invoke(func(s *core.AppServer, h *chatimpl.ChatHandler) {
|
||||||
|
Loading…
Reference in New Issue
Block a user