tl 支付兼容

This commit is contained in:
richboo111
2022-08-19 14:24:34 +08:00
parent 389e35399e
commit dd9a0740c8
2 changed files with 12 additions and 4 deletions

View File

@@ -334,7 +334,7 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
err = dao.CreateEntity(dao.GetDB(), orderPay)
}
case model.PayTypeTicTok:
if orderPay, err = pay4OrderByTT(ctx, order, vendorPayType); err == nil && orderPay != nil {
if orderPay, err = pay4OrderByTT(ctx, order, vendorPayType, subAppID); err == nil && orderPay != nil {
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
err = dao.CreateEntity(dao.GetDB(), orderPay)
}

View File

@@ -18,9 +18,9 @@ func getOrderBriefTt(order *model.GoodsOrder) string {
return fmt.Sprintf("%s等共%d件商品", order.Skus[0].SkuName, order.GoodsCount)
}
func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType string) (orderPay *model.OrderPay, err error) {
func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType, subAppID string) (orderPay *model.OrderPay, err error) {
param := &tiktok.TickTokCreateOrder{
AppID: api.TiktokApi.GetAppID(),
//AppID: api.TiktokApi.GetAppID(),
OutOrderNo: utils.Int64ToStr(GenPayOrderID(order)),
TotalAmount: int(order.ActualPayPrice),
Subject: "蔬菜水果日用品",
@@ -29,7 +29,15 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
CpExtra: "msg",
NotifyURL: globals.TictokpayNotifyURL,
}
if subAppID == tiktok.TiktokJXDJAppID {
param = &tiktok.TickTokCreateOrder{
AppID: api.TiktokJXDJApi.GetAppID(),
}
} else {
param = &tiktok.TickTokCreateOrder{
AppID: api.TiktokApi.GetAppID(),
}
}
ttOrderId, orderToken, err := api.TiktokApi.CreateOrderByTicktock(param)
if err == nil {
orderPay = &model.OrderPay{