transfer.pb.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package proto
  2. import (
  3. "bet24.com/log"
  4. "bet24.com/servers/micros/common"
  5. "context"
  6. )
  7. func GoldTransfer(userId, toUserId, amount int, ipAddress string) (bool, string) {
  8. xclient := getClient()
  9. //defer xclient.Close()
  10. args := &Request_Transfer{
  11. UserId: userId,
  12. ToUserId: toUserId,
  13. Amount: amount,
  14. IpAddress: ipAddress,
  15. }
  16. reply := &Response_Transfer{}
  17. err := xclient.Call(context.Background(), "GoldTransfer", args, reply)
  18. if err != nil {
  19. log.Debug("GoldTransfer failed to call: %v", err)
  20. common.GetClientPool().RemoveClient(ServiceName)
  21. return false, "server error"
  22. }
  23. return reply.Success, reply.ErrMsg
  24. }
  25. // 赠送日志
  26. func GetGoldTransferLog(userId int) string {
  27. xclient := getClient()
  28. //defer xclient.Close()
  29. args := &Request_GoldTransferLog{
  30. UserId: userId,
  31. }
  32. reply := &Response_GoldTransferLog{}
  33. err := xclient.Call(context.Background(), "GetGoldTransferLog", args, reply)
  34. if err != nil {
  35. common.GetClientPool().RemoveClient(ServiceName)
  36. log.Debug("GetGoldTransferLog failed to call: %v", err)
  37. return ""
  38. }
  39. return reply.Data
  40. }
  41. // 赠送配置
  42. func GetGoldTransferConfig(userId int) string {
  43. xclient := getClient()
  44. //defer xclient.Close()
  45. args := &Request_GoldTransferLog{
  46. UserId: userId,
  47. }
  48. reply := &Response_GoldTransferLog{}
  49. err := xclient.Call(context.Background(), "GetGoldTransferConfig", args, reply)
  50. if err != nil {
  51. common.GetClientPool().RemoveClient(ServiceName)
  52. log.Debug("GetGoldTransferConfig failed to call: %v", err)
  53. return ""
  54. }
  55. return reply.Data
  56. }