调试平台手续费分润

This commit is contained in:
luofei 2023-05-26 11:01:44 +08:00
parent a70a4de2e3
commit fb6aa84bfa
3 changed files with 14 additions and 10 deletions

View File

@ -351,7 +351,7 @@ class StoreOrderRepository extends BaseRepository
$merchantRepo = app()->make(MerchantRepository::class);
$merchantRepo->merId = $order->mer_id;
$merchantRepo->forceMargin = false;
[$_payPrice, $finance] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
[$_payPrice, $finance, $increase] = $merchantRepo->autoMargin($_payPrice, $order, $finance, $financeSn, $i++);
}
$finance[] = [
'order_id' => $order->order_id,

View File

@ -672,7 +672,7 @@ class MerchantRepository extends BaseRepository
$merchant = Merchant::find($this->merId);
//商户保证金未完全缴纳且设置了自动扣除比例
if ($merchant['margin'] <= $merchant['paid_margin'] || ($this->forceMargin === false && $merchant['auto_margin_rate'] <= 0 && $merchant['auto_margin_rate'] > 100)) {
return [$income, $finance];
return [$income, $finance, false];
}
$rate = $this->forceMargin ? 100 : $merchant['auto_margin_rate'];
//商户保证金未完全缴纳且设置了自动扣除比例
@ -692,7 +692,7 @@ class MerchantRepository extends BaseRepository
'financial_record_sn' => $financeSn . $index
];
Queue::push(AutoMarginJob::class, ['merId' => $this->merId, 'margin' => $margin]);
return [$income, $finance];
return [$income, $finance, true];
}

View File

@ -55,12 +55,6 @@ class paySuccessOrder
if ($entryMerchant['type_id'] == Merchant::TypeStore) {
$merchantRate = systemConfig('commission_to_merchant_rate');
$merchantAmount = bcmul($this->totalAmount, (string)($merchantRate / 100), 2);
/** @var MerchantRepository $merchantRepo */
$merchantRepo = app()->make(MerchantRepository::class);
$merchantRepo->merId = $entryMerId;
$merchantRepo->forceMargin = true;
[$merchantAmount, $this->finance] = $merchantRepo->autoMargin($merchantAmount, $event['order'], $this->finance, $this->financeSn, $this->index);
$this->index++;
if ($merchantAmount > 0) {
$this->finance[] = [
'order_id' => $this->event['order']['order_id'],
@ -75,7 +69,17 @@ class paySuccessOrder
'financial_record_sn' => $this->financeSn . $this->index
];
$this->index++;
app()->make(MerchantRepository::class)->addLockMoney($entryMerId, 'order', $event['order']['order_id'], (float)$merchantAmount);
/** @var MerchantRepository $merchantRepo */
$merchantRepo = app()->make(MerchantRepository::class);
$merchantRepo->merId = $entryMerId;
$merchantRepo->forceMargin = true;
[$merchantAmount, $this->finance, $increase] = $merchantRepo->autoMargin($merchantAmount, $event['order'], $this->finance, $this->financeSn, $this->index);
if ($increase) {
$this->index++;
}
if ($merchantAmount > 0) {
app()->make(MerchantRepository::class)->addLockMoney($entryMerId, 'order', $event['order']['order_id'], (float)$merchantAmount);
}
}
}