user.bm.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: user.proto
  3. /*
  4. Package http 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. user.proto
  8. */
  9. package http
  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 PathUserGetUserInfo = "/live.webucenter.User/get_user_info"
  20. // ==============
  21. // User Interface
  22. // ==============
  23. type UserBMServer interface {
  24. // 根据uid查询用户信息
  25. // `midware:"auth"`
  26. GetUserInfo(ctx context.Context, req *GetInfoReq) (resp *GetInfoResp, err error)
  27. }
  28. var UserSvc UserBMServer
  29. func userGetUserInfo(c *bm.Context) {
  30. p := new(GetInfoReq)
  31. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  32. return
  33. }
  34. resp, err := UserSvc.GetUserInfo(c, p)
  35. c.JSON(resp, err)
  36. }
  37. // RegisterUserService Register the blademaster route with middleware map
  38. // midMap is the middleware map, the key is defined in proto
  39. func RegisterUserService(e *bm.Engine, svc UserBMServer, midMap map[string]bm.HandlerFunc) {
  40. auth := midMap["auth"]
  41. UserSvc = svc
  42. e.GET("/xlive/web-ucenter/user/get_user_info", auth, userGetUserInfo)
  43. }
  44. // RegisterUserBMServer Register the blademaster route
  45. func RegisterUserBMServer(e *bm.Engine, server UserBMServer) {
  46. e.GET("/live.webucenter.User/get_user_info", userGetUserInfo)
  47. }