main.go 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package main
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "log"
  7. "time"
  8. "go-common/app/service/live/gift/api/grpc/v1"
  9. "go-common/library/net/rpc/warden"
  10. xtime "go-common/library/time"
  11. )
  12. var name, addr string
  13. func init() {
  14. flag.StringVar(&name, "name", "lily", "name")
  15. flag.StringVar(&addr, "addr", "127.0.0.1:9000", "server addr")
  16. }
  17. func main() {
  18. flag.Parse()
  19. cfg := &warden.ClientConfig{
  20. Dial: xtime.Duration(time.Second * 3),
  21. Timeout: xtime.Duration(time.Second * 3),
  22. }
  23. cc, err := warden.NewClient(cfg).Dial(context.Background(), addr)
  24. if err != nil {
  25. log.Fatalf("new client failed!err:=%v", err)
  26. return
  27. }
  28. client := v1.NewGiftClient(cc)
  29. //resp, err := client.RoomGiftList(context.Background(), &v1.RoomGiftListReq{
  30. // RoomId: 1,
  31. // AreaV2ParentId:1,
  32. // AreaV2Id:1,
  33. // Platform:"android",
  34. //})
  35. //resp, err:= client.GiftConfig(context.Background(), &v1.GiftConfigReq{
  36. // Platform:"android",
  37. // Build:1,
  38. //})
  39. resp, err := client.DiscountGiftList(context.Background(), &v1.DiscountGiftListReq{
  40. //Uid: 88895029,
  41. Uid: 1,
  42. Roomid: 1,
  43. //Ruid: 1,
  44. AreaV2Id: 89,
  45. })
  46. if err != nil {
  47. log.Fatalf("say hello failed!err:=%v,resp:(%v)", err, resp)
  48. return
  49. }
  50. fmt.Printf("got HelloReply:%+v", resp)
  51. }