根据平台反酸价格增加参数

This commit is contained in:
苏尹岚
2020-03-04 17:00:27 +08:00
parent f1d795c623
commit 24a7ba97ec
2 changed files with 23 additions and 4 deletions

View File

@@ -3585,7 +3585,7 @@ func SendSeckillSkusCountMsg(ctx *jxcontext.Context, vendorIDs []int, isAsync, i
return hint, err
}
func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, vendorID int, isAsync, isContinueWhenError bool) (hint string, err error) {
func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus, vendorID int, ignoreLow, isAsync, isContinueWhenError bool) (hint string, err error) {
var (
db = dao.GetDB()
jdMap = make(map[int][]*JdStoreSkus)
@@ -3650,7 +3650,16 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus,
for kk, vv := range v {
result, err := dao.GetStoreSkuBindByNameID(db, k, kk, model.SkuStatusNormal)
if len(result) > 0 && err == nil {
if result[0].UnitPrice > vv {
if ignoreLow {
if result[0].UnitPrice > vv {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: k,
NameID: kk,
UnitPrice: vv,
}
param = append(param, storeSkuBindInfo)
}
} else {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: k,
NameID: kk,
@@ -3695,7 +3704,16 @@ func RefreshJxPriceByVendor(ctx *jxcontext.Context, jdStoreSkus []*JdStoreSkus,
for kk, vv := range v {
result, err := dao.GetStoreSkuBindByNameID(db, k, kk, model.SkuStatusNormal)
if len(result) > 0 && err == nil {
if result[0].UnitPrice > vv {
if ignoreLow {
if result[0].UnitPrice > vv {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: k,
NameID: kk,
UnitPrice: vv,
}
param = append(param, storeSkuBindInfo)
}
} else {
storeSkuBindInfo := &StoreSkuBindInfo{
StoreID: k,
NameID: kk,

View File

@@ -675,6 +675,7 @@ func (c *StoreSkuController) SendSeckillSkusCountMsg() {
// @Param token header string true "认证token"
// @Param payload formData string true "json数据JdStoreSkus对象"
// @Param vendorID formData int true "厂商ID"
// @Param ignoreLow formData bool true "是否忽略低价商品"
// @Param isAsync formData bool true "是否异步,缺省是同步"
// @Param isContinueWhenError formData bool true "单个同步失败是否继续缺省false"
// @Success 200 {object} controllers.CallResult
@@ -686,7 +687,7 @@ func (c *StoreSkuController) RefreshJxPriceByVendor() {
if err = jxutils.Strings2Objs(params.Payload, &skuBindInfos); err != nil {
return retVal, "", err
}
retVal, err = cms.RefreshJxPriceByVendor(params.Ctx, skuBindInfos, params.VendorID, params.IsAsync, params.IsContinueWhenError)
retVal, err = cms.RefreshJxPriceByVendor(params.Ctx, skuBindInfos, params.VendorID, params.IgnoreLow, params.IsAsync, params.IsContinueWhenError)
return retVal, "", err
})
}