refactor: 重构规范部分代码、邮件队列增加失败重试、去除多个支付方式、更新依赖

This commit is contained in:
xboard
2024-04-10 00:51:03 +08:00
parent ec63e05575
commit 4c6c7182e2
50 changed files with 421 additions and 1005 deletions

View File

@@ -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;
}
}