fix(settings): drop program-settings last-good cache and prefer montzar
Stale Redis overlay and SMS-origin-first fetch kept feature flags like customer_special_pricing false after SuperAdmin turned them on. Always fetch live and try adm.montzar.ir first. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,9 +8,9 @@ use Illuminate\Console\Command;
|
||||
class SuperAdminProgramSettingsRefreshCommand extends Command
|
||||
{
|
||||
protected $signature = 'superadmin:refresh-program-settings
|
||||
{--clear-only : فقط کش last-good را پاک کن}';
|
||||
{--clear-only : فقط memo درخواست را ریست کن (دیگر کش Redis نیست)}';
|
||||
|
||||
protected $description = 'کش overlay تنظیمات سوپرادمین را پاک/تازه میکند';
|
||||
protected $description = 'تنظیمات دسترسی را دوباره از سوپرادمین میخواند (بدون کش)';
|
||||
|
||||
public function handle(): int
|
||||
{
|
||||
@@ -18,20 +18,24 @@ class SuperAdminProgramSettingsRefreshCommand extends Command
|
||||
|
||||
if ($this->option('clear-only')) {
|
||||
$overlay->flushCache();
|
||||
$this->line('cleared SuperAdmin program-settings cache');
|
||||
$this->line('cleared SuperAdmin program-settings request memo');
|
||||
|
||||
return self::SUCCESS;
|
||||
}
|
||||
|
||||
$result = $overlay->refreshFromSuperAdmin();
|
||||
if (! ($result['ok'] ?? false)) {
|
||||
$this->error('fetch from SuperAdmin failed — cache cleared; next HTTP request will retry');
|
||||
$this->error('fetch from SuperAdmin failed; next HTTP request will retry');
|
||||
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
||||
$items = is_array($result['items'] ?? null) ? $result['items'] : [];
|
||||
$meta = is_array($result['meta'] ?? null) ? $result['meta'] : [];
|
||||
$this->info('fetched '.(int) ($result['count'] ?? 0).' setting(s) from SuperAdmin');
|
||||
if ($meta !== []) {
|
||||
$this->line('meta: '.json_encode($meta, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES));
|
||||
}
|
||||
foreach ($items as $key => $value) {
|
||||
$this->line(" {$key}={$value}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user