每晚22点也恢复成原价把

This commit is contained in:
苏尹岚
2020-08-19 13:42:21 +08:00
parent 9dcb54c291
commit 6ed89093ba

View File

@@ -1628,15 +1628,16 @@ func ChangeJxPriceByDiscountAct(ctx *jxcontext.Context) {
if actStoreSkuMap.ActualActPrice <= minJxPrice {
actStoreSkuMap.ActualActPrice = minJxPrice
}
if _, err = dao.UpdateEntity(db, actStoreSkuMap, "ActualActPrice", "TrendType", "TrendPrice"); err != nil {
dao.Rollback(db)
}
//22:00 恢复库存为100
//22:00 恢复库存为100,价格恢复原价
if time.Now().Hour() == 22 && time.Now().Minute() < 1 {
storeSku.Stock = 100
if _, err = dao.UpdateEntity(db, storeSku, "Stock"); err != nil {
dao.Rollback(db)
}
actStoreSkuMap.ActualActPrice = actStoreSkuMap.VendorPrice
}
if _, err = dao.UpdateEntity(db, actStoreSkuMap, "ActualActPrice", "TrendType", "TrendPrice"); err != nil {
dao.Rollback(db)
}
}
dao.Commit(db)