12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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 WrapShutDownSubAccountHandler(ctx *gin.Context) {
- handler := newShutDownSubAccountHandler(ctx)
- baseRun(handler)
- }
- func newShutDownSubAccountHandler(ctx *gin.Context) *ShutDownSubAccountHandler {
- return &ShutDownSubAccountHandler{
- req: http_model.NewShutDownSubAccountRequest(),
- resp: http_model.NewShutDownSubAccountResponse(),
- ctx: ctx,
- }
- }
- type ShutDownSubAccountHandler struct {
- req *http_model.ShutDownSubAccountRequest
- resp *http_model.CommonResponse
- ctx *gin.Context
- }
- func (h *ShutDownSubAccountHandler) getRequest() interface{} {
- return h.req
- }
- func (h *ShutDownSubAccountHandler) getContext() *gin.Context {
- return h.ctx
- }
- func (h *ShutDownSubAccountHandler) getResponse() interface{} {
- return h.resp
- }
- func (h *ShutDownSubAccountHandler) run() {
- err := service.SubAccount.ShutDownSubAccount(h.ctx, *h.req)
- if err != nil {
- logrus.Errorf("[FindSubAccountBySupplierId] call SetSession err:%+v\n", err)
- util.HandlerPackErrorResp(h.resp, consts.ErrorInternal, err.Error())
- log.Info("FindSubAccountBySupplierId fail,req:%+v", h.req)
- h.resp.Message = err.Error()
- h.resp.Status = 40000
- return
- }
- h.resp.Data = nil
- h.resp.Status = 20000
- h.resp.Message = "ok"
- }
- func (h *ShutDownSubAccountHandler) checkParam() error {
- return nil
- }
|