修改分佣的错误

This commit is contained in:
luofei 2023-06-13 13:44:18 +08:00
parent 1ba676c6cd
commit d764835d73

View File

@ -42,8 +42,8 @@ class paySuccessOrder
$commission_rate = ($event['order']['commission_rate'] / 100);
//该笔订单平台总手续费
$this->totalAmount = bcmul((string)$event['order']['total_price'], (string)$commission_rate, 2);
$this->totalAmount = bcmul($this->totalAmount, (string)$event['order']['extension_one'], 2);
$this->totalAmount = bcmul($this->totalAmount, (string)$event['order']['extension_two'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$event['order']['extension_one'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$event['order']['extension_two'], 2);
$this->remain = $this->totalAmount;
//镇团队佣金
@ -59,11 +59,11 @@ class paySuccessOrder
->where('is_refund', 0)
->whereIn('source', [StoreCartDao::SOURCE_STORE_CLOUD, StoreCartDao::SOURCE_CLOUD])
->group('source_id')
->column('source,source_id,sum(product_price) total');
->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 = bcmul($this->totalAmount, (string)$item['extension_one'], 2);
$this->totalAmount = bcmul($this->totalAmount, (string)$item['extension_two'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$item['extension_one'], 2);
$this->totalAmount = bcsub($this->totalAmount, (string)$item['extension_two'], 2);
if ($this->totalAmount <= 0) {
continue;
}