vip.bm.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: api/grpc/v1/vip.proto
  3. /*
  4. Package v1 is a generated blademaster stub package.
  5. This code was generated with go-common/app/tool/bmgen/protoc-gen-bm v0.1.
  6. It is generated from these files:
  7. api/grpc/v1/vip.proto
  8. */
  9. package v1
  10. import (
  11. "context"
  12. bm "go-common/library/net/http/blademaster"
  13. "go-common/library/net/http/blademaster/binding"
  14. )
  15. // to suppressed 'imported but not used warning'
  16. var _ *bm.Context
  17. var _ context.Context
  18. var _ binding.StructValidator
  19. // =============
  20. // Vip Interface
  21. // =============
  22. type Vip interface {
  23. // Info 返回用户vip信息
  24. Info(ctx context.Context, req *UidReq) (resp *InfoReply, err error)
  25. // Buy 购买月费/年费姥爷
  26. Buy(ctx context.Context, req *BuyReq) (resp *BuyReply, err error)
  27. }
  28. var v1VipSvc Vip
  29. // @params UidReq
  30. // @router GET /xlive/xuser/v1/vip/Info
  31. // @response InfoReply
  32. func vipInfo(c *bm.Context) {
  33. p := new(UidReq)
  34. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  35. return
  36. }
  37. resp, err := v1VipSvc.Info(c, p)
  38. c.JSON(resp, err)
  39. }
  40. // @params BuyReq
  41. // @router GET /xlive/xuser/v1/vip/Buy
  42. // @response BuyReply
  43. func vipBuy(c *bm.Context) {
  44. p := new(BuyReq)
  45. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  46. return
  47. }
  48. resp, err := v1VipSvc.Buy(c, p)
  49. c.JSON(resp, err)
  50. }
  51. // RegisterV1VipService Register the blademaster route with middleware map
  52. // midMap is the middleware map, the key is defined in proto
  53. func RegisterV1VipService(e *bm.Engine, svc Vip, midMap map[string]bm.HandlerFunc) {
  54. v1VipSvc = svc
  55. e.GET("/xlive/xuser/v1/vip/Info", vipInfo)
  56. e.GET("/xlive/xuser/v1/vip/Buy", vipBuy)
  57. }