| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace App\Models;
- use App\Services\ConfigService;
- use Illuminate\Support\Facades\App;
- use Illuminate\Support\Facades\Cache;
- class Config extends BaseModel
- {
- protected $table = 'config';
- protected $fillable = ['field', 'val', 'remark', 'group_id'];
- /*
- * group_id
- * 1 系统基础配置
- * 2 频道消息配置
- * 3 用户自定义配置
- * 4 极速PC28相关配置
- *
- *
- */
- public static function setPc28Switch()
- {
- $pc28_switch = Cache::get('pc28_switch');
- $val = static::where('field', 'pc28_switch')->first()->val;
- if ($pc28_switch == null) $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;
- App::setLocale($group_language);
- $groupText = "------" . lang("已切换为极速PC28") . "------";
- if ($pc28_switch == 0) $groupText = "-----" . lang("已切换为加拿大PC28") . "------";
- App::setLocale($lang);
- ConfigService::asyncBettingGroupNotice($groupText, isTop: true); // 异步群通知
- }
- }
- }
|