门店商品标志,只刷高价的
This commit is contained in:
@@ -838,16 +838,16 @@ func UpdateStoreSku(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfo
|
||||
}
|
||||
|
||||
func UpdateStoreSkus(ctx *jxcontext.Context, causeFlag, storeID int, skuBindInfos []*StoreSkuBindInfo, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
return UpdateStoresSkus(ctx, causeFlag, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError)
|
||||
return UpdateStoresSkus(ctx, causeFlag, []int{storeID}, skuBindInfos, false, false, isAsync, isContinueWhenError)
|
||||
}
|
||||
|
||||
func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
globals.SugarLogger.Debugf("UpdateStoresSkus:%s, storeIDs:%v, skuBindInfos:%s", ctx.GetTrackInfo(), storeIDs, utils.Format4Output(skuBindInfos, true))
|
||||
flag, err := doStoreSkuAudit(ctx, storeIDs, skuBindInfos)
|
||||
if !flag {
|
||||
var num int64
|
||||
db := dao.GetDB()
|
||||
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale)
|
||||
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, isScale, isRefreshHigh)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -863,7 +863,7 @@ func UpdateStoresSkus(ctx *jxcontext.Context, causeFlag int, storeIDs []int, sku
|
||||
return hint, err
|
||||
}
|
||||
|
||||
func UpdateStoresSkusWithoutSync(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*StoreSkuBindInfo) (err error) {
|
||||
func UpdateStoresSkusWithoutSync(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isRefreshHigh bool) (err error) {
|
||||
db := dao.GetDB()
|
||||
if len(storeIDs) == 0 {
|
||||
stores, _ := dao.GetStoreList(db, nil, nil, nil, nil, "")
|
||||
@@ -871,7 +871,7 @@ func UpdateStoresSkusWithoutSync(ctx *jxcontext.Context, storeIDs []int, skuBind
|
||||
storeIDs = append(storeIDs, v.ID)
|
||||
}
|
||||
}
|
||||
updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, false)
|
||||
updateStoresSkusWithoutSync(ctx, db, storeIDs, skuBindInfos, false, isRefreshHigh)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ func UpdateStoresSkusByBind(ctx *jxcontext.Context, parentTask tasksch.ITask, sk
|
||||
// }
|
||||
// }()
|
||||
for _, storeID := range storeIDs {
|
||||
skuIDs, err2 := updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosMap[storeID], false)
|
||||
skuIDs, err2 := updateStoresSkusWithoutSync(ctx, db, []int{storeID}, skuBindInfosMap[storeID], false, false)
|
||||
if err = err2; err != nil {
|
||||
// dao.Rollback(db)
|
||||
return "", err
|
||||
@@ -980,7 +980,7 @@ func uniqueStoreNameBind(skuBindInfos []*StoreSkuBindInfo) (outSkuBindInfos []*S
|
||||
return outSkuBindInfos
|
||||
}
|
||||
|
||||
func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale bool) (needSyncSkus []int, err error) {
|
||||
func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs []int, skuBindInfos []*StoreSkuBindInfo, isScale, isRefreshHigh bool) (needSyncSkus []int, err error) {
|
||||
// if len(storeIDs)*len(skuBindInfos) > maxStoreNameBind2 {
|
||||
// return nil, fmt.Errorf("门店商品信息大于%d", maxStoreNameBind2)
|
||||
// }
|
||||
@@ -1194,11 +1194,21 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask)
|
||||
updateFieldMap["Price"] = 1
|
||||
}
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
if isRefreshHigh {
|
||||
if beforeMsg.UnitPrice > skuBindInfo.UnitPrice {
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
}
|
||||
} else {
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 {
|
||||
@@ -1877,7 +1887,7 @@ func AcceptStoreOpRequests(ctx *jxcontext.Context, reqIDs []int) (err error) {
|
||||
}
|
||||
}
|
||||
if err2 == nil {
|
||||
_, err2 := UpdateStoresSkus(ctx, 0, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false)
|
||||
_, err2 := UpdateStoresSkus(ctx, 0, []int{op.StoreID}, []*StoreSkuBindInfo{skuBindInfo}, false, false, false, false)
|
||||
isLocalSucess := true
|
||||
if err2 != nil {
|
||||
subErrors[reqID] = err2
|
||||
@@ -2596,7 +2606,7 @@ func RefershStoreSkusMidPrice(ctx *jxcontext.Context, storeIDs []int, isCountry
|
||||
}
|
||||
}
|
||||
}
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{v}, skuBindInfos, false)
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{v}, skuBindInfos, false, false)
|
||||
}
|
||||
if err == nil {
|
||||
CreateStorePriceScore(ctx)
|
||||
@@ -2738,7 +2748,7 @@ func RefreshJxPriceByExcelBin(ctx *jxcontext.Context, storeIDs []int, reader io.
|
||||
skuBindInfoList = append(skuBindInfoList, v.(*StoreSkuBindInfo))
|
||||
}
|
||||
if isErr {
|
||||
UpdateStoresSkus(ctx, 0, storeIDs, skuBindInfoList, false, isAsync, isContinueWhenError)
|
||||
UpdateStoresSkus(ctx, 0, storeIDs, skuBindInfoList, false, false, isAsync, isContinueWhenError)
|
||||
}
|
||||
case 3:
|
||||
//写Excel
|
||||
@@ -3398,7 +3408,7 @@ func AutoFocusStoreSkusWithoutFocus(ctx *jxcontext.Context, skuIDs []int, isSync
|
||||
if isSync {
|
||||
UpdateStoreSkus(ctx, 0, v.StoreID, skuBindInfoList, true, true)
|
||||
} else {
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{v.StoreID}, skuBindInfoList, false)
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{v.StoreID}, skuBindInfoList, false, false)
|
||||
}
|
||||
}
|
||||
return err
|
||||
@@ -4102,7 +4112,7 @@ func RefreshMatterStock(ctx *jxcontext.Context, skuID int) (err error) {
|
||||
}
|
||||
}
|
||||
//物料店666666
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{666666}, skuBindInfos, false)
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{666666}, skuBindInfos, false, false)
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -4450,7 +4460,7 @@ func focusC4Matters(ctx *jxcontext.Context, db *dao.DaoDB, v *model.Sku) (err er
|
||||
}
|
||||
skuBindInfos = append(skuBindInfos, skuBindInfo)
|
||||
}
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{model.MatterStoreID}, skuBindInfos, false)
|
||||
updateStoresSkusWithoutSync(ctx, db, []int{model.MatterStoreID}, skuBindInfos, false, false)
|
||||
}
|
||||
return err
|
||||
}
|
||||
@@ -4609,7 +4619,7 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku
|
||||
}
|
||||
var num int64
|
||||
db := dao.GetDB()
|
||||
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, []int{storeAudit.StoreID}, skuBindInfos, false)
|
||||
skuIDs, err := updateStoresSkusWithoutSync(ctx, db, []int{storeAudit.StoreID}, skuBindInfos, false, false)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user