From 7e447c7f5fe0a1970219325002e0c42b5dc53e9e Mon Sep 17 00:00:00 2001 From: songliang Date: Wed, 2 Nov 2022 14:10:34 +0800 Subject: [PATCH] shop discount --- webapp/controller/ShopController.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 529506d8..35cb0e13 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -141,11 +141,12 @@ class ShopController extends BaseAuthedController { $need_price = $price_array[$token_pos]; $discount = $discount_array[$token_pos]; - $discount_begin = $row['discount_begin']; - $discount_end = $row['discount_end']; + $discount_begin = strtotime($row['discount_begin'].' UTC'); + $discount_end = strtotime($row['discount_end'].' UTC'); $nowTime = $this->_getNowTime(); - + if ($nowTime>=$discount_begin && $nowTime<$discount_end) { + $need_price = ceil($need_price * ($discount / 100.0)); }