fix some bugs 6
This commit is contained in:
@@ -578,7 +578,9 @@ class WalletController extends Controller
|
|||||||
$walletTableWith = [
|
$walletTableWith = [
|
||||||
'customer:id,name,mobile',
|
'customer:id,name,mobile',
|
||||||
'fund:id,title',
|
'fund:id,title',
|
||||||
'product:id,metal_id,unit,amount,group_type,trade_by_quantity,direct_price,title',
|
'product' => static function ($q) {
|
||||||
|
$q->withTrashed()->select(['id', 'metal_id', 'unit', 'amount', 'group_type', 'trade_by_quantity', 'direct_price', 'title']);
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
$sumRows = (clone $sumQuery)->with($walletTableWith)->get();
|
$sumRows = (clone $sumQuery)->with($walletTableWith)->get();
|
||||||
|
|||||||
@@ -380,16 +380,23 @@ class WalletBalanceService
|
|||||||
|
|
||||||
private function lineProduct(mixed $line): ?object
|
private function lineProduct(mixed $line): ?object
|
||||||
{
|
{
|
||||||
if (is_object($line) && isset($line->product)) {
|
if (is_object($line) && isset($line->product) && $line->product) {
|
||||||
return $line->product;
|
return $line->product;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($line) && isset($line['product'])) {
|
if (is_array($line) && isset($line['product']) && $line['product']) {
|
||||||
$product = $line['product'];
|
$product = $line['product'];
|
||||||
|
|
||||||
return is_object($product) ? $product : (object) $product;
|
return is_object($product) ? $product : (object) $product;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$productId = (int) ($this->lineValue($line, 'product_id') ?? 0);
|
||||||
|
if ($productId > 0) {
|
||||||
|
return Product::withTrashed()
|
||||||
|
->select(['id', 'title', 'metal_id', 'unit', 'amount', 'group_type', 'trade_by_quantity', 'direct_price'])
|
||||||
|
->find($productId);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user