get_sketch_info_by_taskid.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package operate
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "github.com/sirupsen/logrus"
  5. "youngee_m_api/consts"
  6. "youngee_m_api/db"
  7. "youngee_m_api/model/http_model"
  8. "youngee_m_api/util"
  9. )
  10. func WrapGetSketchInfoByTaskIdHandler(ctx *gin.Context) {
  11. handler := newGetSketchInfoByTaskId(ctx)
  12. BaseRun(handler)
  13. }
  14. type GetSketchInfoByTaskId struct {
  15. ctx *gin.Context
  16. req *http_model.GetSketchInfoByTaskIdRequest
  17. resp *http_model.CommonResponse
  18. }
  19. func (g GetSketchInfoByTaskId) getContext() *gin.Context {
  20. return g.ctx
  21. }
  22. func (g GetSketchInfoByTaskId) getResponse() interface{} {
  23. return g.resp
  24. }
  25. func (g GetSketchInfoByTaskId) getRequest() interface{} {
  26. return g.req
  27. }
  28. func (g GetSketchInfoByTaskId) run() {
  29. data, err := db.GetSketchInfoByTaskId(g.ctx, g.req)
  30. if err != nil {
  31. logrus.WithContext(g.ctx).Errorf("[caseCloseDefaultHandler] error AutoCaseCloseDefault, err:%+v", err)
  32. util.HandlerPackErrorResp(g.resp, consts.ErrorInternal, consts.DefaultToast)
  33. return
  34. }
  35. g.resp.Data = data
  36. }
  37. func (g GetSketchInfoByTaskId) checkParam() error {
  38. return nil
  39. }
  40. func newGetSketchInfoByTaskId(ctx *gin.Context) *GetSketchInfoByTaskId {
  41. return &GetSketchInfoByTaskId{
  42. ctx: ctx,
  43. req: http_model.NewGetSketchInfoByTaskIdRequest(),
  44. resp: http_model.NewGetSketchInfoByTaskIdResponse(),
  45. }
  46. }