MCPcopy Index your code
hub / github.com/dearcode/candy / UpdateUserInfo

Method UpdateUserInfo

gate/server.go:174–193  ·  view source on GitHub ↗

UpdateUserInfo nickname.

(ctx context.Context, req *meta.GateUpdateUserInfoRequest)

Source from the content-addressed store, hash-verified

172
173// UpdateUserInfo nickname.
174func (g *Gate) UpdateUserInfo(ctx context.Context, req *meta.GateUpdateUserInfoRequest) (*meta.GateUpdateUserInfoResponse, error) {
175 log.Debug("Gate UpdateUserInfo")
176 s, err := g.getSession(ctx)
177 if err != nil {
178 return &meta.GateUpdateUserInfoResponse{Header: &meta.ResponseHeader{Code: util.ErrorGetSession, Msg: err.Error()}}, nil
179 }
180
181 if !s.isOnline() {
182 err := errors.Errorf("current user is offline")
183 return &meta.GateUpdateUserInfoResponse{Header: &meta.ResponseHeader{Code: util.ErrorOffline, Msg: err.Error()}}, nil
184 }
185
186 log.Debugf("updateUserInfo user:%v niceName:%v", req.User, req.NickName)
187 id, err := g.store.updateUserInfo(req.User, req.NickName, req.Avatar)
188 if err != nil {
189 return &meta.GateUpdateUserInfoResponse{Header: &meta.ResponseHeader{Code: util.ErrorUpdateUserInfo, Msg: err.Error()}, ID: id}, nil
190 }
191
192 return &meta.GateUpdateUserInfoResponse{ID: id}, nil
193}
194
195// UpdateUserPassword update user password
196func (g *Gate) UpdateUserPassword(ctx context.Context, req *meta.GateUpdateUserPasswordRequest) (*meta.GateUpdateUserPasswordResponse, error) {

Callers

nothing calls this directly

Calls 4

getSessionMethod · 0.95
isOnlineMethod · 0.80
ErrorMethod · 0.45
updateUserInfoMethod · 0.45

Tested by

no test coverage detected