向上取整

This commit is contained in:
苏尹岚
2020-08-21 13:48:13 +08:00
parent 9262067845
commit 63fb0222d3

View File

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