活动平台价直接使用当前存的,不重新计算

不同步的门店或禁用的门店不创建活动
This commit is contained in:
gazebo
2019-11-07 23:00:48 +08:00
parent 7ab34ae366
commit 025ead8c05

View File

@@ -72,6 +72,18 @@ func init() {
partner.InitActManager(FixedActManager)
}
func getVendorPriceFromStoreSkuBind(bind *model.StoreSkuBind, vendorID int) (vendorPrice int) {
switch vendorID {
case model.VendorIDJD:
vendorPrice = bind.JdPrice
case model.VendorIDMTWM:
vendorPrice = bind.MtwmPrice
case model.VendorIDEBAI:
vendorPrice = bind.EbaiPrice
}
return vendorPrice
}
func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Act, vendorIDs []int, actStoreSku []*ActStoreSkuParam) (validVendorIDs []int, actStoreSkuList []*model.ActStoreSku, actStoreSkuMapList []*model.ActStoreSkuMap, err error) {
wholeValidVendorMap := make(map[int]int)
if len(actStoreSku) > 0 {
@@ -119,6 +131,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
for _, vendorID := range vendorIDs {
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
if err = err2; err == nil {
if storeDetail.IsSync != 0 && storeDetail.Status != model.StoreStatusDisabled {
for _, v := range oneStoreSkuParam {
validVendorMap[vendorID] = 1
validSkuMap[v.SkuID] = 1
@@ -133,8 +146,9 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]
if storeSkuInfo != nil {
jxPrice := storeSkuInfo.Price
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, jxPrice, int(storeDetail.PricePercentage))
actSkuMap.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(jxPrice, pricePercentage))
// pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, jxPrice, int(storeDetail.PricePercentage))
// actSkuMap.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(jxPrice, pricePercentage))
actSkuMap.VendorPrice = int64(getVendorPriceFromStoreSkuBind(storeSkuInfo, vendorID))
v.OriginalPrice = int64(jxPrice)
}
var err2 error
@@ -172,6 +186,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
}
}
wholeValidVendorMap[vendorID] = 1
}
} else if !dao.IsNoRowsError(err) {
return nil, nil, nil, err
} else {