- remove many useless isForce parameters.
- isSync to isAsync.
This commit is contained in:
@@ -22,7 +22,7 @@ type tStoreSkuBindExt struct {
|
||||
}
|
||||
|
||||
// 京东到家,以有库存表示关注(认领)
|
||||
func (p *PurchaseHandler) SyncStoresSkus(db *dao.DaoDB, storeIDs []int, skuIDs []int, isForce bool, userName string) (err error) {
|
||||
func (p *PurchaseHandler) SyncStoresSkus(db *dao.DaoDB, storeIDs []int, skuIDs []int, isAsync bool, userName string) (hint string, err error) {
|
||||
parallelCount := 1
|
||||
if len(skuIDs) < MaxSkuBatchSize {
|
||||
parallelCount = 10
|
||||
@@ -55,13 +55,13 @@ func (p *PurchaseHandler) SyncStoresSkus(db *dao.DaoDB, storeIDs []int, skuIDs [
|
||||
for _, v := range batchItemList {
|
||||
storeSku := v.(*tStoreSkuBindExt)
|
||||
if storeSku.JdSyncStatus&model.SyncFlagChangedMask != 0 {
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 || isForce {
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
||||
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
||||
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
||||
Price: jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage),
|
||||
})
|
||||
}
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 || isForce {
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
|
||||
vendibility := &jdapi.StockVendibility{
|
||||
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
||||
DoSale: true,
|
||||
@@ -71,7 +71,7 @@ func (p *PurchaseHandler) SyncStoresSkus(db *dao.DaoDB, storeIDs []int, skuIDs [
|
||||
}
|
||||
skuVendibilityList = append(skuVendibilityList, vendibility)
|
||||
}
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask) != 0 || isForce { // 关注或取消关注
|
||||
if storeSku.JdSyncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask) != 0 { // 关注或取消关注
|
||||
stock := &jdapi.SkuStock{
|
||||
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
||||
StockQty: MaxStockQty,
|
||||
@@ -111,6 +111,9 @@ func (p *PurchaseHandler) SyncStoresSkus(db *dao.DaoDB, storeIDs []int, skuIDs [
|
||||
return nil, err
|
||||
}, storeIDs)
|
||||
|
||||
if isAsync {
|
||||
return task.ID, nil
|
||||
}
|
||||
_, err = task.GetResult(0)
|
||||
return err
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user