- add limitSkuCount parameter when create jd promotion.
This commit is contained in:
@@ -48,10 +48,15 @@ const (
|
|||||||
colEndAtIndex = 10
|
colEndAtIndex = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
DefaultLimitSkuCount = 100
|
||||||
|
)
|
||||||
|
|
||||||
type SkuPrice struct {
|
type SkuPrice struct {
|
||||||
SkuID int `json:"skuID"`
|
SkuID int `json:"skuID"`
|
||||||
PriceType int `json:"priceType"`
|
PriceType int `json:"priceType"`
|
||||||
Price int `json:"price"` // 分,这个不是单价
|
Price int `json:"price"` // 分,这个不是单价
|
||||||
|
LimitSkuCount int `json:"limitSkuCount"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PromotionParams struct {
|
type PromotionParams struct {
|
||||||
@@ -70,7 +75,7 @@ type tStoreSkuBindExt struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrEmptySkus = errors.New("空sku")
|
ErrEmptySkus = errors.New("空sku或指定的SKU没有被门店认领,请检查")
|
||||||
)
|
)
|
||||||
|
|
||||||
type JdPromotionHandler interface {
|
type JdPromotionHandler interface {
|
||||||
@@ -189,6 +194,9 @@ func CreateJdPromotion(ctx *jxcontext.Context, isIDJd bool, isAsync bool, params
|
|||||||
if promotionSkuPrice.Price >= skuBind.Price {
|
if promotionSkuPrice.Price >= skuBind.Price {
|
||||||
errMsg += fmt.Sprintf("促销价大于等于原价,storeID:%d, skuID:%d\n", skuBind.StoreID, skuBind.SkuID)
|
errMsg += fmt.Sprintf("促销价大于等于原价,storeID:%d, skuID:%d\n", skuBind.StoreID, skuBind.SkuID)
|
||||||
}
|
}
|
||||||
|
if promotionSkuPrice.LimitSkuCount <= 0 {
|
||||||
|
promotionSkuPrice.LimitSkuCount = DefaultLimitSkuCount
|
||||||
|
}
|
||||||
if errMsg == "" {
|
if errMsg == "" {
|
||||||
if params.Type == PromotionTypeLimitedTime {
|
if params.Type == PromotionTypeLimitedTime {
|
||||||
if skuBind.Price*PromotionLimitedTimeMinPercentage/100 < promotionSkuPrice.Price {
|
if skuBind.Price*PromotionLimitedTimeMinPercentage/100 < promotionSkuPrice.Price {
|
||||||
@@ -202,6 +210,7 @@ func CreateJdPromotion(ctx *jxcontext.Context, isIDJd bool, isAsync bool, params
|
|||||||
jdapi.KeyOutStationNo: utils.Int2Str(skuBind.StoreID),
|
jdapi.KeyOutStationNo: utils.Int2Str(skuBind.StoreID),
|
||||||
jdapi.KeyOutSkuId: utils.Int2Str(skuBind.SkuID),
|
jdapi.KeyOutSkuId: utils.Int2Str(skuBind.SkuID),
|
||||||
jdapi.KeyPromotionPrice: promotionSkuPrice.Price,
|
jdapi.KeyPromotionPrice: promotionSkuPrice.Price,
|
||||||
|
jdapi.KeyLimitSkuCount: promotionSkuPrice.LimitSkuCount,
|
||||||
}
|
}
|
||||||
index++
|
index++
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user