diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index 61798353..d57dbecc 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -326,6 +326,9 @@ func Init(r *gin.Engine) { vasPayGroup.POST("moment_order_list", middleware.JSONParamValidator(vasproto.ZoneMomentOrderListReq{}), middleware.JwtAuthenticator(), ZoneMomentOrderList) vasPayGroup.POST("income_page", middleware.JSONParamValidator(vasproto.IncomePageReq{}), middleware.JwtAuthenticator(), IncomePage) + outerVasGroup := r.Group("/outer/vas") + outerVasGroup.POST("create_order", middleware.JSONParamValidator(vasproto.CreateOrderReq{}), CreateOrderOuter) + extVasPayGroup := r.Group("/ext/vas") extVasPayGroup.POST("alipay_callback", AlipayCallback) extVasPayGroup.POST("wxpay_callback", WxpayCallback) diff --git a/app/mix/controller/vas.go b/app/mix/controller/vas.go index 7bb14ca9..a05d8a2b 100644 --- a/app/mix/controller/vas.go +++ b/app/mix/controller/vas.go @@ -109,6 +109,36 @@ func CreateOrderWxPub(ctx *gin.Context) { ReplyOk(ctx, data) } +func CreateOrderOuter(ctx *gin.Context) { + req := ctx.MustGet("client_req").(*vasproto.CreateOrderReq) + if req.From != dbstruct.VasCoinOrderFromOuterRaven { + logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) + ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) + return + } + if req.PayType != vasproto.PayTypeAlipayH5 || len(req.ProductId) <= 0 { + logger.Error("CreateOrder, invalid param, req: %v", util.ToJson(req)) + ReplyErrCodeMsg(ctx, errcode.ErrCodeBadParam) + return + } + if len(req.Model) >= 28 { + req.Model = req.Model[:28] + } + req.Mid = 100000001 + + data, ec, err := service.DefaultService.CreateOrder(ctx, req) + if ec != errcode.ErrCodeVasSrvOk { + logger.Error("CreateOrder 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) +} + // op充值 func OpCreateOrder(ctx *gin.Context) { req := ctx.MustGet("client_req").(*vasproto.OpCreateOrderReq) diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 900a03da..d8d0e8f7 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -130,7 +130,6 @@ type CreateOrderProxy struct { } func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data *vasproto.CreateOrderData, err error) { - _, err = v.createOrderProxy.PreProc(ctx, req) if err != nil { return diff --git a/dbstruct/product.go b/dbstruct/product.go index b94705e0..be928da7 100644 --- a/dbstruct/product.go +++ b/dbstruct/product.go @@ -38,6 +38,8 @@ const ( ProductIdH5ZoneAdmission = "h5_zone_admission" // 空间普通会员 ProductIdH5ZoneIronfanship = "h5_zone_ironfanship" // 空间铁粉 ProductIdH5ZoneSuperfanship = "h5_zone_superfanship" // 空间超粉 + + ProductIdOuterRaven = "outer_raven" // 瑞文测试 ) var ProductIdDescMap = map[string]string{ diff --git a/dbstruct/vas_mysql.go b/dbstruct/vas_mysql.go index a3132d26..154ba856 100644 --- a/dbstruct/vas_mysql.go +++ b/dbstruct/vas_mysql.go @@ -323,10 +323,11 @@ var CoinOrderStatusDescMap = map[int32]string{ } const ( - VasCoinOrderFromApp = "app" // app应用内 - VasCoinOrderFromH5 = "h5" // h5 - VasCoinOrderFromOp = "op" // op - VasCoinOrderFromWxPub = "wx_pub" // 微信小程序 + VasCoinOrderFromApp = "app" // app应用内 + VasCoinOrderFromH5 = "h5" // h5 + VasCoinOrderFromOp = "op" // op + VasCoinOrderFromWxPub = "wx_pub" // 微信小程序 + VasCoinOrderFromOuterRaven = "outer_raven" // 瑞文测试 ) type CoinOrder struct {