- 同步门店商品时,修改商品信息时不改价(以免活动引起的失败),而用单独的改价来改

This commit is contained in:
gazebo
2019-08-21 15:35:13 +08:00
parent 9b8173d0f7
commit c35df3a5a4
3 changed files with 38 additions and 19 deletions

View File

@@ -2,9 +2,10 @@ package cms
import (
"fmt"
"time"
"regexp"
"strings"
"time"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
@@ -215,14 +216,17 @@ func formalizeStoreSkuList(inSkuList []*dao.StoreSkuSyncInfo) []*dao.StoreSkuSyn
func sku2Update(vendorID int, sku *dao.StoreSkuSyncInfo, syncStatus int8) (item *dao.KVUpdateItem) {
kvs := map[string]interface{}{}
if syncStatus&(model.SyncFlagDeletedMask|model.SyncFlagNewMask|model.SyncFlagModifiedMask) != 0 {
sku.StoreSkuSyncStatus = 0
if model.IsSyncStatusNew(syncStatus) {
sku.StoreSkuSyncStatus = 0
kvs[dao.GetVendorThingIDStructField(model.VendorNames[vendorID])] = utils.Str2Int64WithDefault(sku.VendorSkuID, 0)
} else if model.IsSyncStatusDelete(syncStatus) {
sku.StoreSkuSyncStatus = 0
if utils.IsTimeZero(sku.BindDeletedAt) {
kvs[model.FieldDeletedAt] = time.Now()
}
kvs[dao.GetVendorThingIDStructField(model.VendorNames[vendorID])] = 0
} else {
sku.StoreSkuSyncStatus = sku.StoreSkuSyncStatus & model.SyncFlagPriceMask
}
} else if syncStatus&model.SyncFlagStockMask != 0 {
if isStoreSkuSyncNeedDelete(sku) {
@@ -334,13 +338,17 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, isFull bo
}
parentTask.AddBatchErr(err)
} else {
isAdded2Update := false
// 修改商品信息时不改价(以免活动引起的失败),而用单独的改价来改
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler != nil {
isAdded2Update = true
updateList = append(updateList, calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
} else {
if model.IsSyncStatusPrice(sku.StoreSkuSyncStatus) {
bareSku = storeSkuSyncInfo2Bare(calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
priceList = append(priceList, bareSku)
}
}
if model.IsSyncStatusPrice(sku.StoreSkuSyncStatus) {
bareSku = storeSkuSyncInfo2Bare(calVendorPrice4StoreSku(sku, storeDetail.PricePercentagePackObj, int(storeDetail.PricePercentage)))
priceList = append(priceList, bareSku)
}
if !isAdded2Update {
if model.IsSyncStatusUpdate(sku.StoreSkuSyncStatus) && singleStoreHandler == nil { // 正常就不应该进到这里
if bareSku == nil {
bareSku = storeSkuSyncInfo2Bare(sku)
@@ -652,4 +660,4 @@ func GetSensitiveWord(singleStoreHandler partner.ISingleStoreStoreSkuHandler, st
}
return ""
}
}