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 WrapLocalAcceptSketchHandler(ctx *gin.Context) { handler := newLocalAcceptSketchHandler(ctx) baseRun(handler) } func newLocalAcceptSketchHandler(ctx *gin.Context) *LocalAcceptSketchHandler { return &LocalAcceptSketchHandler{ req: http_model.NewLocalAcceptSketchRequest(), resp: http_model.NewLocalAcceptSketchResponse(), ctx: ctx, } } type LocalAcceptSketchHandler struct { req *http_model.LocalAcceptSketchRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *LocalAcceptSketchHandler) getRequest() interface{} { return h.req } func (h *LocalAcceptSketchHandler) getContext() *gin.Context { return h.ctx } func (h *LocalAcceptSketchHandler) getResponse() interface{} { return h.resp } func (h *LocalAcceptSketchHandler) run() { data := http_model.LocalAcceptSketchRequest{} data = *h.req res, err := service.Sketch.LocalAcceptSketch(h.ctx, data) if err != nil { logrus.Errorf("[ReviseOpinionHandler] 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 *LocalAcceptSketchHandler) checkParam() error { return nil }