增加:进货订单 支持使用补货额度进行减免

This commit is contained in:
wuhui_zzw 2024-05-27 16:34:38 +08:00
parent d7e3e8e8f8
commit cdb0589221
4 changed files with 136 additions and 94 deletions

View File

@ -43,6 +43,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$userIntegral = $user->integral; $userIntegral = $user->integral;
$exchangeIntegral = $user->exchange_integral ?? 0;// 持有可用酒水卡积分 $exchangeIntegral = $user->exchange_integral ?? 0;// 持有可用酒水卡积分
$isWithGoods = $withGoods['is_with_goods'] ?? 0;// 0=用户购物1=酒道馆进货 $isWithGoods = $withGoods['is_with_goods'] ?? 0;// 0=用户购物1=酒道馆进货
$with_goods_mer_id = $withGoods['with_goods_mer_id'] ?? 0;
$diffRate = 30;// 酒道馆商品 补差价比例 这里暂时默认固定为30% $diffRate = 30;// 酒道馆商品 补差价比例 这里暂时默认固定为30%
$key = md5(json_encode(compact('cartId','takes','useCoupon','useIntegral','addressId'))).$uid; $key = md5(json_encode(compact('cartId','takes','useCoupon','useIntegral','addressId'))).$uid;
//去掉过期的优惠券信息 //去掉过期的优惠券信息
@ -723,8 +724,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$orderTotalWineIntegralPrice = 0;// 订单总使用酒水卡积分抵扣的金额 $orderTotalWineIntegralPrice = 0;// 订单总使用酒水卡积分抵扣的金额
$orderTotalWineDiffMoney = 0;// 订单总差价 $orderTotalWineDiffMoney = 0;// 订单总差价
$orderTotalWineDiffMoneyPrice = 0;// 订单总补差价支付金额 $orderTotalWineDiffMoneyPrice = 0;// 订单总补差价支付金额
$orderTotalRandomReduction = 0;// 订单总随机立减金额 $orderTotalRandomReduction = 0;// 订单总随机立减金额
$orderTotalMerQuota = 0;// 进货订单-补货额度抵扣金额
// 获取当前进货商户的补货额度
$merQuotaSurplus = app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$with_goods_mer_id])->value('quota_surplus');
foreach($merchantCartList as &$merchantCart){ foreach($merchantCartList as &$merchantCart){
$merchantCart['take'] = [ $merchantCart['take'] = [
@ -755,52 +758,24 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$orderWineIntegralPrice = 0;// 当前订单使用就是快积分抵扣的金额 $orderWineIntegralPrice = 0;// 当前订单使用就是快积分抵扣的金额
$orderWineDiffMoney = 0;// 当前订单差价 $orderWineDiffMoney = 0;// 当前订单差价
$orderWineDiffMoneyPrice = 0;// 当前订单补差价支付金额 $orderWineDiffMoneyPrice = 0;// 当前订单补差价支付金额
$orderRandomReduction = 0;//当前订单随机立减金额 $orderRandomReduction = 0;//当前订单随机立减金额
$orderMerQuota = 0;// 进货订单-补货额度抵扣金额
//计算积分抵扣 //计算积分抵扣
foreach($merchantCart['list'] as &$cart){ foreach($merchantCart['list'] as &$cart){
//只有普通商品可以抵扣 if($cart['product_type'] == 35){
if($cart['product_type'] == 0 && $integralFlag && $userIntegral > 0 && $merchantCart['order']['true_price'] > 0){ // 进货订单
$integralRate = $cart['product']['integral_rate']; $deductionAmount = (float)$merQuotaSurplus >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$merQuotaSurplus;// 实际抵扣金额
if($integralRate < 0){ $merQuotaSurplus = bcsub((float)$merQuotaSurplus,(float)$deductionAmount,2);// 剩余补货额度
$integralRate = $merIntegralConfig['mer_integral_rate']; $cart['mer_quota_deduction'] = $deductionAmount;
} // 订单总支付金额 先减去抵扣金额
elseif($integralRate > 0){ $merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'],$deductionAmount,2);
$integralRate = min(bcdiv($integralRate,100,4),1); // 当前商品剩余应支付金额
} $cart['true_price'] = bcsub($cart['true_price'],$deductionAmount,2);
if($integralRate > 0){ // 当前订单使用的补货额度及抵扣金额
$productIntegralPrice = min(bcmul(bcmul($this->cartByPrice($cart),$cart['cart_num'],2),$integralRate,2),$cart['true_price']); $orderMerQuota = bcadd($orderMerQuota,$deductionAmount,2);
if($productIntegralPrice > 0){
$productIntegral = ceil(bcdiv($productIntegralPrice,$sysIntegralConfig['integral_money'],3));
if($productIntegral <= $userIntegral){
$userIntegral = bcsub($userIntegral,$productIntegral,0);
//使用多少积分抵扣了多少金额
$cart['integral'] = [
'use' => $productIntegral,
'price' => $productIntegralPrice
];
}
else{
$productIntegralPrice = bcmul($userIntegral,$sysIntegralConfig['integral_money'],2);
//使用多少积分抵扣了多少金额
$cart['integral'] = [
'use' => $userIntegral,
'price' => $productIntegralPrice
];
$userIntegral = 0;
}
$cart['true_price'] = bcsub($cart['true_price'],$cart['integral']['price'],2);
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'],$cart['integral']['price'],2);
$total_integral_price = bcadd($total_integral_price,$cart['integral']['price'],2);
$total_integral = bcadd($total_integral,$cart['integral']['use'],0);
continue;
}
}
} }
$cart['integral'] = NULL; else if($cart['product_type'] == 36){
// 兑换酒道馆商品时 酒水卡积分抵扣处理 // 兑换酒道馆商品时 酒水卡积分抵扣处理
if($cart['product_type'] == 36){
// 当前商品消耗积分 如果持有酒水卡积分大于等于支付金额,使用支付金额;小于支付金额,使用酒水卡积分 // 当前商品消耗积分 如果持有酒水卡积分大于等于支付金额,使用支付金额;小于支付金额,使用酒水卡积分
$deductionAmount = (float)$exchangeIntegral >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$exchangeIntegral;// 实际抵扣金额 $deductionAmount = (float)$exchangeIntegral >= (float)$cart['true_price'] ? (float)$cart['true_price'] : (float)$exchangeIntegral;// 实际抵扣金额
$exchangeIntegral = bcsub((float)$exchangeIntegral,(float)$deductionAmount,2);// 剩余酒水卡积分 $exchangeIntegral = bcsub((float)$exchangeIntegral,(float)$deductionAmount,2);// 剩余酒水卡积分
@ -829,21 +804,62 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$orderWineIntegral = bcadd($orderWineIntegral,$deductionAmount,2); $orderWineIntegral = bcadd($orderWineIntegral,$deductionAmount,2);
$orderWineIntegralPrice = bcadd($orderWineIntegralPrice,$deductionAmount,2); $orderWineIntegralPrice = bcadd($orderWineIntegralPrice,$deductionAmount,2);
} }
// 计算随机立减 仅普通商品有效 else{
if($cart['product_type'] == 0 && $cart['true_price'] > 0){ //只有普通商品可以抵扣
// 随机立减 if($cart['product_type'] == 0 && $integralFlag && $userIntegral > 0 && $merchantCart['order']['true_price'] > 0){
$systemConfig = systemConfig(['random_reduction_min','random_reduction_max']); $integralRate = $cart['product']['integral_rate'];
$minNum = $systemConfig['random_reduction_min'] ?? 0.1; if($integralRate < 0){
$maxNum = $systemConfig['random_reduction_max'] ?? 5; $integralRate = $merIntegralConfig['mer_integral_rate'];
// 判断:如果最大立减金额 大于剩余支付金额;则最大立减金额=剩余支付金额,否则不变 }
$maxNum = $maxNum > $cart['true_price'] ? $cart['true_price'] : $maxNum; elseif($integralRate > 0){
$randomReduction = getRandom((float)$minNum, (float)$maxNum); $integralRate = min(bcdiv($integralRate,100,4),1);
}
if($integralRate > 0){
$productIntegralPrice = min(bcmul(bcmul($this->cartByPrice($cart),$cart['cart_num'],2),$integralRate,2),$cart['true_price']);
if($productIntegralPrice > 0){
$productIntegral = ceil(bcdiv($productIntegralPrice,$sysIntegralConfig['integral_money'],3));
if($productIntegral <= $userIntegral){
$userIntegral = bcsub($userIntegral,$productIntegral,0);
//使用多少积分抵扣了多少金额
$cart['integral'] = [
'use' => $productIntegral,
'price' => $productIntegralPrice
];
}
else{
$productIntegralPrice = bcmul($userIntegral,$sysIntegralConfig['integral_money'],2);
//使用多少积分抵扣了多少金额
$cart['integral'] = [
'use' => $userIntegral,
'price' => $productIntegralPrice
];
$userIntegral = 0;
}
$cart['true_price'] = bcsub($cart['true_price'],$cart['integral']['price'],2);
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'],$cart['integral']['price'],2);
$total_integral_price = bcadd($total_integral_price,$cart['integral']['price'],2);
$total_integral = bcadd($total_integral,$cart['integral']['use'],0);
continue;
}
}
}
$cart['integral'] = NULL;
// 计算随机立减 仅普通商品有效
if($cart['product_type'] == 0 && $cart['true_price'] > 0){
// 随机立减
$systemConfig = systemConfig(['random_reduction_min','random_reduction_max']);
$minNum = $systemConfig['random_reduction_min'] ?? 0.1;
$maxNum = $systemConfig['random_reduction_max'] ?? 5;
// 判断:如果最大立减金额 大于剩余支付金额;则最大立减金额=剩余支付金额,否则不变
$maxNum = $maxNum > $cart['true_price'] ? $cart['true_price'] : $maxNum;
$randomReduction = getRandom((float)$minNum, (float)$maxNum);
$cart['random_reduction'] = $randomReduction; $cart['random_reduction'] = $randomReduction;
$cart['true_price'] = bcsub($cart['true_price'],$randomReduction,2);; $cart['true_price'] = bcsub($cart['true_price'],$randomReduction,2);;
$merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'], $randomReduction,2); $merchantCart['order']['true_price'] = bcsub($merchantCart['order']['true_price'], $randomReduction,2);
$orderRandomReduction = bcadd($orderRandomReduction,$randomReduction,2); $orderRandomReduction = bcadd($orderRandomReduction,$randomReduction,2);
}
} }
} }
unset($cart); unset($cart);
@ -854,12 +870,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
// 订单总使用的酒水卡积分 & 总抵扣的金额 // 订单总使用的酒水卡积分 & 总抵扣的金额
$orderTotalWineIntegral = bcadd($orderTotalWineIntegral,$orderWineIntegral,2); $orderTotalWineIntegral = bcadd($orderTotalWineIntegral,$orderWineIntegral,2);
$orderTotalWineIntegralPrice = bcadd($orderTotalWineIntegralPrice,$orderWineIntegralPrice,2); $orderTotalWineIntegralPrice = bcadd($orderTotalWineIntegralPrice,$orderWineIntegralPrice,2);
$orderTotalRandomReduction = bcadd($orderTotalRandomReduction,$orderRandomReduction,2); $orderTotalRandomReduction = bcadd($orderTotalRandomReduction,$orderRandomReduction,2);
$orderTotalWineDiffMoney = bcadd($orderTotalWineDiffMoney,$orderWineDiffMoney,2); $orderTotalWineDiffMoney = bcadd($orderTotalWineDiffMoney,$orderWineDiffMoney,2);
$orderTotalWineDiffMoneyPrice = bcadd($orderTotalWineDiffMoneyPrice,$orderWineDiffMoneyPrice,2); $orderTotalWineDiffMoneyPrice = bcadd($orderTotalWineDiffMoneyPrice,$orderWineDiffMoneyPrice,2);
$orderTotalMerQuota = bcadd($orderTotalMerQuota,$orderMerQuota,2);
$_pay_price = $merchantCart['order']['true_price']; $_pay_price = $merchantCart['order']['true_price'];
$valid_total_price = $merchantCart['order']['valid_total_price']; $valid_total_price = $merchantCart['order']['valid_total_price'];
@ -905,23 +919,16 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$merchantCart['order']['exchange_integral'] = $orderWineIntegral; $merchantCart['order']['exchange_integral'] = $orderWineIntegral;
$merchantCart['order']['wine_diff_money'] = $orderWineDiffMoney; $merchantCart['order']['wine_diff_money'] = $orderWineDiffMoney;
$merchantCart['order']['wine_diff_money_price'] = $orderWineDiffMoneyPrice; $merchantCart['order']['wine_diff_money_price'] = $orderWineDiffMoneyPrice;
$merchantCart['order']['org_price'] = $org_price; $merchantCart['order']['org_price'] = $org_price;
$merchantCart['order']['pay_price'] = $pay_price; $merchantCart['order']['pay_price'] = $pay_price;
$merchantCart['order']['coupon_price'] = $coupon_price; $merchantCart['order']['coupon_price'] = $coupon_price;
$merchantCart['order']['random_reduction'] = $orderRandomReduction; $merchantCart['order']['random_reduction'] = $orderRandomReduction;
$merchantCart['order']['mer_quota_deduction'] = $orderMerQuota;
$order_price = bcadd($order_price,$pay_price,2); $order_price = bcadd($order_price,$pay_price,2);
$order_total_price = bcadd($order_total_price,$total_price,2); $order_total_price = bcadd($order_total_price,$total_price,2);
} }
// 随机立减 - 减少订单总金额
// $order_price = (float)sprintf("%.2f",$order_price - $orderTotalRandomReduction);
// $order_total_price = (float)sprintf("%.2f",$order_total_price - $orderTotalRandomReduction);
unset($merchantCart); unset($merchantCart);
if($order_model){ if($order_model){
$allow_no_address = FALSE; $allow_no_address = FALSE;
@ -941,13 +948,10 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
$openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0; $openIntegral = $merIntegralFlag && !$order_type && $sysIntegralConfig['integral_status'] && $sysIntegralConfig['integral_money'] > 0;
$integralDeductionAmount = bcadd($order_total_integral_price,$orderTotalWineIntegralPrice,2); $integralDeductionAmount = bcadd($order_total_integral_price,$orderTotalWineIntegralPrice,2);
$total_coupon = bcadd($order_svip_discount,bcadd(bcadd($total_platform_coupon_price,$order_coupon_price,2),$integralDeductionAmount,2),2); $total_coupon = bcadd($order_svip_discount,bcadd(bcadd($total_platform_coupon_price,$order_coupon_price,2),$integralDeductionAmount,2),2);
$with_goods_mer_id = $withGoods['with_goods_mer_id'] ?? 0;
$data = compact( $data = compact(
'with_goods_mer_id', 'with_goods_mer_id',
'order_type', 'order_type',
@ -962,13 +966,12 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
'order_total_integral', 'order_total_integral',
'order_total_integral_price', 'order_total_integral_price',
'orderTotalWineIntegral', 'orderTotalWineIntegral',
'orderTotalWineIntegralPrice', 'orderTotalWineIntegralPrice',
'orderTotalWineDiffMoney', 'orderTotalWineDiffMoney',
'orderTotalWineDiffMoneyPrice', 'orderTotalWineDiffMoneyPrice',
'orderTotalRandomReduction', 'orderTotalRandomReduction',
'orderTotalMerQuota',
'order_total_give_integral', 'order_total_give_integral',
'order_svip_discount', 'order_svip_discount',
@ -1187,6 +1190,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
'point_id' => $merchantCart['take']['id'] ?? 0, 'point_id' => $merchantCart['take']['id'] ?? 0,
// 随机立减金额 // 随机立减金额
'random_reduction' => $merchantCart['order']['random_reduction'] ?? 0, 'random_reduction' => $merchantCart['order']['random_reduction'] ?? 0,
// 进货订单 - 补货额度抵扣金额
'mer_quota_deduction' => $merchantCart['order']['mer_quota_deduction'] ?? 0,
]; ];
$allUseCoupon = array_merge($allUseCoupon,$merchantCart['order']['useCouponIds']); $allUseCoupon = array_merge($allUseCoupon,$merchantCart['order']['useCouponIds']);
@ -1224,6 +1229,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
'wine_diff_money_price' => $orderInfo['orderTotalWineDiffMoneyPrice'] ?? 0, 'wine_diff_money_price' => $orderInfo['orderTotalWineDiffMoneyPrice'] ?? 0,
// 随机立减金额 // 随机立减金额
'random_reduction' => $orderInfo['orderTotalRandomReduction'] ?? 0, 'random_reduction' => $orderInfo['orderTotalRandomReduction'] ?? 0,
// 进货订单 - 补货额度抵扣金额
'mer_quota_deduction' => $orderInfo['mer_quota_deduction'] ?? 0,
]; ];
event('order.create.before',compact('groupOrder','orderList')); event('order.create.before',compact('groupOrder','orderList'));
@ -1492,6 +1499,8 @@ class StoreOrderCreateRepository extends StoreOrderRepository{
'province_send_id' => $cart['province_send_id'] ?? 0, 'province_send_id' => $cart['province_send_id'] ?? 0,
// 随机立减金额 // 随机立减金额
'random_reduction' => $cart['random_reduction'] ?? 0, 'random_reduction' => $cart['random_reduction'] ?? 0,
// 进货订单 - 补货额度抵扣金额
'mer_quota_deduction' => $cart['mer_quota_deduction'] ?? 0,
]; ];
} }
$userMerchantRepository->getInfo($uid,$order['mer_id']); $userMerchantRepository->getInfo($uid,$order['mer_id']);

