调整商户冻结金额入账
This commit is contained in:
parent
e95bf1e6e7
commit
b4ef286e4e
@ -564,30 +564,32 @@ class MerchantRepository extends BaseRepository
|
||||
Db::transaction(function () use ($order) {
|
||||
$money = 0;
|
||||
$make = app()->make(UserBillRepository::class);
|
||||
$bill = $make->search(['category' => 'mer_lock_money', 'type' => 'order', 'link_id' => '1' . $order->order_id, 'status' => 0])->find();
|
||||
if ($bill) {
|
||||
$money = bcsub($bill->number, $make->refundMerchantMoney($bill->link_id, $bill->type, $bill->mer_id), 2);
|
||||
if ($order->presellOrder) {
|
||||
$presellBill = $make->search(['category' => 'mer_lock_money', 'type' => 'presell', 'link_id' => '2' . $order->presellOrder->presell_order_id, 'status' => 0])->find();
|
||||
if ($presellBill) {
|
||||
$money = bcadd($money, bcsub($presellBill->number, $make->refundMerchantMoney($presellBill->link_id, $presellBill->type, $presellBill->mer_id), 2), 2);
|
||||
$presellBill->status = 1;
|
||||
$presellBill->save();
|
||||
$bills = $make->search(['category' => 'mer_lock_money', 'type' => 'order', 'link_id' => '1' . $order->order_id, 'status' => 0])->select();
|
||||
foreach ($bills as $bill) {
|
||||
if ($bill) {
|
||||
$money = bcsub($bill->number, $make->refundMerchantMoney($bill->link_id, $bill->type, $bill->mer_id), 2);
|
||||
if ($order->presellOrder) {
|
||||
$presellBill = $make->search(['category' => 'mer_lock_money', 'type' => 'presell', 'link_id' => '2' . $order->presellOrder->presell_order_id, 'status' => 0])->find();
|
||||
if ($presellBill) {
|
||||
$money = bcadd($money, bcsub($presellBill->number, $make->refundMerchantMoney($presellBill->link_id, $presellBill->type, $presellBill->mer_id), 2), 2);
|
||||
$presellBill->status = 1;
|
||||
$presellBill->save();
|
||||
}
|
||||
}
|
||||
$bill->status = 1;
|
||||
$bill->save();
|
||||
}
|
||||
if ($money > 0) {
|
||||
app()->make(UserBillRepository::class)->incBill($bill->uid, 'mer_computed_money', 'order', [
|
||||
'link_id' => $order->order_id,
|
||||
'mer_id' => $bill->mer_id,
|
||||
'status' => 0,
|
||||
'title' => '商户待解冻余额',
|
||||
'number' => $money,
|
||||
'mark' => '交易完成,商户待解冻余额' . floatval($money) . '元',
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
$bill->status = 1;
|
||||
$bill->save();
|
||||
}
|
||||
if ($money > 0) {
|
||||
app()->make(UserBillRepository::class)->incBill($order->uid, 'mer_computed_money', 'order', [
|
||||
'link_id' => $order->order_id,
|
||||
'mer_id' => $order->mer_id,
|
||||
'status' => 0,
|
||||
'title' => '商户待解冻余额',
|
||||
'number' => $money,
|
||||
'mark' => '交易完成,商户待解冻余额' . floatval($money) . '元',
|
||||
'balance' => 0
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user