京东商城商品创建更新id测试

This commit is contained in:
苏尹岚
2020-05-13 10:27:03 +08:00
parent 5f901f8531
commit 7fcb6e536e
3 changed files with 43 additions and 18 deletions

View File

@@ -236,7 +236,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
Seq: inSku.Seq,
JxPrice: inSku.Price,
JxUnitPrice: inSku.UnitPrice,
VendorSkuID2: utils.Int2Str(inSku.JdsWareID),
VendorSkuID2: utils.Int64ToStr(inSku.JdsWareID),
}
if !isStoreSkuSyncNeedDelete(inSku) {
outSku.Stock = model.MaxStoreSkuStockQty
@@ -334,26 +334,31 @@ func updateStoreSku(db *dao.DaoDB, vendorID int, storeSkuList []*dao.StoreSkuSyn
// panic(r)
// }
// }()
updateItemList := make([]*dao.KVUpdateItem, len(storeSkuList))
for k, v := range storeSkuList {
updateItemList[k] = sku2Update(vendorID, v, syncStatus)
}
num, err = dao.BatchUpdateEntityByKV(db, updateItemList)
if vendorID == model.VendorIDYB {
err = updateYbOhterSku(db, storeSkuList)
}
if vendorID == model.VendorIDJDShop {
err = updateJdsWareID(db, storeSkuList)
for _, v := range storeSkuList {
updateItemList := make([]*dao.KVUpdateItem, len(storeSkuList))
for k, vv := range v.StoreSkuSyncInfoJds {
updateItemList[k] = sku2Update(vendorID, vv, syncStatus)
err = updateJdsWareID(db, vv)
}
num, err = dao.BatchUpdateEntityByKV(db, updateItemList)
}
} else {
updateItemList := make([]*dao.KVUpdateItem, len(storeSkuList))
for k, v := range storeSkuList {
updateItemList[k] = sku2Update(vendorID, v, syncStatus)
}
num, err = dao.BatchUpdateEntityByKV(db, updateItemList)
if vendorID == model.VendorIDYB {
err = updateYbOhterSku(db, storeSkuList)
}
}
}
return num, err
}
func updateJdsWareID(db *dao.DaoDB, storeSkuList []*dao.StoreSkuSyncInfo) (err error) {
for _, v := range storeSkuList {
err = dao.UpdateJdsWareID(db, v)
}
return err
func updateJdsWareID(db *dao.DaoDB, storeSku *dao.StoreSkuSyncInfo) (err error) {
return dao.UpdateJdsWareID(db, storeSku)
}
func updateYbOhterSku(db *dao.DaoDB, storeSkuList []*dao.StoreSkuSyncInfo) (err error) {