Merge branch 'jdshop' of e.coding.net:rosydev/jx-callback into jdshop
This commit is contained in:
@@ -3,7 +3,6 @@ package localjx
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok"
|
||||
"math"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -326,15 +325,15 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||
}
|
||||
case model.PayTypeTL:
|
||||
if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
||||
subAppID = model.JXC4AppId // 京西商城
|
||||
}
|
||||
//if subAppID == tiktok.TiktokAppId || subAppID == tiktok.TiktokJXDJAppID {
|
||||
// subAppID = model.JXC4AppId // 京西商城
|
||||
//}
|
||||
if orderPay, err = pay4OrderByTL(ctx, order, payType, vendorPayType, subAppID); err == nil && orderPay != nil {
|
||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||
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)
|
||||
}
|
||||
@@ -1017,7 +1016,11 @@ func generateOrder(ctx *jxcontext.Context, jxOrder *JxOrderInfo, addressID int64
|
||||
// 订单超过一千配送费优惠(门店运费)
|
||||
discountPrice, err := cms.GetStoreVendorMaps(ctx, nil, jxOrder.StoreID, -1)
|
||||
if len(discountPrice) == 1 && outJxOrder.OrderPrice >= int64(discountPrice[0].DeliveryFeeDeductionSill) {
|
||||
outJxOrder.FreightPrice = outJxOrder.FreightPrice - int64(discountPrice[0].DeliveryFeeDeductionFee)
|
||||
if outJxOrder.FreightPrice-int64(discountPrice[0].DeliveryFeeDeductionFee) >= 0 {
|
||||
outJxOrder.FreightPrice = outJxOrder.FreightPrice - int64(discountPrice[0].DeliveryFeeDeductionFee)
|
||||
} else {
|
||||
outJxOrder.FreightPrice = 0
|
||||
}
|
||||
}
|
||||
// ?????????????????????? 测试
|
||||
if storeDetail.ID == 668470 || storeDetail.ID == 668469 {
|
||||
@@ -1553,6 +1556,7 @@ func changeOrderStatus(vendorOrderID string, status int, remark string) (err err
|
||||
StatusTime: time.Now(),
|
||||
Remark: remark,
|
||||
}
|
||||
globals.SugarLogger.Debug("检测数据orderStatus.Status", status, orderStatus.Status)
|
||||
jxutils.CallMsgHandlerAsync(func() {
|
||||
err = partner.CurOrderManager.OnOrderStatusChanged("", orderStatus)
|
||||
}, jxutils.ComposeUniversalOrderID(vendorOrderID, model.VendorIDJX))
|
||||
|
||||
@@ -17,8 +17,8 @@ func init() {
|
||||
func TestGenOrderNo(t *testing.T) {
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
|
||||
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539,0).Format("20060102150405"), loc)
|
||||
fmt.Println("t1",t1)
|
||||
t1, _ := time.ParseInLocation("20060102150405", time.Unix(1654510539, 0).Format("20060102150405"), loc)
|
||||
fmt.Println("t1", t1)
|
||||
}
|
||||
|
||||
func TestGetAvailableDeliverTime(t *testing.T) {
|
||||
@@ -28,3 +28,7 @@ func TestGetAvailableDeliverTime(t *testing.T) {
|
||||
}
|
||||
t.Log(utils.Format4Output(timeInfo, false))
|
||||
}
|
||||
func TestChangeStatus(t *testing.T) {
|
||||
err := changeOrderStatus("88398619646640", 115, "")
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
@@ -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,14 +29,18 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
CpExtra: "msg",
|
||||
NotifyURL: globals.TictokpayNotifyURL,
|
||||
}
|
||||
|
||||
ttOrderId, orderToken, err := api.TiktokApi.CreateOrderByTicktock(param)
|
||||
if subAppID == tiktok.TiktokJXDJAppID {
|
||||
param.AppID = api.TiktokJXDJApi.GetAppID()
|
||||
} else {
|
||||
param.AppID = api.TiktokApi.GetAppID()
|
||||
}
|
||||
globals.SugarLogger.Debug("打印param", param)
|
||||
ttOrderId, orderToken, err := getTikTok(subAppID).CreateOrderByTicktock(param)
|
||||
if err == nil {
|
||||
orderPay = &model.OrderPay{
|
||||
PayOrderID: ttOrderId, // 抖音订单id
|
||||
PayType: model.PayTypeTicTok,
|
||||
VendorPayType: vendorPayType,
|
||||
|
||||
VendorOrderID: order.VendorOrderID,
|
||||
VendorID: order.VendorID,
|
||||
Status: 0,
|
||||
@@ -48,7 +52,14 @@ func pay4OrderByTT(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayTyp
|
||||
}
|
||||
return orderPay, err
|
||||
}
|
||||
|
||||
func getTikTok(appID string) (TikTokMini *tiktok.API) {
|
||||
TikTokMini = api.TiktokApi
|
||||
if len(appID) > 0 && appID == api.TiktokJXDJApiID {
|
||||
TikTokMini = api.TiktokJXDJApi
|
||||
}
|
||||
globals.SugarLogger.Debug("输出TikTokMini", TikTokMini)
|
||||
return TikTokMini
|
||||
}
|
||||
func OnTTPayCallback(msg *tiktok.DetailCallBackMessage, refund *tiktok.DetailCallBackMessage2Refund, payType string) (err error) {
|
||||
globals.SugarLogger.Debugf("OnTTPayCallback msg:%s", utils.Format4Output(msg, true))
|
||||
switch payType {
|
||||
|
||||
Reference in New Issue
Block a user