fix price show when mazane is 0
This commit is contained in:
@@ -392,9 +392,10 @@ class ReportController extends Controller
|
|||||||
if ($priceValue <= 0) {
|
if ($priceValue <= 0) {
|
||||||
$lastPrice = Price::latest()->first();
|
$lastPrice = Price::latest()->first();
|
||||||
$storedPrice = $lastPrice ? (float) $lastPrice->price : 0.0;
|
$storedPrice = $lastPrice ? (float) $lastPrice->price : 0.0;
|
||||||
$useFallback = $request->boolean('force_refresh') || $show_last_price;
|
|
||||||
|
|
||||||
if ($storedPrice > 30_000_000 && $useFallback) {
|
// fallback فقط با show_last_price تصمیمگیری میشود؛ force_refresh (تیک کران) نباید آن را override کند.
|
||||||
|
// آستانهٔ ثابت قبلی (۳۰ میلیون) برای طلا بود و محصولات ارزانتر مثل کاتد مس/نقره را اشتباهاً «بدون مظنه» میکرد.
|
||||||
|
if ($storedPrice > 0 && $show_last_price) {
|
||||||
$priceValue = $storedPrice;
|
$priceValue = $storedPrice;
|
||||||
$priceSource = 'database_last';
|
$priceSource = 'database_last';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ class ZaarboxPriceService
|
|||||||
'id' => trim((string) ($row['id'] ?? '')),
|
'id' => trim((string) ($row['id'] ?? '')),
|
||||||
'category' => trim((string) ($row['category'] ?? '')),
|
'category' => trim((string) ($row['category'] ?? '')),
|
||||||
'active' => (bool) ($row['active'] ?? false),
|
'active' => (bool) ($row['active'] ?? false),
|
||||||
|
'price' => $this->resolveReferenceProviderTotal($row),
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
->filter(fn (array $row) => $row['key'] !== '')
|
->filter(fn (array $row) => $row['key'] !== '')
|
||||||
|
|||||||
Reference in New Issue
Block a user