折扣活动修改

This commit is contained in:
苏尹岚
2020-08-26 13:57:20 +08:00
parent b560f8e4e2
commit 4914a5a2b8

View File

@@ -1521,7 +1521,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
for _, act := range page.Data {
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, act.ID, nil, nil, nil, "", 0, pageSize)
if len(actStoreSkus) == 0 {
fmt.Println("test1111111111111111111111111111111111", act.ID)
continue
}
for _, actStoreSku2 := range actStoreSkus {
@@ -1539,7 +1538,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
}
storeSkus, _ := dao.GetStoresSkusInfo(db, []int{actStoreSkuMap.StoreID}, []int{actStoreSkuMap.SkuID})
if len(storeSkus) == 0 {
fmt.Println("test222222222222222222222222222222222222", act.ID)
continue
}
var (
@@ -1551,7 +1549,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
minJxPrice int64
)
if storeSku.Stock == 0 {
fmt.Println("test33333333333333333333333333333333333333333", act.ID)
continue
}
actualStockOut, err = dao.GetOrderStoreSkusCount(db, actStoreSkuMap.StoreID, actStoreSkuMap.SkuID, time.Now().Add(-time.Minute*10), time.Now())
@@ -1600,8 +1597,14 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
//C >= 2N 涨价趋势,最高涨价到无折扣
if actualStockOut >= 2*shouldStockOut {
actStoreSkuMap.TrendType = model.TrendTypeUp
if actStoreSkuMap.ActualActPrice == actStoreSkuMap.VendorPrice {
actStoreSkuMap.TrendType = model.TrendTypeNothing
}
} else if actualStockOut < utils.Float64TwoInt64(math.Ceil(float64(shouldStockOut)/float64(2))) { //C <= N/2 降价趋势,最低降价到设置到最低折扣
actStoreSkuMap.TrendType = model.TrendTypeDown
if actStoreSkuMap.ActualActPrice == minJxPrice {
actStoreSkuMap.TrendType = model.TrendTypeNothing
}
} else {
actStoreSkuMap.TrendType = model.TrendTypeNothing
}