初始化
缺陷:主题配色需要优化整体的同风格
This commit is contained in:
@@ -6,6 +6,7 @@ use App\BaseApp\BaseService;
|
||||
use App\Models\oss\OssConfigModel;
|
||||
use App\Service\common\FieldEncryptService;
|
||||
use App\Service\SystemConfigService;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* OSS 运行时配置:解析当前启用的存储配置并解密密钥,供上传工厂使用
|
||||
@@ -74,6 +75,32 @@ class OssRuntimeConfigService extends BaseService
|
||||
'extra_json' => null,
|
||||
];
|
||||
}
|
||||
return $this->formatConfig($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按 ID 获取明文配置
|
||||
*
|
||||
* 素材库要对指定 bucket 做列举与删除,不能只认「当前启用」那一份:
|
||||
* 换过存储之后老素材仍然躺在旧配置的 bucket 里,回收时必须拿旧配置去删。
|
||||
* 也因此这里不校验 status —— 配置被禁用不代表里面的对象不用管了。
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getConfigById(int $id): array
|
||||
{
|
||||
$row = OssConfigModel::where('id', $id)->where('deleted_at', 0)->first();
|
||||
if (!$row) {
|
||||
$this->utils->notFound('存储配置不存在');
|
||||
}
|
||||
return $this->formatConfig($row);
|
||||
}
|
||||
|
||||
/**
|
||||
* 库行转明文配置数组
|
||||
*/
|
||||
private function formatConfig(OssConfigModel $row): array
|
||||
{
|
||||
$enc = FieldEncryptService::getInstance();
|
||||
$extra = $row->extra_json;
|
||||
if (is_string($extra) && $extra !== '') {
|
||||
|
||||
Reference in New Issue
Block a user