wallet.go 667 B

123456789101112131415161718192021222324
  1. package Service
  2. import (
  3. "context"
  4. "encoding/json"
  5. "go-common/app/job/live/wallet/model"
  6. "go-common/library/log"
  7. )
  8. func (s *Service) mergeData(nwMsg []byte, oldMsg []byte, action string) {
  9. if action == "update" {
  10. // do noting
  11. } else if action == "insert" {
  12. userNew := &model.User{}
  13. if err := json.Unmarshal(nwMsg, userNew); err != nil {
  14. log.Error("json.Unmarshal(%s) error(%v)", string(nwMsg), err)
  15. return
  16. }
  17. log.Info("new user %d", userNew.Uid)
  18. s.dao.InitWallet(context.TODO(), userNew)
  19. //s.dao.InitWallet(context.TODO(), userNew.Uid, userNew.Gold, userNew.IapGold, userNew.Silver)
  20. s.dao.DelWalletCache(context.TODO(), userNew.Uid)
  21. }
  22. }