user_face.go 944 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package gatesink
  2. import (
  3. "bet24.com/log"
  4. userservices "bet24.com/servers/micros/userservices/proto"
  5. "bet24.com/servers/transaction"
  6. "encoding/json"
  7. "fmt"
  8. )
  9. // 修改头像(包括头像url)
  10. func (this *user) changeFace(msg, data string) {
  11. obj := transaction.NewChangeFace()
  12. err := json.Unmarshal([]byte(data), &obj.IN)
  13. if err != nil {
  14. log.Release("changeFace Unmarshal data failed %v", data)
  15. this.WriteMsg(msg, fmt.Sprintf("changeFace Unmarshal data failed %v", data))
  16. return
  17. }
  18. obj.IN.UserID = this.getUserId()
  19. obj.DoAction(nil)
  20. obj.Out.ErrorMsg = fmt.Sprintf("change face error code = %d", obj.Out.RetCode)
  21. buf, err := json.Marshal(obj.Out)
  22. if err != nil {
  23. retData := fmt.Sprintf("changeFace DoAction marshal fail %v", err)
  24. log.Release(retData)
  25. this.WriteMsg(msg, retData)
  26. return
  27. }
  28. // 刷新coreservice中的用户信息
  29. go userservices.UpdateUserInfo(this.getUserId())
  30. this.WriteMsg(msg, string(buf))
  31. }