|
@@ -264,9 +264,6 @@ class StoreCart extends BaseModel
|
|
|
$cart['vip_truePrice'] = 0;
|
|
|
$cart['use_integral'] = $cart['productInfo']['max_use_integral'] ?? 0;
|
|
|
} else {
|
|
|
- $cart['truePrice'] = (float)StoreProduct::setLevelPrice($attrInfo['price'], $uid, true);
|
|
|
- $cart['vip_truePrice'] = (float)StoreProduct::setLevelPrice($attrInfo['price'], $uid);
|
|
|
-
|
|
|
$discounts = json_decode($product['time_area_discount'] ?: '[]', true);
|
|
|
$discount = 0;
|
|
|
if (count($discounts) > 0) {
|
|
@@ -283,9 +280,10 @@ class StoreCart extends BaseModel
|
|
|
}
|
|
|
}
|
|
|
if ($discount > 0) {
|
|
|
- $cart['truePrice'] = bcmul(bcdiv($discount, 100, 4), $cart['truePrice'], 2);
|
|
|
- $cart['vip_truePrice'] = bcsub($cart['truePrice'], bcmul(bcdiv($discount, 100, 4), $cart['truePrice'], 2), 2);
|
|
|
+ $attrInfo['price'] = bcmul(bcdiv($discount, 100, 4), $attrInfo['price'], 2);
|
|
|
}
|
|
|
+ $cart['truePrice'] = (float)StoreProduct::setLevelPrice($attrInfo['price'], $uid, true);
|
|
|
+ $cart['vip_truePrice'] = (float)StoreProduct::setLevelPrice($attrInfo['price'], $uid);
|
|
|
$cart['use_integral'] = 0;
|
|
|
}
|
|
|
$cart['trueStock'] = $attrInfo['stock'];
|
|
@@ -304,6 +302,24 @@ class StoreCart extends BaseModel
|
|
|
$cart['productInfo']['attrInfo']['weight'] = $product['weight'];
|
|
|
$cart['productInfo']['attrInfo']['volume'] = $product['volume'];
|
|
|
} else {
|
|
|
+ $discounts = json_decode($product['time_area_discount'] ?: '[]', true);
|
|
|
+ $discount = 0;
|
|
|
+ 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) {
|
|
|
+ $cart['productInfo']['price'] = bcmul(bcdiv($discount, 100, 4), $cart['productInfo']['price'], 2);
|
|
|
+ }
|
|
|
$cart['truePrice'] = (float)StoreProduct::setLevelPrice($cart['productInfo']['price'], $uid, true);
|
|
|
$cart['vip_truePrice'] = (float)StoreProduct::setLevelPrice($cart['productInfo']['price'], $uid);
|
|
|
$cart['use_integral'] = 0;
|