package handler import ( "youngee_b_api/consts" "youngee_b_api/model/http_model" "youngee_b_api/service" "youngee_b_api/util" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" ) func WrapLocalLinkOpinionHandler(ctx *gin.Context) { handler := newLocalLinkOpinionHandler(ctx) baseRun(handler) } func newLocalLinkOpinionHandler(ctx *gin.Context) *LocalLinkOpinionHandler { return &LocalLinkOpinionHandler{ req: http_model.NewLocalLinkOpinionRequest(), resp: http_model.NewLocalLinkOpinionResponse(), ctx: ctx, } } type LocalLinkOpinionHandler struct { req *http_model.LocalLinkOpinionRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *LocalLinkOpinionHandler) getRequest() interface{} { return h.req } func (h *LocalLinkOpinionHandler) getContext() *gin.Context { return h.ctx } func (h *LocalLinkOpinionHandler) getResponse() interface{} { return h.resp } func (h *LocalLinkOpinionHandler) run() { data := http_model.LocalLinkOpinionRequest{} data = *h.req res, err := service.Link.LocalLinkOpinion(h.ctx, data) if err != nil { logrus.Errorf("[LocalLinkOpinionHandler] 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 *LocalLinkOpinionHandler) checkParam() error { return nil }