京东商城同步测试

This commit is contained in:
苏尹岚
2020-06-08 17:37:40 +08:00
parent f70dc4fceb
commit 0b5341314b
2 changed files with 21 additions and 20 deletions

View File

@@ -1105,12 +1105,12 @@ func (v *VendorSync) SyncJdsStoresSkus(ctx *jxcontext.Context, storeIDs []int, i
func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch.ITask, storeMap *model.StoreMap, isAsync, isContinueWhenError bool) (err error) {
var (
mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo)
skusMap = make(map[int][]*dao.StoreSkuSyncInfo)
updateList []*dao.StoreSkuSyncInfo
addList []*dao.StoreSkuSyncInfo
// skuBindInfos1 []*StoreSkuBindInfo
// skuBindInfos2 []*StoreSkuBindInfo
mainSkusMap = make(map[int][]*dao.StoreSkuSyncInfo)
skusMap = make(map[int][]*dao.StoreSkuSyncInfo)
updateList []*dao.StoreSkuSyncInfo
addList []*dao.StoreSkuSyncInfo
skuBindInfos1 []*StoreSkuBindInfo
skuBindInfos2 []*StoreSkuBindInfo
)
storeSkusMain, err := dao.GetStoreSkusByNameIDs(db, []int{model.JdShopMainStoreID}, 0)
for _, v := range storeSkusMain {
@@ -1149,21 +1149,21 @@ func syncJdsStoresSkus(ctx *jxcontext.Context, db *dao.DaoDB, parentTask tasksch
}
}
}
fmt.Println("updateList", utils.Format4Output(updateList, false))
fmt.Println("addList", utils.Format4Output(addList, false))
// if len(updateList) > 0 {
// for _, v := range updateList {
// skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false))
// }
// _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false)
// }
// fmt.Println("updateList", utils.Format4Output(updateList, false))
// fmt.Println("addList", utils.Format4Output(addList, false))
if len(updateList) > 0 {
for _, v := range updateList {
skuBindInfos1 = append(skuBindInfos1, buildStoreSkuBindInfo(db, storeMap.StoreID, v, false))
}
_, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos1, isAsync, isContinueWhenError, false)
}
// if len(addList) > 0 {
// for _, v := range addList {
// skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true))
// }
// _, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false)
// }
if len(addList) > 0 {
for _, v := range addList {
skuBindInfos2 = append(skuBindInfos2, buildStoreSkuBindInfo(db, storeMap.StoreID, v, true))
}
_, err = UpdateStoresSkusByBind(ctx, parentTask, skuBindInfos2, isAsync, isContinueWhenError, false)
}
return err
}

View File

@@ -134,6 +134,7 @@ func (p *PurchaseHandler) GetOrder4PartRefund(vendorOrderID string) (order *mode
order.DiscountMoney = discountMoney
order.Skus = append(order.Skus, giftSkus...)
order.ActualPayPrice = utils.MustInterface2Int64(result2["user_fee"])
order.TotalShopMoney = utils.MustInterface2Int64(result2["shop_fee"])
jxutils.RefreshOrderSkuRelated(order)
} else if err2Ext, ok := err2.(*utils.ErrorWithCode); !ok || err2Ext.IntCode() != ebaiapi.ErrOrderIsNotPartRefund {
err = err2