- 门店价限制不能为负数
- 京东门店价限制为最少一分
This commit is contained in:
@@ -178,7 +178,11 @@ func GetSliceLen(list interface{}) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CaculateSkuVendorPrice(price int, percentage int) int {
|
func CaculateSkuVendorPrice(price int, percentage int) int {
|
||||||
return int(math.Round(float64(price*percentage) / 100))
|
storePrice := int(math.Round(float64(price*percentage) / 100))
|
||||||
|
if storePrice < 0 {
|
||||||
|
storePrice = 0
|
||||||
|
}
|
||||||
|
return storePrice
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成一个不重复的临时ID
|
// 生成一个不重复的临时ID
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func (p *PurchaseHandler) SyncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
if storeSku.JdSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
if storeSku.JdSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
||||||
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
||||||
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
OutSkuId: utils.Int2Str(storeSku.SkuID),
|
||||||
Price: jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage),
|
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(storeSku.Price, storeSku.PricePercentage)),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if storeSku.JdSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
|
if storeSku.JdSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
|
||||||
@@ -215,7 +215,7 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
if storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
if storeSku.SkuSyncStatus&(model.SyncFlagPriceMask|model.SyncFlagNewMask) != 0 {
|
||||||
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
skuPriceInfoList = append(skuPriceInfoList, &jdapi.SkuPriceInfo{
|
||||||
OutSkuId: utils.Int2Str(storeSku.ID),
|
OutSkuId: utils.Int2Str(storeSku.ID),
|
||||||
Price: jxutils.CaculateSkuVendorPrice(int(storeSku.Price), int(storeDetail.PricePercentage)),
|
Price: constrainPrice(jxutils.CaculateSkuVendorPrice(int(storeSku.Price), int(storeDetail.PricePercentage))),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if storeSku.SkuSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
|
if storeSku.SkuSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 {
|
||||||
@@ -271,3 +271,10 @@ func (p *PurchaseHandler) syncStoreSkus(ctx *jxcontext.Context, parentTask tasks
|
|||||||
func (p *PurchaseHandler) DeleteRemoteStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
func (p *PurchaseHandler) DeleteRemoteStoreSkus(ctx *jxcontext.Context, parentTask tasksch.ITask, storeID int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||||
return hint, err
|
return hint, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func constrainPrice(price int) int {
|
||||||
|
if price <= 0 {
|
||||||
|
price = 1
|
||||||
|
}
|
||||||
|
return price
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user