mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 11:20:53 +08:00
refactor: 重构规范部分代码、邮件队列增加失败重试、去除多个支付方式、更新依赖
This commit is contained in:
@@ -10,6 +10,10 @@ use Illuminate\Support\Fluent;
|
||||
|
||||
class Setting extends Fluent
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->attributes = self::fromDatabase();
|
||||
}
|
||||
/**
|
||||
* 获取配置,并转化为数组.
|
||||
*
|
||||
@@ -129,21 +133,12 @@ class Setting extends Fluent
|
||||
public static function fromDatabase()
|
||||
{
|
||||
$values = [];
|
||||
|
||||
try {
|
||||
if(env('ADMIN_SETTING_CACHE') > 0){
|
||||
$values = Cache::remember('admin_settings', env('ADMIN_SETTING_CACHE'), function () {
|
||||
return SettingModel::pluck('value', 'name')->toArray();
|
||||
}
|
||||
);
|
||||
}else{
|
||||
$values = SettingModel::pluck('value', 'name')->toArray();
|
||||
}
|
||||
$values = Cache::remember('admin_settings', env('ADMIN_SETTING_CACHE', 0), function () {
|
||||
return SettingModel::pluck('value', 'name')->toArray();
|
||||
});
|
||||
} catch (QueryException $e) {
|
||||
return new static($values);
|
||||
// throw new \Exception('配置获取失败、请检查数据库配置');
|
||||
}
|
||||
|
||||
return new static($values);
|
||||
return $values;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user