diff --git a/app/listener/paySuccessOrder.php b/app/listener/paySuccessOrder.php index 4ac7b704..280c310d 100644 --- a/app/listener/paySuccessOrder.php +++ b/app/listener/paySuccessOrder.php @@ -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; }