This commit is contained in:
苏尹岚
2021-03-02 10:38:09 +08:00
parent dd1e4d9c23
commit 29ab696bfd
4 changed files with 13 additions and 10 deletions

View File

@@ -306,7 +306,7 @@ func BuyerCancelOrder(ctx *jxcontext.Context, orderID int64, reason string) (can
return canceled, err
}
func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
var (
db = dao.GetDB()
)
@@ -319,7 +319,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
err = dao.CreateEntity(dao.GetDB(), orderPay)
}
case model.PayTypeTL:
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil {
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
err = dao.CreateEntity(dao.GetDB(), orderPay)
}
@@ -336,7 +336,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
ActualPayPrice: priceDefendOrders[0].ActualPayPrice,
VendorID: model.VendorIDJX,
}
if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType); err == nil && orderPay != nil {
if orderPay, err = pay4OrderByTL(ctx, order2, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
err = dao.CreateEntity(dao.GetDB(), orderPay)
}
@@ -344,7 +344,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
return orderPay, err
}
func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
var (
db = dao.GetDB()
order *model.GoodsOrder
@@ -368,7 +368,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType
ActualPayPrice: int64(discountCard.Price),
VendorID: model.VendorIDJX,
}
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil {
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
err = dao.CreateEntity(dao.GetDB(), orderPay)
}
@@ -398,7 +398,7 @@ func Pay4User(ctx *jxcontext.Context, thingID int, vendorOrderID string, payType
ActualPayPrice: int64(storeOrder.ActualPayPrice),
VendorID: model.VendorIDJX,
}
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType); err == nil && orderPay != nil {
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
err = dao.CreateEntity(dao.GetDB(), orderPay)
}

View File

@@ -18,7 +18,7 @@ import (
"git.rosy.net.cn/jx-callback/globals/api"
)
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType string) (orderPay *model.OrderPay, err error) {
func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
// if order.FromStoreID != 0 {
// result, _ := orderman.GetMatterStoreOrderCount(nil, order.FromStoreID)
// if !result.Flag {
@@ -31,6 +31,7 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
NotifyUrl: globals.TLPayNotifyURL,
Reqsn: order.VendorOrderID,
PayType: vendorPayType,
SubAppID: subAppID,
}
//暂时做兼容处理
if vendorPayType == "JSAPI" {

View File

@@ -40,6 +40,7 @@ func (c *JxOrderController) CreateOrder() {
// @Title 请求支付京西商城订单
// @Description 请求支付京西商城订单
// @Param token header string true "认证token"
// @Param subAppID formData string true "appID"
// @Param vendorOrderID formData string true "订单ID"
// @Param payType formData int true "支付类型"
// @Param vendorPayType formData string true "平台支付类型"
@@ -48,7 +49,7 @@ func (c *JxOrderController) CreateOrder() {
// @router /Pay4Order [post]
func (c *JxOrderController) Pay4Order() {
c.callPay4Order(func(params *tJxorderPay4OrderParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.Pay4Order(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.PayType, params.VendorPayType)
retVal, err = localjx.Pay4Order(params.Ctx, utils.Str2Int64(params.VendorOrderID), params.PayType, params.VendorPayType, params.SubAppID)
return retVal, "", err
})
}
@@ -57,6 +58,7 @@ func (c *JxOrderController) Pay4Order() {
// @Description 请求支付京西商城相关用户支付项目
// @Param token header string true "认证token"
// @Param thingID formData int fasle "项目ID"
// @Param subAppID formData string true "appID"
// @Param vendorOrderID formData string fasle "订单ID"
// @Param payType formData int true "支付类型"
// @Param vendorPayType formData string true "平台支付类型"
@@ -65,7 +67,7 @@ func (c *JxOrderController) Pay4Order() {
// @router /Pay4User [post]
func (c *JxOrderController) Pay4User() {
c.callPay4User(func(params *tJxorderPay4UserParams) (retVal interface{}, errCode string, err error) {
retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType)
retVal, err = localjx.Pay4User(params.Ctx, params.ThingID, params.VendorOrderID, params.PayType, params.VendorPayType, params.SubAppID)
return retVal, "", err
})
}

View File

@@ -250,7 +250,7 @@ func Init() {
}
if globals.TLPayNotifyURL != "" {
TLpayAPI = tonglianpayapi.New(beego.AppConfig.String("tonglianPayAppID"), beego.AppConfig.String("tonglianPayKey"), beego.AppConfig.String("tonglianPayCusID"), beego.AppConfig.String("wxpayAppID"))
TLpayAPI = tonglianpayapi.New(beego.AppConfig.String("tonglianPayAppID"), beego.AppConfig.String("tonglianPayKey"), beego.AppConfig.String("tonglianPayCusID"))
}
AutonaviAPI = autonavi.New(beego.AppConfig.String("autonaviKey"))
BaiDuNaviAPI = baidunavi.New(beego.AppConfig.String("baidunaviAK"), beego.AppConfig.String("baidunaviSK"))