exp.go 417 B

12345678910111213141516171819
  1. package service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "go-common/app/job/live-userexp/model"
  6. "go-common/library/log"
  7. )
  8. func (s *Service) levelCacheUpdate(nwMsg []byte, oldMsg []byte) {
  9. exp := &model.Exp{}
  10. if err := json.Unmarshal(nwMsg, exp); err != nil {
  11. log.Error("json.Unmarshal(%s) error(%v)", string(nwMsg), err)
  12. return
  13. }
  14. level := model.FormatLevel(exp)
  15. s.dao.SetLevelCache(context.TODO(), level)
  16. }