package controller import ( "github.com/gin-gonic/gin" "service/api/errcode" vasproto "service/api/proto/vas/proto" "service/app/mix/service" "service/bizcommon/util" "service/library/logger" ) func ZoneCreateOrder(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.ZoneCreateOrderReq) if !req.IsValid() || len(req.PayType) <= 0 || len(req.ProductId) <= 0 { logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) return } data, ec, err := service.DefaultService.ZoneCreateOrder(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneCreateOrder fail, req: %v, ec: %v", util.ToJson(req), ec) if ec == errcode.ErrCodeVasSrvFail && err != nil { ReplyErrorMsg(ctx, err.Error()) return } ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, data) } func ZoneGetCashier(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.ZoneGetCashierReq) if len(req.ProductId) <= 0 { logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) return } data, ec, err := service.DefaultService.ZoneGetCashier(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneGetCashier fail, req: %v, ec: %v", util.ToJson(req), ec) if ec == errcode.ErrCodeVasSrvFail && err != nil { ReplyErrorMsg(ctx, err.Error()) return } ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, data) } func ZoneRefundPage(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.ZoneRefundPageReq) name, price, ec, err := service.DefaultService.ZoneGetRefundPage(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneGetRefundPage fail, req: %v, ec: %v", util.ToJson(req), ec) if ec == errcode.ErrCodeVasSrvFail && err != nil { ReplyErrorMsg(ctx, err.Error()) return } ReplyErrCodeMsg(ctx, ec) return } data := &vasproto.ZoneRefundPageData{ Price: price, Name: name, } ReplyOk(ctx, data) } func ZoneRefund(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.ZoneRefundReq) if req.Mid <= 0 { logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) return } ec, err := service.DefaultService.ZoneRefund(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneRefund fail, req: %v, ec: %v", util.ToJson(req), ec) if ec == errcode.ErrCodeVasSrvFail && err != nil { ReplyErrorMsg(ctx, err.Error()) return } ReplyErrCodeMsg(ctx, ec) return } ReplyOk(ctx, nil) } func ZoneMemberList(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.GetZoneMemberListReq) if req.Mid <= 0 { logger.Error("ZoneMemberList, invalid param, req: %v", util.ToJson(req)) ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) return } list, ec, err := service.DefaultService.ZoneMemberList(ctx, req) if ec != errcode.ErrCodeVasSrvOk { logger.Error("ZoneMemberList fail, req: %v, ec: %v", util.ToJson(req), ec) if ec == errcode.ErrCodeVasSrvFail && err != nil { ReplyErrorMsg(ctx, err.Error()) return } ReplyErrCodeMsg(ctx, ec) return } data := &vasproto.GetZoneMemberListData{ List: list, } ReplyOk(ctx, data) }