优化使用积分问题

main
fengxinyhyl 8 months ago
parent e07e9be3eb
commit 5347670843
  1. 7
      app/common/repositories/store/order/StoreOrderCreateRepository.php
  2. 1
      app/common/repositories/store/order/StoreOrderRepository.php
  3. 2
      app/common/repositories/user/UserAssetsLogRepository.php

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

@ -1848,6 +1848,7 @@ class StoreOrderRepository extends BaseRepository
});
event('order.verify', compact('order'));
event('order.take', compact('order'));
}
public function wxQrcode($orderId, $verify_code)

@ -524,7 +524,7 @@ class UserAssetsLogRepository extends BaseRepository
$welfare = $huitong = $contribution = 0;
// 1. 本人的消费积分
if($orderItem['pay_price']){
if(floatval($orderItem['pay_price']) > 0){
$logList[] = array(
'uid' => $orderItem['uid'],
'asset_type' => self::ASSET_TYPE_CONSUME,

Loading…
Cancel
Save