savingpot.pb.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. package proto
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/common"
  5. "golang.org/x/net/context"
  6. )
  7. // 获取用户存钱罐金币
  8. func GetUserSavingPotBuyAmount(userId int, old bool) int {
  9. xclient := getClient()
  10. //defer xclient.Close()
  11. args := &Request{
  12. UserId: userId,
  13. IsOld: old,
  14. }
  15. reply := &Response{}
  16. err := xclient.Call(context.Background(), "GetUserSavingPotBuyAmount", args, reply)
  17. if err != nil {
  18. common.GetClientPool().RemoveClient(ServiceName)
  19. log.Debug("activityservice failed to call: %v", err)
  20. }
  21. return reply.Amount
  22. }
  23. // 获取用户存钱罐
  24. func GetUserSavingPot(userId int) string {
  25. xclient := getClient()
  26. //defer xclient.Close()
  27. args := &Request{
  28. UserId: userId,
  29. }
  30. reply := &Response{}
  31. err := xclient.Call(context.Background(), "GetUserSavingPot", args, reply)
  32. if err != nil {
  33. common.GetClientPool().RemoveClient(ServiceName)
  34. log.Debug("activityservice failed to call: %v", err)
  35. }
  36. return reply.Data
  37. }
  38. func GetUserNewSavingPot(userId int) string {
  39. xclient := getClient()
  40. //defer xclient.Close()
  41. args := &Request{
  42. UserId: userId,
  43. }
  44. reply := &Response{}
  45. err := xclient.Call(context.Background(), "GetUserNewSavingPot", args, reply)
  46. if err != nil {
  47. common.GetClientPool().RemoveClient(ServiceName)
  48. log.Debug("activityservice failed to call: %v", err)
  49. }
  50. return reply.Data
  51. }
  52. // 触发存钱罐
  53. func TriggerSavingPot(userId, gameId, winAmount int) {
  54. xclient := getClient()
  55. //defer xclient.Close()
  56. args := &Request{
  57. UserId: userId,
  58. GameId: gameId,
  59. WinAmount: winAmount,
  60. }
  61. reply := &Response{}
  62. err := xclient.Call(context.Background(), "TriggerSavingPot", args, reply)
  63. if err != nil {
  64. common.GetClientPool().RemoveClient(ServiceName)
  65. log.Debug("activityservice failed to call: %v", err)
  66. }
  67. return
  68. }
  69. // 存钱罐购买
  70. func SavingPotBuy(userId int, old bool) bool {
  71. xclient := getClient()
  72. //defer xclient.Close()
  73. args := &Request{
  74. UserId: userId,
  75. IsOld: old,
  76. }
  77. reply := &Response{}
  78. err := xclient.Call(context.Background(), "SavingPotBuy", args, reply)
  79. if err != nil {
  80. common.GetClientPool().RemoveClient(ServiceName)
  81. log.Debug("activityservice failed to call: %v", err)
  82. }
  83. return reply.Success
  84. }
  85. func CheckMultiplyReceive(userId int) {
  86. xclient := getClient()
  87. //defer xclient.Close()
  88. args := &Request{
  89. UserId: userId,
  90. }
  91. reply := &Response{}
  92. err := xclient.Call(context.Background(), "CheckMultiplyReceive", args, reply)
  93. if err != nil {
  94. common.GetClientPool().RemoveClient(ServiceName)
  95. log.Debug("activityservice failed to call: %v", err)
  96. }
  97. }
  98. func SetIsOldSavingPot(userId int) {
  99. xclient := getClient()
  100. //defer xclient.Close()
  101. args := &Request{
  102. UserId: userId,
  103. }
  104. reply := &Response{}
  105. err := xclient.Call(context.Background(), "SetIsOldSavingPot", args, reply)
  106. if err != nil {
  107. common.GetClientPool().RemoveClient(ServiceName)
  108. log.Debug("activityservice failed to call: %v", err)
  109. }
  110. }