Config.php 1006 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace App\Models;
  3. use App\Services\ConfigService;
  4. use Illuminate\Support\Facades\Cache;
  5. class Config extends BaseModel
  6. {
  7. protected $table = 'config';
  8. protected $fillable = ['field', 'val', 'remark', 'group_id'];
  9. /*
  10. * group_id
  11. * 1 系统基础配置
  12. * 2 频道消息配置
  13. * 3 用户自定义配置
  14. * 4 极速PC28相关配置
  15. *
  16. *
  17. */
  18. public static function setPc28Switch()
  19. {
  20. $pc28_switch = Cache::get('pc28_switch');
  21. $val = static::where('field', 'pc28_switch')->first()->val;
  22. if ($pc28_switch == null) $pc28_switch = $val;
  23. if ($pc28_switch != $val) {
  24. static::where('field', 'pc28_switch')->update(['val' => $pc28_switch]);
  25. $groupText = "------已切换为极速PC28------";
  26. if ($pc28_switch == 0) $groupText = "-----已切换为加拿大PC28------";
  27. ConfigService::asyncBettingGroupNotice($groupText,isTop:true); // 异步群通知
  28. }
  29. }
  30. }