- GetPricePercentage要求的是unitPrice
This commit is contained in:
@@ -110,7 +110,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
|
if storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]; storeSkuInfo != nil {
|
||||||
validVendorMap[vendorID] = 1
|
validVendorMap[vendorID] = 1
|
||||||
validSkuMap[v.SkuID] = 1
|
validSkuMap[v.SkuID] = 1
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSkuInfo.Price, int(storeDetail.PricePercentage))
|
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSkuInfo.UnitPrice, int(storeDetail.PricePercentage))
|
||||||
actSkuMap := &model.ActStoreSkuMap{
|
actSkuMap := &model.ActStoreSkuMap{
|
||||||
ActID: act.ID,
|
ActID: act.ID,
|
||||||
StoreID: storeID,
|
StoreID: storeID,
|
||||||
|
|||||||
@@ -2028,7 +2028,7 @@ func RefreshStoresSkuByVendor(ctx *jxcontext.Context, storeIDs []int, vendorID i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, v := range storeSkuList {
|
for _, v := range storeSkuList {
|
||||||
pricePercentage := jxutils.GetPricePercentageByVendorPrice(storeMap[v.StoreID].PricePercentagePackObj, v.Price, int(storeMap[v.StoreID].PricePercentage))
|
pricePercentage := jxutils.GetPricePercentageByVendorPrice(storeMap[v.StoreID].PricePercentagePackObj, v.UnitPrice, int(storeMap[v.StoreID].PricePercentage))
|
||||||
skuName := skuNameMap[skuMap[v.SkuID].NameID]
|
skuName := skuNameMap[skuMap[v.SkuID].NameID]
|
||||||
v.Price = jxutils.CaculateSkuPriceFromVendor(v.Price, pricePercentage, 0)
|
v.Price = jxutils.CaculateSkuPriceFromVendor(v.Price, pricePercentage, 0)
|
||||||
v.UnitPrice = jxutils.CaculateSkuPriceFromVendor(skuName.Price, pricePercentage, 0)
|
v.UnitPrice = jxutils.CaculateSkuPriceFromVendor(skuName.Price, pricePercentage, 0)
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ func storeSkuSyncInfo2Bare(inSku *dao.StoreSkuSyncInfo) (outSku *partner.StoreSk
|
|||||||
}
|
}
|
||||||
|
|
||||||
func calVendorPrice4StoreSku(inSku *dao.StoreSkuSyncInfo, pricePercentagePack model.PricePercentagePack, pricePercentage int) (outSku *dao.StoreSkuSyncInfo) {
|
func calVendorPrice4StoreSku(inSku *dao.StoreSkuSyncInfo, pricePercentagePack model.PricePercentagePack, pricePercentage int) (outSku *dao.StoreSkuSyncInfo) {
|
||||||
pricePercentage = jxutils.GetPricePercentage(pricePercentagePack, int(inSku.Price), pricePercentage)
|
pricePercentage = jxutils.GetPricePercentage(pricePercentagePack, int(inSku.UnitPrice), pricePercentage)
|
||||||
inSku.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(int(inSku.Price), pricePercentage, 0))
|
inSku.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(int(inSku.Price), pricePercentage, 0))
|
||||||
return inSku
|
return inSku
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,13 +243,13 @@ func CaculateSkuPriceFromVendor(vendorPrice, percentage, catPercentage int) int
|
|||||||
return price
|
return price
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPricePercentage(l model.PricePercentagePack, price int, defPricePercentage int) (pricePercentage int) {
|
func GetPricePercentage(l model.PricePercentagePack, unitPrice int, defPricePercentage int) (pricePercentage int) {
|
||||||
pricePercentage = defPricePercentage
|
pricePercentage = defPricePercentage
|
||||||
if len(l) > 0 {
|
if len(l) > 0 {
|
||||||
var lastItem *model.PricePercentageItem
|
var lastItem *model.PricePercentageItem
|
||||||
for _, v := range l {
|
for _, v := range l {
|
||||||
lastItem = v
|
lastItem = v
|
||||||
if v.BeginPrice > price {
|
if v.BeginPrice > unitPrice {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -229,7 +229,8 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
task := tasksch.NewParallelTask("SyncStoreSkus饿百2", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
task := tasksch.NewParallelTask("SyncStoreSkus饿百2", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||||
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(t *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
storeSku := batchItemList[0].(*tStoreSkuFullInfo)
|
storeSku := batchItemList[0].(*tStoreSkuFullInfo)
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSku.Price, int(storeDetail.PricePercentage))
|
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, storeSku.UnitPrice, int(storeDetail.PricePercentage))
|
||||||
|
globals.SugarLogger.Debugf("skuID:%d, price:%d, pricePercentage:%d", storeSku.SkuID, storeSku.Price, pricePercentage)
|
||||||
updateFields := []string{model.FieldEbaiSyncStatus}
|
updateFields := []string{model.FieldEbaiSyncStatus}
|
||||||
if storeSku.NameID == 0 || storeSku.EbaiSyncStatus&model.SyncFlagDeletedMask != 0 {
|
if storeSku.NameID == 0 || storeSku.EbaiSyncStatus&model.SyncFlagDeletedMask != 0 {
|
||||||
if storeSku.EbaiSyncStatus&model.SyncFlagNewMask == 0 && !jxutils.IsEmptyID(storeSku.EbaiID) {
|
if storeSku.EbaiSyncStatus&model.SyncFlagNewMask == 0 && !jxutils.IsEmptyID(storeSku.EbaiID) {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
}
|
}
|
||||||
if storeSku.StoreSkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
if storeSku.StoreSkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
||||||
vendorSkuID4Price = storeSku.VendorSkuID
|
vendorSkuID4Price = storeSku.VendorSkuID
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(storeSku.Price), int(storeDetail.PricePercentage))
|
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(storeSku.UnitPrice), int(storeDetail.PricePercentage))
|
||||||
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
||||||
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
||||||
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(int(storeSku.Price), pricePercentage, storeSku.CatPricePercentage)),
|
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(int(storeSku.Price), pricePercentage, storeSku.CatPricePercentage)),
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
if skuItem.Img == "" {
|
if skuItem.Img == "" {
|
||||||
err = fmt.Errorf("SKUNAME%d:%s没有图片,同步失败", skuItem.NameID, skuItem.Name)
|
err = fmt.Errorf("SKUNAME%d:%s没有图片,同步失败", skuItem.NameID, skuItem.Name)
|
||||||
} else {
|
} else {
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(skuItem.Price), int(storeDetail.PricePercentage))
|
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(skuItem.UnitPrice), int(storeDetail.PricePercentage))
|
||||||
foodData["name"] = jxutils.ComposeSkuName(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, mtwmapi.MaxSkuNameCharCount)
|
foodData["name"] = jxutils.ComposeSkuName(skuItem.Prefix, skuItem.Name, skuItem.Comment, skuItem.Unit, skuItem.SpecQuality, skuItem.SpecUnit, mtwmapi.MaxSkuNameCharCount)
|
||||||
foodData["description"] = skuItem.Comment
|
foodData["description"] = skuItem.Comment
|
||||||
foodData["price"] = jxutils.IntPrice2Standard(int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), pricePercentage, skuItem.CatPricePercentage)))
|
foodData["price"] = jxutils.IntPrice2Standard(int64(jxutils.CaculateSkuVendorPrice(int(skuItem.Price), pricePercentage, skuItem.CatPricePercentage)))
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
func(rootTask *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
func(rootTask *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||||
v := batchItemList[0]
|
v := batchItemList[0]
|
||||||
skuItem := v.(*dao.StoreSkuSyncInfo)
|
skuItem := v.(*dao.StoreSkuSyncInfo)
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(skuItem.Price), int(storeDetail.PricePercentage))
|
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, int(skuItem.UnitPrice), int(storeDetail.PricePercentage))
|
||||||
updateFields := []string{model.FieldWscSyncStatus}
|
updateFields := []string{model.FieldWscSyncStatus}
|
||||||
storeSkuBind := &model.StoreSkuBind{}
|
storeSkuBind := &model.StoreSkuBind{}
|
||||||
storeSkuBind.ID = skuItem.BindID
|
storeSkuBind.ID = skuItem.BindID
|
||||||
|
|||||||
Reference in New Issue
Block a user