highly_profitable_pb.go 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package proto
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/common"
  5. item "bet24.com/servers/micros/item_inventory/proto"
  6. "context"
  7. )
  8. func GetHighlyProfitableActivity(userId int) UserStageTask {
  9. xclient := getClient()
  10. args := &Request{
  11. UserId: userId,
  12. }
  13. reply := &Response{}
  14. err := xclient.Call(context.Background(), "GetHighlyProfitableActivity", args, reply)
  15. if err != nil {
  16. common.GetClientPool().RemoveClient(ServiceName)
  17. log.Debug("highly_profitable.GetHighlyProfitableActivity failed to call: %v", err)
  18. return UserStageTask{}
  19. }
  20. return reply.List
  21. }
  22. func ClaimHighlyProfitableAward(userId int) (bool, []item.ItemPack) {
  23. xclient := getClient()
  24. args := &Request{
  25. UserId: userId,
  26. }
  27. reply := &Response{}
  28. err := xclient.Call(context.Background(), "ClaimHighlyProfitableAward", args, reply)
  29. if err != nil {
  30. common.GetClientPool().RemoveClient(ServiceName)
  31. log.Debug("highly_profitable.ClaimHighlyProfitableAward failed to call: %v", err)
  32. return false, nil
  33. }
  34. return reply.Success, reply.Items
  35. }
  36. func ActivationHighlyProfitableNotification(userId int) bool {
  37. xclient := getClient()
  38. args := &Request{
  39. UserId: userId,
  40. }
  41. reply := &Response{}
  42. err := xclient.Call(context.Background(), "ActivationHighlyProfitableNotification", args, reply)
  43. if err != nil {
  44. common.GetClientPool().RemoveClient(ServiceName)
  45. log.Debug("highly_profitable.ActivationHighlyProfitableNotification failed to call: %v", err)
  46. return false
  47. }
  48. return reply.Success
  49. }
  50. func OnUserFinishedRelativeTask(userId int) {
  51. xclient := getClient()
  52. args := &Request{
  53. UserId: userId,
  54. }
  55. err := xclient.Call(context.Background(), "OnUserFinishedRelativeTask", args, nil)
  56. if err != nil {
  57. common.GetClientPool().RemoveClient(ServiceName)
  58. log.Debug("highly_profitable.OnUserFinishedRelativeTask failed to call: %v", err)
  59. }
  60. }