task_log.go 909 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package http
  2. import (
  3. "go-common/app/admin/main/laser/model"
  4. "go-common/library/ecode"
  5. "go-common/library/log"
  6. "go-common/library/net/http/blademaster"
  7. )
  8. func queryTaskLog(c *blademaster.Context) {
  9. v := new(struct {
  10. MID int64 `form:"mid"`
  11. TaskID int64 `form:"task_id"`
  12. Platform int `form:"platform"`
  13. TaskState int `form:"task_state"`
  14. Sortby string `form:"sort"`
  15. PageNo int `form:"page_no"`
  16. PageSize int `form:"page_size"`
  17. })
  18. err := c.Bind(v)
  19. if err != nil {
  20. c.JSON(nil, ecode.RequestErr)
  21. return
  22. }
  23. logs, count, err := svc.QueryTaskLog(c, v.MID, v.TaskID, v.Platform, v.TaskState, v.Sortby, v.PageNo, v.PageSize)
  24. if err != nil {
  25. log.Error("svc.QueryTaskLog() error(%v)", err)
  26. c.JSON(nil, err)
  27. return
  28. }
  29. pager := &model.TaskLogPager{
  30. PageNo: v.PageNo,
  31. PageSize: v.PageSize,
  32. Items: logs,
  33. Total: count,
  34. }
  35. c.JSON(pager, nil)
  36. }