fix(settings): honor per-day trading hours and refresh SuperAdmin overlay
Use trading_hours_by_day for close_price gates, prefer public SuperAdmin fetch, and add refresh endpoint/command so stale last-good cache no longer keeps switches like enable_automation off. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -78,6 +78,31 @@ class SettingsController extends Controller
|
||||
return response()->json($rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* پاک کردن کش overlay و خواندن دوباره از سوپرادمین
|
||||
* (سوییچهایی مثل enable_automation بعد از تغییر در پنل سوپرادمین).
|
||||
*/
|
||||
public function refreshSuperAdminOverlay()
|
||||
{
|
||||
$result = app(SuperAdminProgramSettingsOverlay::class)->refreshFromSuperAdmin();
|
||||
|
||||
if (! ($result['ok'] ?? false)) {
|
||||
return response()->json([
|
||||
'message' => 'ارتباط با سوپرادمین برقرار نشد؛ کش پاک شد و در درخواست بعدی دوباره تلاش میشود',
|
||||
'ok' => false,
|
||||
'count' => 0,
|
||||
], 502);
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => 'تنظیمات پیشرفته از سوپرادمین همگام شد',
|
||||
'ok' => true,
|
||||
'count' => (int) ($result['count'] ?? 0),
|
||||
'enable_automation' => $result['enable_automation'] ?? null,
|
||||
'source' => $result['source'] ?? 'superadmin',
|
||||
]);
|
||||
}
|
||||
|
||||
public function edit(Request $request)
|
||||
{
|
||||
$key = trim((string) $request->key);
|
||||
|
||||
@@ -174,6 +174,7 @@ class ReportController extends Controller
|
||||
$cached = $cache->get();
|
||||
if ($cached !== null) {
|
||||
$cached['gold_ounce'] = $this->resolveGoldOuncePayload();
|
||||
$cached = $config->applyGlobalTradingHoursToPayload($cached);
|
||||
|
||||
return $this->personalizeLastPriceForCustomer($cached);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user