main.go 1014 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package main
  2. import (
  3. "context"
  4. "flag"
  5. "fmt"
  6. "log"
  7. "time"
  8. "go-common/app/service/bbq/notice-service/api/v1"
  9. "go-common/library/net/rpc/warden"
  10. xtime "go-common/library/time"
  11. )
  12. var (
  13. addr string
  14. )
  15. func init() {
  16. flag.StringVar(&addr, "addr", "127.0.0.1:9003", "server addr")
  17. }
  18. func main() {
  19. flag.Parse()
  20. cfg := &warden.ClientConfig{
  21. Dial: xtime.Duration(time.Second * 3),
  22. Timeout: xtime.Duration(time.Second * 3),
  23. }
  24. cc, err := warden.NewClient(cfg).Dial(context.Background(), addr)
  25. if err != nil {
  26. log.Fatalf("new client failed!err:=%v", err)
  27. return
  28. }
  29. client := v1.NewNoticeClient(cc)
  30. req := &v1.NoticeBase{
  31. Mid: 69121924,
  32. ActionMid: 111001917,
  33. SvId: 0,
  34. Title: "关注了你",
  35. Text: "",
  36. JumpUrl: "",
  37. NoticeType: 3,
  38. BizType: 3,
  39. BizId: 0,
  40. NoticeTime: xtime.Time(time.Now().Unix()),
  41. Buvid: "XYDEB30D9F184E3F3EE7536645CB7188E7143",
  42. }
  43. resp, err := client.CreateNotice(context.Background(), req)
  44. fmt.Println(resp, err)
  45. }