http.bm.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Code generated by protoc-gen-bm v0.1, DO NOT EDIT.
  2. // source: api/http/v1/http.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/http/v1/http.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. // Captcha Interface
  21. // =================
  22. // XCaptcha
  23. type Captcha interface {
  24. // 验证码校验 `internal:"true"`
  25. Verify(ctx context.Context, req *XVerifyReq) (resp *XVerifyResp, err error)
  26. }
  27. var v1CaptchaSvc Captcha
  28. // @params XVerifyReq
  29. // @router GET /xlive/internal/xcaptcha/v1/captcha/verify
  30. // @response XVerifyResp
  31. func captchaVerify(c *bm.Context) {
  32. p := new(XVerifyReq)
  33. if err := c.BindWith(p, binding.Default(c.Request.Method, c.Request.Header.Get("Content-Type"))); err != nil {
  34. return
  35. }
  36. resp, err := v1CaptchaSvc.Verify(c, p)
  37. c.JSON(resp, err)
  38. }
  39. // RegisterV1CaptchaService Register the blademaster route with middleware map
  40. // midMap is the middleware map, the key is defined in proto
  41. func RegisterV1CaptchaService(e *bm.Engine, svc Captcha, midMap map[string]bm.HandlerFunc) {
  42. v1CaptchaSvc = svc
  43. e.GET("/xlive/internal/xcaptcha/v1/captcha/verify", captchaVerify)
  44. }