|
@@ -269,15 +269,17 @@ class StoreCart extends BaseModel
|
|
|
|
|
|
$discounts = json_decode($product['time_area_discount'], true);
|
|
|
$discount = 0;
|
|
|
- foreach ($discounts as $kk => $v) {
|
|
|
- $times = explode('-', $kk);
|
|
|
- if (!(count($times) == 2)) {
|
|
|
- break;
|
|
|
- }
|
|
|
- $start = strtotime(date('Y-m-d') . ' ' . $times[0]);
|
|
|
- $end = strtotime(date('Y-m-d') . ' ' . $times[1]);
|
|
|
- if (time() > $start && time() <= $end) {
|
|
|
- $discount = $v;
|
|
|
+ if (count($discounts) > 0) {
|
|
|
+ foreach ($discounts as $kk => $v) {
|
|
|
+ $times = explode('-', $kk);
|
|
|
+ if (!(count($times) == 2)) {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $start = strtotime(date('Y-m-d') . ' ' . $times[0]);
|
|
|
+ $end = strtotime(date('Y-m-d') . ' ' . $times[1]);
|
|
|
+ if (time() > $start && time() <= $end) {
|
|
|
+ $discount = $v;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if ($discount > 0) {
|