|
|
@ -798,18 +798,25 @@ class StoreOrderCreateRepository extends StoreOrderRepository |
|
|
|
$merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']); |
|
|
|
$merIntegralFlag = $merIntegralFlag || ((bool)$merIntegralConfig['mer_integral_status']); |
|
|
|
$integralFlag = $useIntegral && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0 && $merIntegralConfig['mer_integral_status']; |
|
|
|
$integralFlag = $useIntegral && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0 && $merIntegralConfig['mer_integral_status']; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log::info("***** integralflag {$integralFlag}". json_encode($sysIntegralConfig)); |
|
|
|
|
|
|
|
Log::info("***** i". json_encode($merIntegralConfig)); |
|
|
|
|
|
|
|
|
|
|
|
//计算积分抵扣 |
|
|
|
//计算积分抵扣 |
|
|
|
foreach ($merchantCart['list'] as &$cart) { |
|
|
|
foreach ($merchantCart['list'] as &$cart) { |
|
|
|
//只有普通商品可以抵扣 |
|
|
|
//只有普通商品可以抵扣 |
|
|
|
|
|
|
|
Log::info("****** {$cart['product_type']} {$userIntegral} ". json_encode($merchantCart)); |
|
|
|
if ($cart['product_type'] == 0 && $integralFlag && $userIntegral > 0 && $merchantCart['order']['true_price'] > 0) { |
|
|
|
if ($cart['product_type'] == 0 && $integralFlag && $userIntegral > 0 && $merchantCart['order']['true_price'] > 0) { |
|
|
|
$integralRate = $cart['product']['integral_rate']; |
|
|
|
$integralRate = $cart['product']['integral_rate']; |
|
|
|
|
|
|
|
Log::info("*****0 ".$integralRate); |
|
|
|
if ($integralRate < 0) { |
|
|
|
if ($integralRate < 0) { |
|
|
|
$integralRate = $merIntegralConfig['mer_integral_rate']; |
|
|
|
$integralRate = $merIntegralConfig['mer_integral_rate']; |
|
|
|
} else if($integralRate > 0){ |
|
|
|
} else if($integralRate > 0){ |
|
|
|
$integralRate = min(bcdiv($integralRate, 100, 4), 1); |
|
|
|
$integralRate = min(bcdiv($integralRate, 100, 4), 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Log::info("*****1 ".$integralRate); |
|
|
|
if ($integralRate > 0) { |
|
|
|
if ($integralRate > 0) { |
|
|
|
$productIntegralPrice = min(bcmul(bcmul($this->cartByPrice($cart), $cart['cart_num'], 2), $integralRate, 2), $cart['true_price']); |
|
|
|
$productIntegralPrice = min(bcmul(bcmul($this->cartByPrice($cart), $cart['cart_num'], 2), $integralRate, 2), $cart['true_price']); |
|
|
|
|
|
|
|
Log::info("*****2 ".$productIntegralPrice); |
|
|
|
if ($productIntegralPrice > 0) { |
|
|
|
if ($productIntegralPrice > 0) { |
|
|
|
$productIntegral = ceil(bcdiv($productIntegralPrice, $sysIntegralConfig['integral_money'], 3)); |
|
|
|
$productIntegral = ceil(bcdiv($productIntegralPrice, $sysIntegralConfig['integral_money'], 3)); |
|
|
|
if ($productIntegral <= $userIntegral) { |
|
|
|
if ($productIntegral <= $userIntegral) { |
|
|
|