正在显示
1 个修改的文件
包含
8 行增加
和
0 行删除
@@ -47,11 +47,14 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe | @@ -47,11 +47,14 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe | ||
47 | log.Error(err) | 47 | log.Error(err) |
48 | return | 48 | return |
49 | } | 49 | } |
50 | + //TODO:跟用户中心交换数据 | ||
50 | if _, err = repository.User.GetUsersByMobile(request.Phone); err == nil { | 51 | if _, err = repository.User.GetUsersByMobile(request.Phone); err == nil { |
51 | err = protocol.NewErrWithMessage(2029) | 52 | err = protocol.NewErrWithMessage(2029) |
53 | + return | ||
52 | } | 54 | } |
53 | if !result { | 55 | if !result { |
54 | err = protocol.NewErrWithMessage(1012) | 56 | err = protocol.NewErrWithMessage(1012) |
57 | + return | ||
55 | } | 58 | } |
56 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Phone": request.Phone}) | 59 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Phone": request.Phone}) |
57 | return | 60 | return |
@@ -70,9 +73,11 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo | @@ -70,9 +73,11 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo | ||
70 | //TODO:未验证 校验码 | 73 | //TODO:未验证 校验码 |
71 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { | 74 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { |
72 | err = protocol.NewErrWithMessage(2026) | 75 | err = protocol.NewErrWithMessage(2026) |
76 | + return | ||
73 | } | 77 | } |
74 | if len(request.NewPwd) < 6 { | 78 | if len(request.NewPwd) < 6 { |
75 | err = protocol.NewErrWithMessage(2027) | 79 | err = protocol.NewErrWithMessage(2027) |
80 | + return | ||
76 | } | 81 | } |
77 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd}) | 82 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd}) |
78 | return | 83 | return |
@@ -86,9 +91,11 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | @@ -86,9 +91,11 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | ||
86 | //rsp =&protocol.ChangePasswordResponse{} | 91 | //rsp =&protocol.ChangePasswordResponse{} |
87 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { | 92 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { |
88 | err = protocol.NewErrWithMessage(2026) | 93 | err = protocol.NewErrWithMessage(2026) |
94 | + return | ||
89 | } | 95 | } |
90 | if len(request.NewPwd) < 6 { | 96 | if len(request.NewPwd) < 6 { |
91 | err = protocol.NewErrWithMessage(2027) | 97 | err = protocol.NewErrWithMessage(2027) |
98 | + return | ||
92 | } | 99 | } |
93 | if user, err = repository.User.GetUsersById(header.Uid); err != nil { | 100 | if user, err = repository.User.GetUsersById(header.Uid); err != nil { |
94 | log.Error(err) | 101 | log.Error(err) |
@@ -96,6 +103,7 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | @@ -96,6 +103,7 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | ||
96 | } | 103 | } |
97 | if !strings.EqualFold(request.OldPwd, user.Passwd) { | 104 | if !strings.EqualFold(request.OldPwd, user.Passwd) { |
98 | err = protocol.NewErrWithMessage(2028) | 105 | err = protocol.NewErrWithMessage(2028) |
106 | + return | ||
99 | } | 107 | } |
100 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd}) | 108 | err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd}) |
101 | return | 109 | return |
-
请 注册 或 登录 后发表评论