测试折扣2

This commit is contained in:
苏尹岚
2020-08-18 14:42:18 +08:00
parent cfd14e4990
commit 268c7f0c76

View File

@@ -1515,7 +1515,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
pageSize = 9999
)
globals.SugarLogger.Debug("ChangeJxPriceByDiscountAct begin:")
fmt.Println("111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111")
page, err := dao.QueryActs(db, 0, 0, pageSize, -1, "", model.VendorIDJX, []int{model.YES}, []int{model.ActSkuDiscount}, nil, 0, nil, 0, utils.ZeroTimeValue, utils.ZeroTimeValue, time.Now().AddDate(0, -3, 0), time.Now())
if err != nil {
return
@@ -1523,7 +1522,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
if len(page.Data) == 0 {
return
}
fmt.Println("122222222222222222222222222222222222222222222222222222222222222222222222222222", utils.Format4Output(page.Data, false))
for _, act := range page.Data {
_, actStoreSkus, _ := dao.GetActStoreSkuVendorList(db, act.ID, nil, nil, nil, "", 0, pageSize)
if len(actStoreSkus) == 0 {
@@ -1553,7 +1551,6 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
if storeSku.Stock == 0 {
continue
}
fmt.Println("33333333333333333333333333333333333333333333333333333333333333", utils.Format4Output(actStoreSku, false))
actualStockOut, err = dao.GetOrderStoreSkusCount(db, actStoreSku.StoreID, actStoreSku.SkuID, time.Now().Add(-time.Minute*10), time.Now())
dao.Begin(db)
defer func() {
@@ -1564,6 +1561,8 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
}
}
}()
fmt.Println("33333333333333333333333333333333333333333333333333333333333333", actualStockOut)
fmt.Println("4444444444444444444444444444444444444444444444444444444444", shouldStockOut)
//第一档时间内
if (time.Now().Hour() >= 10 && time.Now().Hour() < 20) || (time.Now().Hour() == 20 && time.Now().Minute() < 1) {
pricePercentage = 0.02
@@ -1598,6 +1597,7 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
actStoreSku.TrendType = model.TrendTypeNothing
}
actStoreSku.TrendPrcie = int(actualPrice)
fmt.Println("555555555555555555555555555555555555555555555555555555555", utils.Format4Output(actStoreSku, false))
if _, err = dao.UpdateEntity(db, actStoreSku, "TrendType", "TrendPrcie"); err != nil {
dao.Rollback(db)
}