This commit is contained in:
苏尹岚
2021-03-02 10:55:36 +08:00
12 changed files with 123 additions and 44 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,13 +31,14 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
NotifyUrl: globals.TLPayNotifyURL,
Reqsn: order.VendorOrderID,
PayType: vendorPayType,
SubAppID: subAppID,
}
//暂时做兼容处理
if vendorPayType == "JSAPI" {
param.PayType = tonglianpayapi.PayTypeWxXcx
}
if vendorPayType == tonglianpayapi.PayTypeWxXcx {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini {
if authInfo, err := ctx.GetV2AuthInfo(); err == nil && authInfo.GetAuthType() == weixin.AuthTypeMini && authInfo.GetAuthTypeID() == subAppID {
param.Acct = authInfo.GetAuthID()
}
}