更新修改分润逻辑只有会员按照采购款逻辑拆分,其余的分润还是按照正常的支付金额

This commit is contained in:
liu 2024-06-19 10:24:11 +08:00
parent b1e1e39164
commit 17a6b57673

View File

@ -309,20 +309,21 @@ class PayNotifyLogic extends BaseLogic
{
$financeLogic = new StoreFinanceFlowLogic();
$user_sing = new UserSign();
$vipFen = 0;
if ($order['uid'] > 0) {
// 结算金额 要支付的钱减去冻结得钱去走后面得逻辑 发得兑换券也要去减去
//用户下单该用户等级为1得时候才处理冻结金额
$user = User::where('id', $order['uid'])->find();
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度
//纯在分销关系的时候要去判断分销出来的用户的采购款的额度 (只有会员按照这个逻辑拆分,其余的还是按照正常的支付金额)
if ($order['spread_uid'] > 0) {
$oldUser = User::where('id',$order['spread_uid'])->field('purchase_funds,user_ship')->find();
if ($oldUser && $oldUser['user_ship'] == 1){
if ($oldUser['purchase_funds'] < $order['pay_price']) {
$order['pay_price'] = $oldUser['purchase_funds'];
$vipFen = $oldUser['purchase_funds'];
}
}
}elseif ($user['user_ship'] == 1){
}
elseif ($user['user_ship'] == 1){
$vipFrozenAmount = self::dealFrozenPrice($order['id']);
//为1的时候要去减活动价
// $final_price = bcsub($order['pay_price'],$order['deduction_price'],2);
@ -387,7 +388,11 @@ class PayNotifyLogic extends BaseLogic
// if ($order['is_vip'] >= 1) {
if ($order['spread_uid'] > 0) {
$financeLogic->other_arr['vip_uid'] = $order['spread_uid'];
if($vipFen){
$fees = bcdiv(bcmul($vipFen, '0.08', 2), 1, 2);
}else{
$fees = bcdiv(bcmul($order['pay_price'], '0.08', 2), 1, 2);
}
$count_frees = bcadd($count_frees, $fees, 2);
if ($fees > 0) {
User::where('id', $order['spread_uid'])->inc('now_money', $fees)->update();