- 同步门店商品时,修改商品信息时不改价(以免活动引起的失败),而用单独的改价来改
This commit is contained in:
@@ -2,6 +2,7 @@ package mtwm
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
@@ -134,13 +135,18 @@ func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) {
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (successList []*dao.StoreSkuSyncInfo, err error) {
|
||||
return p.CreateStoreSkus(ctx, storeID, vendorStoreID, storeSkuList)
|
||||
return p.createOrUpdateStoreSkus(ctx, storeID, vendorStoreID, storeSkuList, false)
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (successList []*dao.StoreSkuSyncInfo, err error) {
|
||||
return p.createOrUpdateStoreSkus(ctx, storeID, vendorStoreID, storeSkuList, true)
|
||||
}
|
||||
|
||||
// 对于多门店平台来说,storeSkuList中只有SkuID与VendorSkuID有意义
|
||||
func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo) (successList []*dao.StoreSkuSyncInfo, err error) {
|
||||
func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeID int, vendorStoreID string, storeSkuList []*dao.StoreSkuSyncInfo, isCreate bool) (successList []*dao.StoreSkuSyncInfo, err error) {
|
||||
foodDataList := make([]map[string]interface{}, len(storeSkuList))
|
||||
for i, storeSku := range storeSkuList {
|
||||
isNeedUpdatePrice := isCreate //storeSku.StoreSkuSyncStatus&( model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0
|
||||
foodData := make(map[string]interface{})
|
||||
foodDataList[i] = foodData
|
||||
foodData[mtwmapi.KeyAppFoodCode] = utils.Int2Str(storeSku.SkuID)
|
||||
@@ -152,7 +158,9 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
foodData["skus"] = skus
|
||||
foodData["name"] = utils.LimitUTF8StringLen(storeSku.SkuName, mtwmapi.MaxSkuNameCharCount)
|
||||
foodData["description"] = storeSku.Comment
|
||||
foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice)
|
||||
if isNeedUpdatePrice {
|
||||
foodData["price"] = jxutils.IntPrice2Standard(storeSku.VendorPrice)
|
||||
}
|
||||
foodData["min_order_count"] = 1
|
||||
foodData["unit"] = storeSku.Unit
|
||||
foodData["box_num"] = 0
|
||||
@@ -170,7 +178,9 @@ func (p *PurchaseHandler) CreateStoreSkus(ctx *jxcontext.Context, storeID int, v
|
||||
// foodData["tag_id"] = utils.Int64ToStr(defVendorCatID)
|
||||
}
|
||||
skus[0]["spec"] = jxutils.ComposeSkuSpec(storeSku.SpecQuality, storeSku.SpecUnit)
|
||||
skus[0]["price"] = foodData["price"]
|
||||
if isNeedUpdatePrice {
|
||||
skus[0]["price"] = foodData["price"]
|
||||
}
|
||||
skus[0]["stock"] = stockCount2Mtwm(model.MaxStoreSkuStockQty)
|
||||
skus[0]["upc"] = storeSku.Upc
|
||||
if foodData["tag_id"] != nil {
|
||||
@@ -373,4 +383,4 @@ func vendorSkuList2Jx(appFoodList []*mtwmapi.AppFood) (skuNameList []*partner.Sk
|
||||
|
||||
func (p *PurchaseHandler) GetSensitiveWordRegexp() *regexp.Regexp {
|
||||
return sensitiveWordRegexp
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user