chore: rename bind username api

This commit is contained in:
RockYang 2024-01-05 18:21:47 +08:00
parent 069ad6a09a
commit b1ee34ba0c
2 changed files with 5 additions and 5 deletions

View File

@ -379,8 +379,8 @@ func (h *UserHandler) ResetPass(c *gin.Context) {
}
}
// BindMobile 绑定手机
func (h *UserHandler) BindMobile(c *gin.Context) {
// BindUsername 重置账
func (h *UserHandler) BindUsername(c *gin.Context) {
var data struct {
Username string `json:"username"`
Code string `json:"code"`
@ -394,7 +394,7 @@ func (h *UserHandler) BindMobile(c *gin.Context) {
key := CodeStorePrefix + data.Username
code, err := h.redis.Get(c, key).Result()
if err != nil || code != data.Code {
resp.ERROR(c, "短信验证码错误")
resp.ERROR(c, "验证码错误")
return
}
@ -402,7 +402,7 @@ func (h *UserHandler) BindMobile(c *gin.Context) {
var item model.User
res := h.db.Where("username = ?", data.Username).First(&item)
if res.Error == nil {
resp.ERROR(c, "该手机号已经被其他账号绑定")
resp.ERROR(c, "该号已经被其他账号绑定")
return
}

View File

@ -195,7 +195,7 @@ func main() {
group.GET("profile", h.Profile)
group.POST("profile/update", h.ProfileUpdate)
group.POST("password", h.UpdatePass)
group.POST("bind/mobile", h.BindMobile)
group.POST("bind/username", h.BindUsername)
group.POST("resetPass", h.ResetPass)
}),
fx.Invoke(func(s *core.AppServer, h *chatimpl.ChatHandler) {