report.go 816 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package http
  2. import (
  3. "go-common/app/interface/bbq/app-bbq/api/http/v1"
  4. "go-common/app/interface/bbq/app-bbq/model"
  5. "go-common/library/ecode"
  6. bm "go-common/library/net/http/blademaster"
  7. "github.com/pkg/errors"
  8. )
  9. func reportConfig(c *bm.Context) {
  10. arg := new(v1.Base)
  11. if err := c.Bind(arg); err != nil {
  12. errors.Wrap(err, "参数验证失败")
  13. return
  14. }
  15. res := &v1.ReportConfigResponse{
  16. Report: model.Reports,
  17. Reasons: model.Reasons,
  18. }
  19. c.JSON(res, nil)
  20. }
  21. func reportReport(c *bm.Context) {
  22. arg := new(v1.ReportRequest)
  23. if err := c.Bind(arg); err != nil {
  24. errors.Wrap(err, "参数验证失败")
  25. return
  26. }
  27. mid, exists := c.Get("mid")
  28. if !exists {
  29. c.JSON(nil, ecode.NoLogin)
  30. return
  31. }
  32. accessKey := c.Request.Form.Get("access_key")
  33. c.JSON(srv.Report(c, arg, mid.(int64), accessKey))
  34. }