调试平台手续费分润

This commit is contained in:
luofei 2023-05-26 11:47:25 +08:00
parent cf9aa8a3da
commit dbdf1028da

View File

@ -20,6 +20,7 @@ class paySuccessOrder
public $streetId;
public $financeSn;
public $index = 1;
public $remain;
public function handle($event)
{
@ -56,6 +57,7 @@ class paySuccessOrder
$merchantRate = systemConfig('commission_to_merchant_rate');
$merchantAmount = bcmul($this->totalAmount, (string)($merchantRate / 100), 2);
if ($merchantAmount > 0) {
$this->remain = bcsub($this->totalAmount, $merchantAmount, 2);
$this->finance[] = [
'order_id' => $this->event['order']['order_id'],
'order_sn' => $this->event['order']['order_sn'],
@ -91,6 +93,20 @@ class paySuccessOrder
$this->calculate(Merchant::TypeTeamServer, 'commission_to_service_team_rate');
//云仓佣金
$this->calculate(Merchant::TypeCloudWarehouse, 'commission_to_cloud_rate');
//平台佣金
$this->finance[] = [
'order_id' => $this->event['order']['order_id'],
'order_sn' => $this->event['order']['order_sn'],
'user_info' => $this->event['order']->user->nickname,
'user_id' => $this->event['order']['uid'],
'financial_type' => 'commission_to_platform',
'financial_pm' => 1,
'type' => 1,
'number' => $this->remain,
'mer_id' => 0,
'financial_record_sn' => $this->financeSn . $this->index
];
}
$financialRecordRepository->insertAll($this->finance);
@ -116,6 +132,7 @@ class paySuccessOrder
'commission_to_cloud_rate' => 'cloud_warehouse',
];
$amount = bcmul($this->totalAmount, (string)($rate / 100), 2);
$this->remain = bcsub($this->totalAmount, $amount, 2);
$this->finance[] = [
'order_id' => $this->event['order']['order_id'],
'order_sn' => $this->event['order']['order_sn'],