user_coupontask.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package gatesink
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/coreservice/client"
  5. "bet24.com/servers/fishhall/protocol"
  6. game "bet24.com/servers/micros/game/proto"
  7. "encoding/json"
  8. "fmt"
  9. )
  10. // 用户券任务
  11. func (this *user) getCouponTask(msg, data string) {
  12. resp := client.GetUserCouponTask(this.getUserId())
  13. if resp.List != nil {
  14. for _, v := range resp.List {
  15. if info := game.GetGame(v.GameId); info != nil {
  16. v.ChineseName = info.ChineseName
  17. }
  18. }
  19. }
  20. buf, _ := json.Marshal(resp)
  21. this.WriteMsg(msg, string(buf))
  22. }
  23. // 领取奖励
  24. func (this *user) awardCouponTask(msg, data string) {
  25. var req protocol.AwardCouponTask_req
  26. if err := json.Unmarshal([]byte(data), &req); err != nil {
  27. retData := fmt.Sprintf("awardCouponTask Unmarshal data failed %v", data)
  28. log.Error(retData)
  29. this.WriteMsg(msg, retData)
  30. return
  31. }
  32. resp := client.AwardCouponTask(this.getUserId(), req.UserTaskId)
  33. if resp.RetCode != 1 {
  34. log.Debug("user.awardCouponTask failed %v", resp)
  35. }
  36. this.WriteMsg(msg, resp.Data)
  37. }
  38. // 修改临时上限
  39. func (this *user) updateCouponTaskTmpLimit(msg, data string) {
  40. resp := client.UpdateCouponTaskTmpLimit(this.getUserId())
  41. if resp.RetCode != 1 {
  42. log.Debug("user.updateCouponTaskTmpLimit failed %v", resp)
  43. }
  44. this.WriteMsg(msg, resp.Data)
  45. }