jds2
This commit is contained in:
@@ -445,6 +445,17 @@ func (p *PurchaseHandler) GetStoreSkusFullInfo(ctx *jxcontext.Context, parentTas
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
func getMainStoreVendorSkuID(mainStoreID int, skuID int) (vendorSkuID int64, err error) {
|
||||
var (
|
||||
db = dao.GetDB()
|
||||
)
|
||||
storeSkus, err := dao.GetStoresSkusInfo(db, []int{mainStoreID}, []int{skuID})
|
||||
if len(storeSkus) > 0 {
|
||||
vendorSkuID = storeSkus[0].JdsID
|
||||
}
|
||||
return vendorSkuID, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo, status int) (failedList []*partner.StoreSkuInfoWithErr, err error) {
|
||||
if globals.EnableJdShopWrite {
|
||||
var stock = 0
|
||||
@@ -472,7 +483,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStatus(ctx *jxcontext.Context, vendorOr
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = api.JdShop2API.StoreWareDoUpdate(status, utils.Str2Int64(v.VendorSkuID), vendorStoreID)
|
||||
if vendorSkuID, err := getMainStoreVendorSkuID(model.JdShopMainStoreID2, v.SkuID); err == nil {
|
||||
err = api.JdShop2API.StoreWareDoUpdate(status, vendorSkuID, vendorStoreID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,7 +507,9 @@ func (p *PurchaseHandler) UpdateStoreSkusPrice(ctx *jxcontext.Context, vendorOrg
|
||||
if v.VendorOrgCode == "1" {
|
||||
// null
|
||||
} else {
|
||||
err = api.JdShop2API.StoreUpdatePrice(utils.Float64TwoInt(jxutils.IntPrice2Standard(v.VendorPrice)), utils.Str2Int64(v.VendorSkuID), vendorStoreID)
|
||||
if vendorSkuID, err := getMainStoreVendorSkuID(model.JdShopMainStoreID2, v.SkuID); err == nil {
|
||||
err = api.JdShop2API.StoreUpdatePrice(utils.Float64TwoInt(jxutils.IntPrice2Standard(v.VendorPrice)), vendorSkuID, vendorStoreID)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
@@ -513,7 +528,9 @@ func (p *PurchaseHandler) UpdateStoreSkusStock(ctx *jxcontext.Context, vendorOrg
|
||||
} else if storeID == model.JdShopMainStoreID2 {
|
||||
|
||||
} else {
|
||||
err = api.JdShop2API.StoreUpdateStock(v.Stock, utils.Str2Int64(v.VendorSkuID), vendorStoreID)
|
||||
if vendorSkuID, err := getMainStoreVendorSkuID(model.JdShopMainStoreID2, v.SkuID); err == nil {
|
||||
err = api.JdShop2API.StoreUpdateStock(v.Stock, vendorSkuID, vendorStoreID)
|
||||
}
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user