View File

@ -34,15 +34,17 @@ class MerchantQuotaRecordRepository extends BaseRepository{
/** /**
* Common: 商户补货额度变更 并且添加变更记录 * Common: 商户补货额度变更 并且添加变更记录
* Author: wu-hui * Author: wu-hui
* Time: 2024/05/27 11:51 * Time: 2024/05/27 15:56
* @param $params * @param int $merId 商户id
* @return array|\think\Model * @param float $quantity 变更数量
* @param int $changeType 变更类型0=减少1=增加
* @param int $source 变更来源0=后台手动处理1=补货减少
* @param int $orderId 订单id
* @return mixed
*/ */
public function changeQuota($params){ public function changeQuota(int $merId, float $quantity,int $changeType,int $source = 0,int $orderId = 0){
$quantity = abs($params['change_quantity'] ?? 0);
$merId = $params['mer_id'] ?? 0;
// 是否允许生成兑换码 // 是否允许生成兑换码
if(!in_array((int)$params['change_type'],[0, 1])) throw new ValidateException('非法请求,变更类型不明确!'); if(!in_array($changeType,[0, 1])) throw new ValidateException('非法请求,变更类型不明确!');
if($quantity <= 0) throw new ValidateException('变更数量必须大于0'); if($quantity <= 0) throw new ValidateException('变更数量必须大于0');
if($merId <= 0) throw new ValidateException('非法请求,商户不明确!'); if($merId <= 0) throw new ValidateException('非法请求,商户不明确!');
// 处理 // 处理
@ -52,7 +54,7 @@ class MerchantQuotaRecordRepository extends BaseRepository{
$merInfo = app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$merId])->field('quota_total,quota_used,quota_surplus')->findOrEmpty(); $merInfo = app()->make(MerchantRepository::class)->getSearch(['mer_id'=>$merId])->field('quota_total,quota_used,quota_surplus')->findOrEmpty();
$changeFront = $merInfo->quota_surplus ?? 0;// 变更前数量 $changeFront = $merInfo->quota_surplus ?? 0;// 变更前数量
// 根据操作类型进行处理 变更类型0=减少1=增加 // 根据操作类型进行处理 变更类型0=减少1=增加
if((int)$params['change_type'] == 1){ if($changeType == 1){
// 增加 // 增加
$changeAfter = sprintf("%.2f", $changeFront + $quantity); $changeAfter = sprintf("%.2f", $changeFront + $quantity);
$merInfo->quota_total += $quantity; $merInfo->quota_total += $quantity;
@ -67,10 +69,12 @@ class MerchantQuotaRecordRepository extends BaseRepository{
// 记录 // 记录
$record = [ $record = [
'mer_id' => $merId, 'mer_id' => $merId,
'change_type' => (int)$params['change_type'], 'change_type' => (int)$changeType,
'change_front' => $changeFront, 'change_front' => $changeFront,
'change_quantity' => $quantity, 'change_quantity' => $quantity,
'change_after' => $changeAfter, 'change_after' => $changeAfter,
'source' => $source,
'order_id' => $orderId
]; ];
$this->dao->create($record); $this->dao->create($record);

View File

@ -389,7 +389,8 @@ class Merchant extends BaseController
['change_quantity', 0], ['change_quantity', 0],
['mer_id', 0] ['mer_id', 0]
]); ]);
app()->make(MerchantQuotaRecordRepository::class)->changeQuota($params); app()->make(MerchantQuotaRecordRepository::class)
->changeQuota((int)$params['mer_id'],(float)$params['change_quantity'],(int)$params['change_type']);
return app('json')->success('变更成功'); return app('json')->success('变更成功');
} }

