show_task_progress.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package handler
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_b_api/consts"
  6. "youngee_b_api/model/http_model"
  7. "youngee_b_api/service"
  8. "youngee_b_api/util"
  9. )
  10. func WrapShowTaskProgressHandler(ctx *gin.Context) {
  11. handler := newShowTaskProgressHandler(ctx)
  12. baseRun(handler)
  13. }
  14. func newShowTaskProgressHandler(ctx *gin.Context) *ShowTaskProgressHandler {
  15. return &ShowTaskProgressHandler{
  16. req: http_model.NewShowTaskProgressRequest(),
  17. resp: http_model.NewShowTaskProgressResponse(),
  18. ctx: ctx,
  19. }
  20. }
  21. type ShowTaskProgressHandler struct {
  22. req *http_model.ShowTaskProgressRequest
  23. resp *http_model.CommonResponse
  24. ctx *gin.Context
  25. }
  26. func (h *ShowTaskProgressHandler) getRequest() interface{} {
  27. return h.req
  28. }
  29. func (h *ShowTaskProgressHandler) getContext() *gin.Context {
  30. return h.ctx
  31. }
  32. func (h *ShowTaskProgressHandler) getResponse() interface{} {
  33. return h.resp
  34. }
  35. func (h *ShowTaskProgressHandler) run() {
  36. // fmt.Println("ShowTaskProgressHandler: ")
  37. data, err := service.Project.ShowTaskProgress(h.ctx, *h.req)
  38. if err != nil {
  39. logrus.WithContext(h.ctx).Errorf("[ProjectTaskListHandler] error GetProjectTaskList, err:%+v", err)
  40. util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, consts.DefaultToast)
  41. return
  42. }
  43. h.resp.Data = data
  44. }
  45. func (h *ShowTaskProgressHandler) checkParam() error {
  46. return nil
  47. }