command_broadcast.go 909 B

12345678910111213141516171819202122232425262728293031323334
  1. package client
  2. import (
  3. "encoding/json"
  4. "bet24.com/log"
  5. )
  6. // userId=用户ID gameId=游戏ID priority=优先级 msg=消息 ext=扩展信息
  7. func SendBroadcast(userId, gameId, priority int, msg, ext string) Response {
  8. log.Debug("corclient.SendBroadcast userId=%d gameId=%d priority=%d msg=%s ext=%s",
  9. userId, gameId, priority, msg, ext)
  10. cmdmsg := "SendBroadcast"
  11. var req SendBroadcast_req
  12. req.UserID = userId
  13. req.GameID = gameId
  14. req.Priority = priority
  15. req.Msg = msg
  16. req.Ext = ext
  17. d, _ := json.Marshal(req)
  18. return DoRequest(cmdmsg, string(d))
  19. }
  20. func SendGameWinBroadcast(userId int, userName string, score int, gameId int, gameName string) Response {
  21. cmdmsg := "SendGameWinBroadcast"
  22. var req SendBroadcast_req
  23. req.UserID = userId
  24. req.GameID = gameId
  25. req.Score = score
  26. req.NickName = userName
  27. req.GameName = gameName
  28. d, _ := json.Marshal(req)
  29. return DoRequest(cmdmsg, string(d))
  30. }