调整商户冻结金额入账

This commit is contained in:
luofei 2023-06-13 17:44:15 +08:00
parent e95bf1e6e7
commit b4ef286e4e

View File

@ -564,7 +564,8 @@ 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();
$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) {
@ -579,9 +580,9 @@ class MerchantRepository extends BaseRepository
$bill->save();
}
if ($money > 0) {
app()->make(UserBillRepository::class)->incBill($order->uid, 'mer_computed_money', 'order', [
app()->make(UserBillRepository::class)->incBill($bill->uid, 'mer_computed_money', 'order', [
'link_id' => $order->order_id,
'mer_id' => $order->mer_id,
'mer_id' => $bill->mer_id,
'status' => 0,
'title' => '商户待解冻余额',
'number' => $money,
@ -589,6 +590,7 @@ class MerchantRepository extends BaseRepository
'balance' => 0
]);
}
}
});
}