fix bug
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Http\Controllers\Site\ReportController;
|
||||
use App\Models\Product;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
@@ -23,32 +22,6 @@ class ProductPriceSyncService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* sync سبک برای /customer/product/list — فقط zaarbox با کش کوتاه.
|
||||
* فید legacy (تا ۴۰ث timeout) فقط در کران اجرا میشود.
|
||||
*/
|
||||
public function syncForProductList(): bool
|
||||
{
|
||||
if (!$this->configService->getBool('product_update_price_on_list', true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
!Product::hasStoredPriceColumns()
|
||||
|| !Product::query()->whereNotNull('reading_method')->exists()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
return $this->zaarboxPriceService->syncProductsFromApi(false);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Zaarbox product list sync failed', ['message' => $e->getMessage()]);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** @param bool $forceRefresh درخواست تازه از https://price.zaarbox.ir/api/free (کران) */
|
||||
public function syncAll(bool $forceRefresh = false): bool
|
||||
{
|
||||
@@ -104,11 +77,10 @@ class ProductPriceSyncService
|
||||
$synced = true;
|
||||
|
||||
if ($product->bubble == 1) {
|
||||
$reportController = new ReportController();
|
||||
$liquidGold = $reportController->lastPrice();
|
||||
$liquidGoldPrice = app(ProductDisplayPriceService::class)->resolveAppBasePrice();
|
||||
$p = Product::find($product->id);
|
||||
if ($p && ($liquidGold['price'] ?? 0) > 0) {
|
||||
$p->amount = $RPrice['price'] / $liquidGold['price'];
|
||||
if ($p && $liquidGoldPrice > 0) {
|
||||
$p->amount = $RPrice['price'] / $liquidGoldPrice;
|
||||
$p->show = $show;
|
||||
$p->save();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user