package handler import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "youngee_m_api/consts" "youngee_m_api/db" "youngee_m_api/model/http_model" "youngee_m_api/util" ) func WrapStopSubAccountHandler(ctx *gin.Context) { handler := newStopSubAccount(ctx) BaseRun(handler) } type StopSubAccountHandler struct { ctx *gin.Context req *http_model.StopSubAccountRequest resp *http_model.CommonResponse } func (s StopSubAccountHandler) getContext() *gin.Context { return s.ctx } func (s StopSubAccountHandler) getResponse() interface{} { return s.resp } func (s StopSubAccountHandler) getRequest() interface{} { return s.req } func (s StopSubAccountHandler) run() { data := http_model.StopSubAccountRequest{} data = *s.req res, err := db.StopSubAccount(s.ctx, &data) if err != nil { logrus.Errorf("[StopSubAccountHandler] call StopSubAccount err:%+v\n", err) util.HandlerPackErrorResp(s.resp, consts.ErrorInternal, "") logrus.Info("StopSubAccountHandler fail,req:%+v", s.req) return } s.resp.Message = "成功停用岗位" s.resp.Data = res } func (s StopSubAccountHandler) checkParam() error { return nil } func newStopSubAccount(ctx *gin.Context) *StopSubAccountHandler { return &StopSubAccountHandler{ ctx: ctx, req: http_model.NewStopSubAccountRequest(), resp: http_model.NewStopSubAccountResponse(), } }