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 WrapFindStoreHandler(ctx *gin.Context) { handler := newFindStoreHandler(ctx) baseRun(handler) } func newFindStoreHandler(ctx *gin.Context) *FindStoreHandler { return &FindStoreHandler{ req: http_model.NewFindStoreRequest(), resp: http_model.NewFindStoreResponse(), ctx: ctx, } } type FindStoreHandler struct { req *http_model.FindStoreRequest resp *http_model.CommonResponse ctx *gin.Context } func (h *FindStoreHandler) getRequest() interface{} { return h.req } func (h *FindStoreHandler) getContext() *gin.Context { return h.ctx } func (h *FindStoreHandler) getResponse() interface{} { return h.resp } func (h *FindStoreHandler) run() { res, err := service.LocalLife.GetStoreInfo(h.ctx, h.req) if err != nil { // 数据库查询失败,返回5001 logrus.Errorf("[FindStoreHandler] call FindByID err:%+v\n", err) util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, "") log.Info("FindStore fail,req:%+v", h.req) return } h.resp.Data = res } func (h *FindStoreHandler) checkParam() error { return nil }