fighting.go 1017 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package api
  2. import (
  3. "errors"
  4. "gadmin/internal/admin/forms"
  5. "gadmin/internal/admin/service"
  6. "github.com/gin-gonic/gin"
  7. "github.com/sirupsen/logrus"
  8. )
  9. func FightingList(c *gin.Context) {
  10. var req forms.FightingListReq
  11. if err := c.ShouldBind(&req); err != nil {
  12. c.JSON(200, ErrorResponse(err))
  13. return
  14. }
  15. if err := forms.ParseParams(&req); err != nil {
  16. c.JSON(200, ErrorResponse(err))
  17. return
  18. }
  19. c.JSON(200, service.Fighting.List(c, req))
  20. }
  21. func FightingExtra(c *gin.Context) {
  22. extraPath := c.DefaultQuery("extra_path", "")
  23. if extraPath == "" {
  24. c.JSON(200, ErrorResponse(errors.New("参数错误")))
  25. }
  26. c.JSON(200, service.Fighting.GetExtra(extraPath))
  27. }
  28. func FightingExport(c *gin.Context) {
  29. var req forms.FightingExportReq
  30. if err := c.ShouldBind(&req); err != nil {
  31. c.JSON(200, ErrorResponse(err))
  32. return
  33. }
  34. if err := forms.ParseParams(&req); err != nil {
  35. c.JSON(200, ErrorResponse(err))
  36. return
  37. }
  38. logrus.Warnf("FightingExport req:%+v", req)
  39. service.Fighting.Export(c, req)
  40. }