正在显示
1 个修改的文件
包含
42 行增加
和
32 行删除
@@ -136,8 +136,8 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo | @@ -136,8 +136,8 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo | ||
136 | //修改密码 | 136 | //修改密码 |
137 | func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePasswordRequest) (rsp *protocol.ChangePasswordResponse, err error) { | 137 | func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePasswordRequest) (rsp *protocol.ChangePasswordResponse, err error) { |
138 | var ( | 138 | var ( |
139 | - user *models.User | ||
140 | - loginResponse *protocol.UserCenterLoginResponse | 139 | + user *models.User |
140 | + //loginResponse *protocol.UserCenterLoginResponse | ||
141 | ) | 141 | ) |
142 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { | 142 | if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) { |
143 | err = protocol.NewErrWithMessage(2026) | 143 | err = protocol.NewErrWithMessage(2026) |
@@ -155,39 +155,49 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | @@ -155,39 +155,49 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass | ||
155 | log.Error(err) | 155 | log.Error(err) |
156 | return | 156 | return |
157 | } | 157 | } |
158 | - var message protocol.Message | ||
159 | - if _, err = agg.RequestUserCenter(protocol.MethodLogin, http.MethodPost, &protocol.UCenterLoginRequest{ | ||
160 | - PassWord: request.OldPwd, | ||
161 | - Phone: user.Phone, | ||
162 | - Type: 1, | ||
163 | - GrantType: protocol.LoginTypePassPord, | ||
164 | - }, &message); err != nil { | 158 | + err = agg.ChangeUcenterUserInfo(user.UserCenterId, user.Phone, &protocol.UCenterPutUserRequest{ |
159 | + PassWord: request.NewPwd, | ||
160 | + //Phone:user.Phone, | ||
161 | + }) | ||
162 | + log.Debug(fmt.Sprintf("修改密码 simnum:%v ucenter_id:%v pwd:%v", user.Phone, user.UserCenterId, request.NewPwd)) | ||
163 | + if err != nil { | ||
164 | + err = protocol.NewErrWithMessage(1) | ||
165 | log.Error(err) | 165 | log.Error(err) |
166 | return | 166 | return |
167 | } | 167 | } |
168 | - if message.Errno == 0 && message.Errmsg == "ok" { | ||
169 | - if err = message.Unmarshal(&loginResponse); err != nil { | ||
170 | - log.Error(err) | ||
171 | - return | ||
172 | - } | ||
173 | - if loginResponse.Id != user.UserCenterId { | ||
174 | - log.Error(fmt.Sprintf("用户中心uid不一致 input:%v want:%v", loginResponse.Id, user.UserCenterId)) | ||
175 | - err = protocol.NewErrWithMessage(1) | ||
176 | - return | ||
177 | - } | ||
178 | - err = agg.ChangeUcenterUserInfo(user.UserCenterId, user.Phone, &protocol.UCenterPutUserRequest{ | ||
179 | - PassWord: request.NewPwd, | ||
180 | - //Phone:user.Phone, | ||
181 | - }) | ||
182 | - } else { | ||
183 | - if message.Errno == -1 { | ||
184 | - err = protocol.NewErrWithMessage(2028) | ||
185 | - } else { | ||
186 | - err = protocol.NewErrWithMessage(2028) | ||
187 | - } | ||
188 | - log.Debug(fmt.Sprintf("修改密码 simnum:%v ucenter_id:%v pwd:%v", user.Phone, user.UserCenterId, request.NewPwd), message.Errno, message.Errmsg) | ||
189 | - return | ||
190 | - } | 168 | + //var message protocol.Message |
169 | + //if _, err = agg.RequestUserCenter(protocol.MethodLogin, http.MethodPost, &protocol.UCenterLoginRequest{ | ||
170 | + // PassWord: request.OldPwd, | ||
171 | + // Phone: user.Phone, | ||
172 | + // Type: 1, | ||
173 | + // GrantType: protocol.LoginTypePassPord, | ||
174 | + //}, &message); err != nil { | ||
175 | + // log.Error(err) | ||
176 | + // return | ||
177 | + //} | ||
178 | + //if message.Errno == 0 && message.Errmsg == "ok" { | ||
179 | + // if err = message.Unmarshal(&loginResponse); err != nil { | ||
180 | + // log.Error(err) | ||
181 | + // return | ||
182 | + // } | ||
183 | + // if loginResponse.Id != user.UserCenterId { | ||
184 | + // log.Error(fmt.Sprintf("用户中心uid不一致 input:%v want:%v", loginResponse.Id, user.UserCenterId)) | ||
185 | + // err = protocol.NewErrWithMessage(1) | ||
186 | + // return | ||
187 | + // } | ||
188 | + // err = agg.ChangeUcenterUserInfo(user.UserCenterId, user.Phone, &protocol.UCenterPutUserRequest{ | ||
189 | + // PassWord: request.NewPwd, | ||
190 | + // //Phone:user.Phone, | ||
191 | + // }) | ||
192 | + //} else { | ||
193 | + // if message.Errno == -1 { | ||
194 | + // err = protocol.NewErrWithMessage(2028) | ||
195 | + // } else { | ||
196 | + // err = protocol.NewErrWithMessage(2028) | ||
197 | + // } | ||
198 | + // log.Debug(fmt.Sprintf("修改密码 simnum:%v ucenter_id:%v pwd:%v", user.Phone, user.UserCenterId, request.NewPwd), message.Errno, message.Errmsg) | ||
199 | + // return | ||
200 | + //} | ||
191 | return | 201 | return |
192 | } | 202 | } |
193 | 203 |
-
请 注册 或 登录 后发表评论