fix: resolve copper unit kilogram display and asset valuation calculations
This commit is contained in:
@@ -317,10 +317,24 @@ class WalletBalanceService
|
||||
->orderBy('id')
|
||||
->first();
|
||||
|
||||
return max(1, (int) ($product?->metal_id ?? 1));
|
||||
if ($product && (int) ($product->metal_id ?? 0) > 0) {
|
||||
return (int) $product->metal_id;
|
||||
}
|
||||
}
|
||||
|
||||
// در بورس مس، مس فلز اصلی پلتفرم است
|
||||
$hasCopperProduct = Product::query()
|
||||
->where('active', 1)
|
||||
->where('metal_id', 3)
|
||||
->exists();
|
||||
if ($hasCopperProduct) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
$metalIds = $this->catalogMetalIds();
|
||||
if (in_array(3, $metalIds, true)) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
return count($metalIds) === 1 ? (int) $metalIds[0] : 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user