Files
certd/packages/ui/certd-server/src/modules/basic/controller/settings-controller.ts
T

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-10-05 01:46:25 +08:00
import { ALL, Body, Config, Controller, Get, Inject, Provide } from '@midwayjs/core';
import { BaseController, Constants, SysInstallInfo, SysPublicSettings, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
import { AppKey, getPlusInfo } from '@certd/pipeline';
/**
*/
@Provide()
@Controller('/api/basic/settings')
export class BasicSettingsController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
2024-09-24 02:42:08 +08:00
@Config('account.server.baseUrl')
accountServerBaseUrl: any;
@Get('/public', { summary: Constants.per.guest })
public async getSysPublic() {
2024-08-02 23:59:08 +08:00
const settings = await this.sysSettingsService.getSetting(SysPublicSettings);
return this.ok(settings);
}
2024-08-25 01:55:34 +08:00
@Get('/install', { summary: Constants.per.guest })
public async getInstallInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
settings.accountServerBaseUrl = this.accountServerBaseUrl;
settings.appKey = AppKey;
2024-08-25 01:55:34 +08:00
return this.ok(settings);
}
2024-09-23 11:27:53 +08:00
@Get('/siteInfo', { summary: Constants.per.guest })
public async getSiteInfo() {
2024-09-24 02:42:08 +08:00
const settings: SysSiteInfo = await this.sysSettingsService.getSetting(SysSiteInfo);
2024-09-23 11:27:53 +08:00
return this.ok(settings);
}
2024-10-05 01:46:25 +08:00
@Get('/plusInfo', { summary: Constants.per.guest })
async plusInfo(@Body(ALL) body: any) {
const info = getPlusInfo();
return this.ok({
...info,
});
}
}