package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/service" "youngee_b_api/util" ) func WrapLocalSketchOpinionHandler(ctx *gin.Context) { handler := newLocalSketchOpinionHandler(ctx) baseRun(handler) } func newLocalSketchOpinionHandler(ctx *gin.Context) *LocalSketchOpinionHandler { return &LocalSketchOpinionHandler{ req: http_model.NewLocalSketchOpinionRequest(), resp: http_model.NewLocalSketchOpinionResponse(), ctx: ctx, } } type LocalSketchOpinionHandler struct { req *http_model.LocalSketchOpinionRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *LocalSketchOpinionHandler) getRequest() interface{} { return h.req } func (h *LocalSketchOpinionHandler) getContext() *gin.Context { return h.ctx } func (h *LocalSketchOpinionHandler) getResponse() interface{} { return h.resp } func (h *LocalSketchOpinionHandler) run() { data := http_model.LocalSketchOpinionRequest{} data = *h.req res, err := service.Sketch.LocalSketchOption(h.ctx, data) if err != nil { logrus.Errorf("[LocalSketchOpinionHandler] call Create err:%+v\n", err) util.HandlerPackErrorResp(h.resp, consts.ErrorParamCheck, "") log.Info("CreateProject fail,req:%+v", h.req) return } h.resp.Message = "提交初稿修改意见成功" h.resp.Data = res h.resp.Status = consts.ErrorSuccess } func (h *LocalSketchOpinionHandler) checkParam() error { return nil }