Ken 5 napja
szülő
commit
0d238dacbd
1 módosított fájl, 6 hozzáadás és 4 törlés
  1. 6 4
      app/Models/Config.php

+ 6 - 4
app/Models/Config.php

@@ -24,17 +24,19 @@ class Config extends BaseModel
     public static function setPc28Switch()
     {
 
-        $pc28_switch = Cache::get('pc28_switch');
+        $pc28_switch = Cache::get('pc28_switch', 36);
+        $pc28_switch = intval($pc28_switch);
         $val = static::where('field', 'pc28_switch')->first()->val;
+        $val = intval($val);
         $m = new Message();
         $m->json = json_encode([
-            'pc28_switch'=>$pc28_switch,
+            'pc28_switch' => $pc28_switch,
             'val' => $val
         ]);
         $m->save();
 
-        if ($pc28_switch == null) $pc28_switch = $val;
-        if ($pc28_switch != $val) {
+        if (!in_array($pc28_switch,[0,1])) $pc28_switch = $val;
+        if ($pc28_switch !== $val) {
             static::where('field', 'pc28_switch')->update(['val' => $pc28_switch]);
             $lang = App::getLocale();
             $group_language = static::where('field', 'group_language')->first()->val;