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

42 lines
1.2 KiB
TypeScript
Raw Normal View History

import { Rule, RuleType } from '@midwayjs/validate';
2024-07-15 00:30:33 +08:00
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
import { BaseController } from '../../../basic/base-controller.js';
import { Constants } from '../../../basic/constants.js';
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
2024-08-25 01:55:34 +08:00
import { SysInstallInfo, SysPublicSettings } from '../../system/service/models.js';
export class SmsCodeReq {
@Rule(RuleType.number().required())
phoneCode: number;
@Rule(RuleType.string().required())
mobile: string;
@Rule(RuleType.string().required().max(10))
randomStr: string;
@Rule(RuleType.number().required().max(4))
imgCode: string;
}
/**
*/
@Provide()
@Controller('/api/basic/settings')
export class BasicSettingsController extends BaseController {
@Inject()
sysSettingsService: SysSettingsService;
@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() {
const settings = await this.sysSettingsService.getSetting(SysInstallInfo);
return this.ok(settings);
}
}