Config.php 664 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Support\Facades\Cache;
  4. class Config extends BaseModel
  5. {
  6. protected $table = 'config';
  7. protected $fillable = ['field', 'val', 'remark', 'group_id'];
  8. /*
  9. * group_id
  10. * 1 系统基础配置
  11. * 2 频道消息配置
  12. * 3 用户自定义配置
  13. * 4 极速PC28相关配置
  14. *
  15. *
  16. */
  17. public static function setPc28Switch()
  18. {
  19. $pc28_switch = Cache::get('pc28_switch', null);
  20. if ($pc28_switch == null) $pc28_switch = static::where('field', 'pc28_switch')->first()->val;
  21. static::where('field', 'pc28_switch')->update(['val' => $pc28_switch]);
  22. }
  23. }