修改佣金计算的错误

This commit is contained in:
luofei 2023-06-13 14:27:38 +08:00
parent e4ae83b094
commit 3dda5021a9

View File

@ -41,9 +41,9 @@ class paySuccessOrder
$commission_rate = ($event['order']['commission_rate'] / 100);
//该笔订单平台总手续费
$this->totalAmount = bcmul((string)$event['order']['total_price'], (string)$commission_rate, 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$event['order']['extension_one'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$event['order']['extension_two'], 2);
$realPrice = bcsub((string)$event['order']['total_price'], (string)$event['order']['extension_one'], 2);
$realPrice = bcsub($realPrice, (string)$event['order']['extension_two'], 2);
$this->totalAmount = bcmul($realPrice, (string)$commission_rate, 2);
$this->remain = $this->totalAmount;
//镇团队佣金
@ -61,9 +61,9 @@ class paySuccessOrder
->group('source_id')
->column('source,source_id,sum(product_price) total,extension_one,extension_two');
foreach ($orderProduct as $item) {
$this->totalAmount = bcmul((string)$item['total'], (string)$commission_rate, 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$item['extension_one'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$item['extension_two'], 2);
$realTotal = bcsub((string)$item['total'], (string)$item['extension_one'], 2);
$realTotal = bcsub($realTotal, (string)$item['extension_two'], 2);
$this->totalAmount = bcmul($realTotal, (string)$commission_rate, 2);
if ($this->totalAmount <= 0) {
continue;
}