user_award.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package gatesink
  2. import (
  3. "encoding/json"
  4. "fmt"
  5. "bet24.com/log"
  6. "bet24.com/servers/coreservice/client"
  7. "bet24.com/servers/fishhall/protocol"
  8. )
  9. const (
  10. _ = iota
  11. ActiveTaskAnswer // 问卷调查
  12. ActiveAgentShare // 代理分享
  13. )
  14. // 发送问卷调查奖励
  15. func (this *user) sendTaskAnswerAward(msg, data string) {
  16. var req protocol.Award_req
  17. if err := json.Unmarshal([]byte(data), &req); err != nil {
  18. retData := fmt.Sprintf("sendTaskAnswerAward unmarshal fail %v", err)
  19. log.Release(retData)
  20. this.WriteMsg(msg, retData)
  21. return
  22. }
  23. resp := client.SendAward(this.getUserId(), ActiveTaskAnswer, req.HallType, this.GetIP())
  24. if resp.RetCode != 1 {
  25. log.Debug("user.sendTaskAnswerAward failed %v", resp)
  26. }
  27. this.WriteMsg(msg, resp.Data)
  28. return
  29. }
  30. func (this *user) sendAgentShareAward(msg, data string) {
  31. resp := client.SendAward(this.getUserId(), ActiveAgentShare, 3, this.GetIP())
  32. if resp.RetCode != 1 {
  33. log.Debug("user.sendAgentShareAward failed %v", resp)
  34. }
  35. this.WriteMsg(msg, resp.Data)
  36. return
  37. }