feat: 支持配置系统图标
This commit is contained in:
@@ -19,7 +19,7 @@ export class AppController {
|
||||
@Get('app-info')
|
||||
@ApiOperation({ summary: '应用基本信息(公开)' })
|
||||
async appInfo() {
|
||||
const appName = await this.settings.get('appName');
|
||||
return { appName };
|
||||
const all = await this.settings.getAll();
|
||||
return { appName: all.appName, appIconUrl: all.appIconUrl };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export class SettingsController {
|
||||
@ApiOperation({ summary: '获取公开设置(应用名等)' })
|
||||
async getPublic() {
|
||||
const all = await this.settingsService.getAll();
|
||||
return { appName: all.appName, carouselInterval: all.carouselInterval, filingInfo: all.filingInfo };
|
||||
return { appName: all.appName, appIconUrl: all.appIconUrl, carouselInterval: all.carouselInterval, filingInfo: all.filingInfo };
|
||||
}
|
||||
|
||||
@ApiBearerAuth()
|
||||
|
||||
@@ -4,6 +4,7 @@ import { PrismaService } from '../prisma/prisma.service';
|
||||
|
||||
const EDITABLE_KEYS = [
|
||||
'appName',
|
||||
'appIconUrl',
|
||||
'logRetentionDays',
|
||||
'operationLogRetentionDays',
|
||||
'watermarkText',
|
||||
@@ -26,6 +27,7 @@ export class SettingsService {
|
||||
const rows = await this.prisma.systemSetting.findMany();
|
||||
const map: Record<string, string> = {
|
||||
appName: this.config.get<string>('appName') || '',
|
||||
appIconUrl: '/app-icon.svg',
|
||||
logRetentionDays: String(this.config.get<number>('logRetentionDays') || 365),
|
||||
operationLogRetentionDays: '365',
|
||||
watermarkText: this.config.get<string>('watermarkText') || '仅供溯源核验使用',
|
||||
@@ -39,6 +41,7 @@ export class SettingsService {
|
||||
for (const r of rows) {
|
||||
map[r.key] = r.key === 'appName' && r.value === '艺术品可信溯源与认证平台' ? '艺术品溯源平台' : r.value;
|
||||
}
|
||||
if (!map.appIconUrl) map.appIconUrl = '/app-icon.svg';
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user