service.bm.go 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: service.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. service.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. var PathHistoryGetHistoryByUid = "/live.webucenter.v1.history/get_history_by_uid"
  20. var PathHistoryDelHistory = "/live.webucenter.v1.history/del_history"
  21. var PathCapsuleGetDetail = "/live.webucenter.v1.Capsule/get_detail"
  22. var PathCapsuleOpenCapsule = "/live.webucenter.v1.Capsule/open_capsule"
  23. var PathCapsuleGetCapsuleInfo = "/live.webucenter.v1.Capsule/get_capsule_info"
  24. var PathCapsuleOpenCapsuleByType = "/live.webucenter.v1.Capsule/open_capsule_by_type"
  25. var PathAnchorTaskMyReward = "/live.webucenter.v1.AnchorTask/myReward"
  26. var PathAnchorTaskUseRecord = "/live.webucenter.v1.AnchorTask/useRecord"
  27. var PathAnchorTaskUseReward = "/live.webucenter.v1.AnchorTask/useReward"
  28. var PathAnchorTaskIsViewed = "/live.webucenter.v1.AnchorTask/isViewed"
  29. var PathAnchorTaskAddReward = "/live.webucenter.v1.AnchorTask/addReward"
  30. // =================
  31. // History Interface
  32. // =================
  33. // History 相关服务
  34. type HistoryBMServer interface {
  35. // 根据uid查询直播关键历史记录
  36. // `midware:"auth"`
  37. GetHistoryByUid(ctx context.Context, req *GetHistoryReq) (resp *GetHistoryResp, err error)
  38. // 删除直播历史记录
  39. // `method:"POST" midware:"auth"`
  40. DelHistory(ctx context.Context, req *DelHistoryReq) (resp *DelHistoryResp, err error)
  41. }
  42. var v1HistorySvc HistoryBMServer
  43. func historyGetHistoryByUid(c *bm.Context) {
  44. p := new(GetHistoryReq)
  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 := v1HistorySvc.GetHistoryByUid(c, p)
  49. c.JSON(resp, err)
  50. }
  51. func historyDelHistory(c *bm.Context) {
  52. p := new(DelHistoryReq)
  53. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  54. return
  55. }
  56. resp, err := v1HistorySvc.DelHistory(c, p)
  57. c.JSON(resp, err)
  58. }
  59. // RegisterV1HistoryService Register the blademaster route with middleware map
  60. // midMap is the middleware map, the key is defined in proto
  61. func RegisterV1HistoryService(e *bm.Engine, svc HistoryBMServer, midMap map[string]bm.HandlerFunc) {
  62. auth := midMap["auth"]
  63. v1HistorySvc = svc
  64. e.GET("/xlive/web-ucenter/v1/history/get_history_by_uid", auth, historyGetHistoryByUid)
  65. e.POST("/xlive/web-ucenter/v1/history/del_history", auth, historyDelHistory)
  66. }
  67. // RegisterHistoryBMServer Register the blademaster route
  68. func RegisterHistoryBMServer(e *bm.Engine, server HistoryBMServer) {
  69. e.GET("/live.webucenter.v1.history/get_history_by_uid", historyGetHistoryByUid)
  70. e.POST("/live.webucenter.v1.history/del_history", historyDelHistory)
  71. }
  72. // =================
  73. // Capsule Interface
  74. // =================
  75. type CapsuleBMServer interface {
  76. // `midware:"auth"`
  77. GetDetail(ctx context.Context, req *CapsuleGetDetailReq) (resp *CapsuleGetDetailResp, err error)
  78. // `method:"POST" midware:"auth"`
  79. OpenCapsule(ctx context.Context, req *CapsuleOpenCapsuleReq) (resp *CapsuleOpenCapsuleResp, err error)
  80. // `midware:"guest"`
  81. GetCapsuleInfo(ctx context.Context, req *CapsuleGetCapsuleInfoReq) (resp *CapsuleGetCapsuleInfoResp, err error)
  82. // `method:"POST" midware:"auth"`
  83. OpenCapsuleByType(ctx context.Context, req *CapsuleOpenCapsuleByTypeReq) (resp *CapsuleOpenCapsuleByTypeResp, err error)
  84. }
  85. var v1CapsuleSvc CapsuleBMServer
  86. func capsuleGetDetail(c *bm.Context) {
  87. p := new(CapsuleGetDetailReq)
  88. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  89. return
  90. }
  91. resp, err := v1CapsuleSvc.GetDetail(c, p)
  92. c.JSON(resp, err)
  93. }
  94. func capsuleOpenCapsule(c *bm.Context) {
  95. p := new(CapsuleOpenCapsuleReq)
  96. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  97. return
  98. }
  99. resp, err := v1CapsuleSvc.OpenCapsule(c, p)
  100. c.JSON(resp, err)
  101. }
  102. func capsuleGetCapsuleInfo(c *bm.Context) {
  103. p := new(CapsuleGetCapsuleInfoReq)
  104. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  105. return
  106. }
  107. resp, err := v1CapsuleSvc.GetCapsuleInfo(c, p)
  108. c.JSON(resp, err)
  109. }
  110. func capsuleOpenCapsuleByType(c *bm.Context) {
  111. p := new(CapsuleOpenCapsuleByTypeReq)
  112. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  113. return
  114. }
  115. resp, err := v1CapsuleSvc.OpenCapsuleByType(c, p)
  116. c.JSON(resp, err)
  117. }
  118. // RegisterV1CapsuleService Register the blademaster route with middleware map
  119. // midMap is the middleware map, the key is defined in proto
  120. func RegisterV1CapsuleService(e *bm.Engine, svc CapsuleBMServer, midMap map[string]bm.HandlerFunc) {
  121. auth := midMap["auth"]
  122. guest := midMap["guest"]
  123. v1CapsuleSvc = svc
  124. e.GET("/xlive/web-ucenter/v1/capsule/get_detail", auth, capsuleGetDetail)
  125. e.POST("/xlive/web-ucenter/v1/capsule/open_capsule", auth, capsuleOpenCapsule)
  126. e.GET("/xlive/web-ucenter/v1/capsule/get_capsule_info", guest, capsuleGetCapsuleInfo)
  127. e.POST("/xlive/web-ucenter/v1/capsule/open_capsule_by_type", auth, capsuleOpenCapsuleByType)
  128. }
  129. // RegisterCapsuleBMServer Register the blademaster route
  130. func RegisterCapsuleBMServer(e *bm.Engine, server CapsuleBMServer) {
  131. e.GET("/live.webucenter.v1.Capsule/get_detail", capsuleGetDetail)
  132. e.POST("/live.webucenter.v1.Capsule/open_capsule", capsuleOpenCapsule)
  133. e.GET("/live.webucenter.v1.Capsule/get_capsule_info", capsuleGetCapsuleInfo)
  134. e.POST("/live.webucenter.v1.Capsule/open_capsule_by_type", capsuleOpenCapsuleByType)
  135. }
  136. // ====================
  137. // AnchorTask Interface
  138. // ====================
  139. type AnchorTaskBMServer interface {
  140. // (主播侧)-我的主播奖励(登录态)
  141. // `midware:"auth"`
  142. MyReward(ctx context.Context, req *AnchorTaskMyRewardReq) (resp *AnchorTaskMyRewardResp, err error)
  143. // (主播侧)-奖励使用记录(登录态)
  144. // `midware:"auth"`
  145. UseRecord(ctx context.Context, req *AnchorTaskUseRecordReq) (resp *AnchorTaskUseRecordResp, err error)
  146. // (主播侧)-使用奖励(登录态)
  147. // `method:"POST" midware:"auth"`
  148. UseReward(ctx context.Context, req *AnchorTaskUseRewardReq) (resp *AnchorTaskUseRewardResp, err error)
  149. // (主播侧)-奖励和任务红点(登录态)
  150. // `midware:"auth"`
  151. IsViewed(ctx context.Context, req *AnchorTaskIsViewedReq) (resp *AnchorTaskIsViewedResp, err error)
  152. // (主播侧)-添加主播奖励(内部接口)
  153. // `method:"POST" internal:"true"`
  154. AddReward(ctx context.Context, req *AnchorTaskAddRewardReq) (resp *AnchorTaskAddRewardResp, err error)
  155. }
  156. var v1AnchorTaskSvc AnchorTaskBMServer
  157. func anchorTaskMyReward(c *bm.Context) {
  158. p := new(AnchorTaskMyRewardReq)
  159. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  160. return
  161. }
  162. resp, err := v1AnchorTaskSvc.MyReward(c, p)
  163. c.JSON(resp, err)
  164. }
  165. func anchorTaskUseRecord(c *bm.Context) {
  166. p := new(AnchorTaskUseRecordReq)
  167. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  168. return
  169. }
  170. resp, err := v1AnchorTaskSvc.UseRecord(c, p)
  171. c.JSON(resp, err)
  172. }
  173. func anchorTaskUseReward(c *bm.Context) {
  174. p := new(AnchorTaskUseRewardReq)
  175. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  176. return
  177. }
  178. resp, err := v1AnchorTaskSvc.UseReward(c, p)
  179. c.JSON(resp, err)
  180. }
  181. func anchorTaskIsViewed(c *bm.Context) {
  182. p := new(AnchorTaskIsViewedReq)
  183. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  184. return
  185. }
  186. resp, err := v1AnchorTaskSvc.IsViewed(c, p)
  187. c.JSON(resp, err)
  188. }
  189. func anchorTaskAddReward(c *bm.Context) {
  190. p := new(AnchorTaskAddRewardReq)
  191. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  192. return
  193. }
  194. resp, err := v1AnchorTaskSvc.AddReward(c, p)
  195. c.JSON(resp, err)
  196. }
  197. // RegisterV1AnchorTaskService Register the blademaster route with middleware map
  198. // midMap is the middleware map, the key is defined in proto
  199. func RegisterV1AnchorTaskService(e *bm.Engine, svc AnchorTaskBMServer, midMap map[string]bm.HandlerFunc) {
  200. auth := midMap["auth"]
  201. v1AnchorTaskSvc = svc
  202. e.GET("/xlive/web-ucenter/v1/anchorTask/myReward", auth, anchorTaskMyReward)
  203. e.GET("/xlive/web-ucenter/v1/anchorTask/useRecord", auth, anchorTaskUseRecord)
  204. e.POST("/xlive/web-ucenter/v1/anchorTask/useReward", auth, anchorTaskUseReward)
  205. e.GET("/xlive/web-ucenter/v1/anchorTask/isViewed", auth, anchorTaskIsViewed)
  206. e.POST("/xlive/internal/web-ucenter/v1/anchorTask/addReward", anchorTaskAddReward)
  207. }
  208. // RegisterAnchorTaskBMServer Register the blademaster route
  209. func RegisterAnchorTaskBMServer(e *bm.Engine, server AnchorTaskBMServer) {
  210. e.GET("/live.webucenter.v1.AnchorTask/myReward", anchorTaskMyReward)
  211. e.GET("/live.webucenter.v1.AnchorTask/useRecord", anchorTaskUseRecord)
  212. e.POST("/live.webucenter.v1.AnchorTask/useReward", anchorTaskUseReward)
  213. e.GET("/live.webucenter.v1.AnchorTask/isViewed", anchorTaskIsViewed)
  214. e.POST("/live.webucenter.v1.AnchorTask/addReward", anchorTaskAddReward)
  215. }