活动平台价直接使用当前存的,不重新计算
不同步的门店或禁用的门店不创建活动
This commit is contained in:
@@ -72,6 +72,18 @@ func init() {
|
|||||||
partner.InitActManager(FixedActManager)
|
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) {
|
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)
|
wholeValidVendorMap := make(map[int]int)
|
||||||
if len(actStoreSku) > 0 {
|
if len(actStoreSku) > 0 {
|
||||||
@@ -119,6 +131,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
for _, vendorID := range vendorIDs {
|
for _, vendorID := range vendorIDs {
|
||||||
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
|
storeDetail, err2 := dao.GetStoreDetail(db, storeID, vendorID)
|
||||||
if err = err2; err == nil {
|
if err = err2; err == nil {
|
||||||
|
if storeDetail.IsSync != 0 && storeDetail.Status != model.StoreStatusDisabled {
|
||||||
for _, v := range oneStoreSkuParam {
|
for _, v := range oneStoreSkuParam {
|
||||||
validVendorMap[vendorID] = 1
|
validVendorMap[vendorID] = 1
|
||||||
validSkuMap[v.SkuID] = 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)]
|
storeSkuInfo := storeSkuMap[jxutils.Combine2Int(v.StoreID, v.SkuID)]
|
||||||
if storeSkuInfo != nil {
|
if storeSkuInfo != nil {
|
||||||
jxPrice := storeSkuInfo.Price
|
jxPrice := storeSkuInfo.Price
|
||||||
pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, jxPrice, int(storeDetail.PricePercentage))
|
// pricePercentage := jxutils.GetPricePercentage(storeDetail.PricePercentagePackObj, jxPrice, int(storeDetail.PricePercentage))
|
||||||
actSkuMap.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(jxPrice, pricePercentage))
|
// actSkuMap.VendorPrice = int64(jxutils.CaculateSkuVendorPrice(jxPrice, pricePercentage))
|
||||||
|
actSkuMap.VendorPrice = int64(getVendorPriceFromStoreSkuBind(storeSkuInfo, vendorID))
|
||||||
v.OriginalPrice = int64(jxPrice)
|
v.OriginalPrice = int64(jxPrice)
|
||||||
}
|
}
|
||||||
var err2 error
|
var err2 error
|
||||||
@@ -172,6 +186,7 @@ func ActStoreSkuParam2Model(ctx *jxcontext.Context, db *dao.DaoDB, act *model.Ac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wholeValidVendorMap[vendorID] = 1
|
wholeValidVendorMap[vendorID] = 1
|
||||||
|
}
|
||||||
} else if !dao.IsNoRowsError(err) {
|
} else if !dao.IsNoRowsError(err) {
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user