View File

@ -10,6 +10,7 @@ use app\common\model\user\User;
use app\common\model\user\UserInviteCode; use app\common\model\user\UserInviteCode;
use app\common\repositories\marketing\activity\RecordRepository; use app\common\repositories\marketing\activity\RecordRepository;
use app\common\repositories\marketing\AgentBrokerageRepository; use app\common\repositories\marketing\AgentBrokerageRepository;
use app\common\repositories\system\merchant\MerchantQuotaRecordRepository;
use app\common\repositories\system\merchant\MerchantRepository; use app\common\repositories\system\merchant\MerchantRepository;
use app\common\repositories\user\ExchangePickupPointRepository; use app\common\repositories\user\ExchangePickupPointRepository;
use app\common\repositories\user\ExchangeQuotaRepository; use app\common\repositories\user\ExchangeQuotaRepository;
@ -32,21 +33,26 @@ class OrderPaySuccessEvent{
if($groupOrder->activity_type == 30){ if($groupOrder->activity_type == 30){
// 在线支付订单 // 在线支付订单
$this->giveExchangeIntegral($groupOrder); $this->giveExchangeIntegral($groupOrder);
}else if($groupOrder->activity_type == 31){ }
else if($groupOrder->activity_type == 31){
// 兑换商品补差价处理 // 兑换商品补差价处理
$this->exchangeGoodsHandle($groupOrder); $this->exchangeGoodsHandle($groupOrder);
}else if($groupOrder->activity_type == 32){ }
else if($groupOrder->activity_type == 32){
// 代理入驻支付 // 代理入驻支付
$this->agentPaySuccessHandle($groupOrder); $this->agentPaySuccessHandle($groupOrder);
}else if($groupOrder->activity_type == 33){ }
else if($groupOrder->activity_type == 33){
// 加入活动支付成功 // 加入活动支付成功
$this->joinActivitySuccessHandle($groupOrder); $this->joinActivitySuccessHandle($groupOrder);
}else if($groupOrder->activity_type == 34){ }
else if($groupOrder->activity_type == 34){
// 邀请码激活 // 邀请码激活
$this->inviteCodeActivation($groupOrder); $this->inviteCodeActivation($groupOrder);
}else if($groupOrder->activity_type == 35){ }
// 酒道馆进货订单 暂无处理 else if($groupOrder->activity_type == 35){
// 进货订单
$this->quotaHandle($groupOrder);
}else{ }else{
// 其他订单 // 其他订单
$this->orderPaySuccessHandle($groupOrder); $this->orderPaySuccessHandle($groupOrder);
@ -68,15 +74,23 @@ class OrderPaySuccessEvent{
if($groupOrder->activity_type == 30){ if($groupOrder->activity_type == 30){
// 在线支付订单 // 在线支付订单
Log::info('支付成功 - 赠送酒水卡积分 - 错误: '.var_export($data,1)); Log::info('支付成功 - 赠送酒水卡积分 - 错误: '.var_export($data,1));
}else if($groupOrder->activity_type == 31){ }
else if($groupOrder->activity_type == 31){
Log::info('支付成功 - 兑换商品补差价处理 - 错误: '.var_export($data,1)); Log::info('支付成功 - 兑换商品补差价处理 - 错误: '.var_export($data,1));
}else if($groupOrder->activity_type == 32){ }
else if($groupOrder->activity_type == 32){
Log::info('支付成功 - 邀请代理人员奖励及免审核 - 错误: '.var_export($data,1)); Log::info('支付成功 - 邀请代理人员奖励及免审核 - 错误: '.var_export($data,1));
}else if($groupOrder->activity_type == 33){ }
else if($groupOrder->activity_type == 33){
Log::info('支付成功 - 加入活动支付成功 - 错误: '.var_export($data,1)); Log::info('支付成功 - 加入活动支付成功 - 错误: '.var_export($data,1));
}else if($groupOrder->activity_type == 34){ }
else if($groupOrder->activity_type == 34){
Log::info('支付成功 - 邀请码激活 - 错误: '.var_export($data,1)); Log::info('支付成功 - 邀请码激活 - 错误: '.var_export($data,1));
}else{ }
else if($groupOrder->activity_type == 35){
Log::info('支付成功 - 进货订单 - 错误: '.var_export($data,1));
}
else{
Log::info('支付成功 - 赠送酒卡额度 - 错误: '.var_export($data,1)); Log::info('支付成功 - 赠送酒卡额度 - 错误: '.var_export($data,1));
} }
} }
@ -262,7 +276,21 @@ class OrderPaySuccessEvent{
return true; return true;
} }
// 支付成功 - 进货订单相关处理
public function quotaHandle($groupOrder){
// 循环处理
foreach($groupOrder->orderList as $orderInfo){
$with_goods_mer_id = $orderInfo->with_goods_mer_id ?? 0;
$mer_quota_deduction = $orderInfo->mer_quota_deduction ?? 0;
// 存在进货商户id 存在补货金额
if($with_goods_mer_id > 0 && $mer_quota_deduction > 0){
app()->make(MerchantQuotaRecordRepository::class)
->changeQuota((int)$with_goods_mer_id,(float)$mer_quota_deduction, 0, 1,(int)$orderInfo->order_id);
}
}
return true;
}