|
|
@ -164,7 +164,7 @@ class VerificationController extends Controller |
|
|
->where('order_id', $order->id) |
|
|
->where('order_id', $order->id) |
|
|
->with('supplier') |
|
|
->with('supplier') |
|
|
->select('*') |
|
|
->select('*') |
|
|
->selectRaw('sum(price) as sum_price,sum(service_persons) as sum_persons') |
|
|
|
|
|
|
|
|
->selectRaw('sum(price) as sum_price,sum(service_persons * num) as sum_persons') |
|
|
->groupBy('supplier_id') |
|
|
->groupBy('supplier_id') |
|
|
->get(); |
|
|
->get(); |
|
|
foreach ($orderItem as $v) { |
|
|
foreach ($orderItem as $v) { |
|
|
@ -206,15 +206,15 @@ class VerificationController extends Controller |
|
|
//
|
|
|
//
|
|
|
// }
|
|
|
// }
|
|
|
//}
|
|
|
//}
|
|
|
$supplier = Supplier::query()->where('id', $v->supplier_id)->lockForUpdate()->first(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$supplier = Supplier::query()->where('id', $v->supplier_id)->lockForUpdate()->first(); |
|
|
//处理交易金
|
|
|
//处理交易金
|
|
|
if ($order->single_price > 0 && $v->sum_persons > 0) { |
|
|
if ($order->single_price > 0 && $v->sum_persons > 0) { |
|
|
//计算交易金
|
|
|
//计算交易金
|
|
|
$deposit = bcmul($order->single_price,$v->sum_persons,6); |
|
|
$deposit = bcmul($order->single_price,$v->sum_persons,6); |
|
|
//流水
|
|
|
//流水
|
|
|
$statementCreate[] = $service->createByOrder( |
|
|
$statementCreate[] = $service->createByOrder( |
|
|
$deposit, |
|
|
|
|
|
|
|
|
bcmul($deposit, -1, 6), |
|
|
StatementType::DEPOSIT, |
|
|
StatementType::DEPOSIT, |
|
|
$v->supplier_id, |
|
|
$v->supplier_id, |
|
|
DemandTraits::$col[1], |
|
|
DemandTraits::$col[1], |
|
|
@ -222,10 +222,11 @@ class VerificationController extends Controller |
|
|
StatementTraits::$type[0] |
|
|
StatementTraits::$type[0] |
|
|
); |
|
|
); |
|
|
//扣
|
|
|
//扣
|
|
|
$supplierPrice = bcsub($supplierPrice,$deposit,6); |
|
|
|
|
|
$supplier->balance = bcadd($supplier->deposit_used, $supplierPrice, 6); |
|
|
|
|
|
$supplier->balance = bcsub($supplier->deposit_frozen, $supplierPrice, 6); |
|
|
|
|
|
|
|
|
$supplier->balance = bcsub($supplier->balance,$deposit,6); |
|
|
|
|
|
//$supplier->balance = bcadd($supplier->deposit_used, $supplierPrice, 6);
|
|
|
|
|
|
//$supplier->balance = bcsub($supplier->deposit_frozen, $supplierPrice, 6);
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$supplier->balance = bcadd($supplier->balance, $supplierPrice, 6); |
|
|
$supplier->balance = bcadd($supplier->balance, $supplierPrice, 6); |
|
|
$supplier->save(); |
|
|
$supplier->save(); |
|
|
} |
|
|
} |
|
|
|