mirror of
https://github.com/v2board/v2board.git
synced 2025-01-10 16:19:10 +08:00
update: optimize commission calculation
This commit is contained in:
parent
8a18bdf9c3
commit
9dc44c0e1d
@ -93,7 +93,6 @@ class CheckCommission extends Command
|
|||||||
0 => 100
|
0 => 100
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
$actualPayCommissionAmount = 0;
|
|
||||||
for ($l = 0; $l < $level; $l++) {
|
for ($l = 0; $l < $level; $l++) {
|
||||||
$inviter = User::find($inviteUserId);
|
$inviter = User::find($inviteUserId);
|
||||||
if (!$inviter) continue;
|
if (!$inviter) continue;
|
||||||
@ -119,10 +118,9 @@ class CheckCommission extends Command
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$inviteUserId = $inviter->invite_user_id;
|
$inviteUserId = $inviter->invite_user_id;
|
||||||
$actualPayCommissionAmount = $actualPayCommissionAmount + $commissionBalance;
|
// update order actual commission balance
|
||||||
|
$order->actual_commission_balance = $order->actual_commission_balance + $commissionBalance;
|
||||||
}
|
}
|
||||||
// update order commission balance
|
|
||||||
$order->commission_balance = $actualPayCommissionAmount;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +128,7 @@ CREATE TABLE `v2_order` (
|
|||||||
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待支付1开通中2已取消3已完成4已折抵',
|
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待支付1开通中2已取消3已完成4已折抵',
|
||||||
`commission_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待确认1发放中2有效3无效',
|
`commission_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0待确认1发放中2有效3无效',
|
||||||
`commission_balance` int(11) NOT NULL DEFAULT '0',
|
`commission_balance` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`actual_commission_balance` int(11) DEFAULT NULL COMMENT '实际支付佣金',
|
||||||
`paid_at` int(11) DEFAULT NULL,
|
`paid_at` int(11) DEFAULT NULL,
|
||||||
`created_at` int(11) NOT NULL,
|
`created_at` int(11) NOT NULL,
|
||||||
`updated_at` int(11) NOT NULL,
|
`updated_at` int(11) NOT NULL,
|
||||||
@ -371,4 +372,4 @@ CREATE TABLE `v2_user` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
-- 2022-01-21 18:20:29
|
-- 2022-02-07 07:04:34
|
||||||
|
@ -483,3 +483,6 @@ ALTER TABLE `v2_coupon`
|
|||||||
|
|
||||||
ALTER TABLE `v2_notice`
|
ALTER TABLE `v2_notice`
|
||||||
ADD `show` tinyint(1) NOT NULL DEFAULT '0' AFTER `content`;
|
ADD `show` tinyint(1) NOT NULL DEFAULT '0' AFTER `content`;
|
||||||
|
|
||||||
|
ALTER TABLE `v2_order`
|
||||||
|
ADD `actual_commission_balance` int(11) NULL COMMENT '实际支付佣金' AFTER `commission_balance`;
|
||||||
|
Loading…
Reference in New Issue
Block a user