diff --git a/app/Http/Controllers/Site/ReportController.php b/app/Http/Controllers/Site/ReportController.php index c812ebd..41befa8 100644 --- a/app/Http/Controllers/Site/ReportController.php +++ b/app/Http/Controllers/Site/ReportController.php @@ -298,7 +298,7 @@ class ReportController extends Controller json_encode($montzarProduct, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ); - $montzarFlags = $config->syncMontzarOpenFlagsFromProduct($montzarProduct); + $montzarFlags = $config->montzarOpenFlags(); $montzar_open_buy = $montzarFlags['open_buy']; $montzar_open_sell = $montzarFlags['open_sell']; @@ -529,7 +529,7 @@ class ReportController extends Controller json_encode($montzarProduct, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ); - $montzarFlags = $config->syncMontzarOpenFlagsFromProduct($montzarProduct); + $montzarFlags = $config->montzarOpenFlags(); $openBuy = $montzarFlags['open_buy']; $openSell = $montzarFlags['open_sell']; diff --git a/app/Services/ConfigService.php b/app/Services/ConfigService.php index 7a66f7f..0e2614d 100644 --- a/app/Services/ConfigService.php +++ b/app/Services/ConfigService.php @@ -501,22 +501,16 @@ class ConfigService $this->UpdateConfig('montzar_closed', $staleLive > 0 ? 'false' : 'true'); } - public function syncMontzarOpenFlagsFromProduct(array $montzarProduct): array + /** + * باز/بسته بودن خرید و فروش فقط دست ادمین است — sync همکار آن را بازنویسی نمی‌کند. + * مقدار ذخیره‌شده در تنظیمات همان چیزی است که ادمین روشن/خاموش کرده. + */ + public function montzarOpenFlags(): array { - $openBuy = $this->getBool('montzar_open_buy', true); - $openSell = $this->getBool('montzar_open_sell', true); - - if (array_key_exists('open_buy', $montzarProduct)) { - $openBuy = filter_var($montzarProduct['open_buy'], FILTER_VALIDATE_BOOLEAN); - $this->UpdateConfig('montzar_open_buy', $openBuy ? 'true' : 'false'); - } - - if (array_key_exists('open_sell', $montzarProduct)) { - $openSell = filter_var($montzarProduct['open_sell'], FILTER_VALIDATE_BOOLEAN); - $this->UpdateConfig('montzar_open_sell', $openSell ? 'true' : 'false'); - } - - return ['open_buy' => $openBuy, 'open_sell' => $openSell]; + return [ + 'open_buy' => $this->getBool('montzar_open_buy', true), + 'open_sell' => $this->getBool('montzar_open_sell', true), + ]; } public function formatTradingTimeForDisplay(string $time): string