sngmatch_notification.go 836 B

123456789101112131415161718192021222324252627282930
  1. package sngmatch
  2. import (
  3. "bet24.com/log"
  4. item "bet24.com/servers/micros/item_inventory/proto"
  5. "encoding/json"
  6. )
  7. const (
  8. SngMatch_noti_rank = "sngmatch_rank"
  9. )
  10. type SngMatch_notificationInfo struct {
  11. Msg string `json:",omitempty"`
  12. MatchId int
  13. UserId int `json:",omitempty"`
  14. Rank int `json:",omitempty"`
  15. Prize []item.ItemPack `json:",omitempty"`
  16. }
  17. func postUserRankNotification(userId int, matchId int, matchNo int, rank int, items []item.ItemPack) {
  18. mi := getMatchManager().getMatchByMatchNo(matchNo)
  19. if mi == nil {
  20. log.Release("postUserRankNotification matchNo[%d] not found", matchNo)
  21. return
  22. }
  23. ni := SngMatch_notificationInfo{Msg: SngMatch_noti_rank, UserId: userId, MatchId: matchId, Rank: rank, Prize: items}
  24. d, _ := json.Marshal(ni)
  25. mi.sendNotification(userId, string(d))
  26. }