mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
chore:
This commit is contained in:
@@ -6,3 +6,7 @@ plus:
|
||||
#plus:
|
||||
# server:
|
||||
# baseUrl: 'https://api.ai.handsfree.work'
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'http://127.0.0.1:1017/subject'
|
||||
|
||||
@@ -10,3 +10,7 @@ typeorm:
|
||||
plus:
|
||||
server:
|
||||
baseUrl: 'https://api.ai.handsfree.work'
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'https://ai.handsfree.work/subject'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Controller, Get, Inject, Provide } from '@midwayjs/core';
|
||||
import { Config, 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';
|
||||
import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '../../system/service/models.js';
|
||||
import { AppKey } from '@certd/pipeline';
|
||||
|
||||
/**
|
||||
*/
|
||||
@@ -11,6 +12,8 @@ import { SysInstallInfo, SysPublicSettings, SysSiteInfo } from '../../system/ser
|
||||
export class BasicSettingsController extends BaseController {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
@Config('account.server.baseUrl')
|
||||
accountServerBaseUrl: any;
|
||||
|
||||
@Get('/public', { summary: Constants.per.guest })
|
||||
public async getSysPublic() {
|
||||
@@ -20,13 +23,15 @@ export class BasicSettingsController extends BaseController {
|
||||
|
||||
@Get('/install', { summary: Constants.per.guest })
|
||||
public async getInstallInfo() {
|
||||
const settings = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
const settings: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
settings.accountServerBaseUrl = this.accountServerBaseUrl;
|
||||
settings.appKey = AppKey;
|
||||
return this.ok(settings);
|
||||
}
|
||||
|
||||
@Get('/siteInfo', { summary: Constants.per.guest })
|
||||
public async getSiteInfo() {
|
||||
const settings = await this.sysSettingsService.getSetting(SysSiteInfo);
|
||||
const settings: SysSiteInfo = await this.sysSettingsService.getSetting(SysSiteInfo);
|
||||
return this.ok(settings);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,4 +97,15 @@ export class PlusService {
|
||||
throw new Error(message);
|
||||
}
|
||||
}
|
||||
|
||||
async bindUrl(subjectId: string, url: string) {
|
||||
return await this.request({
|
||||
url: '/activation/subject/urlBind',
|
||||
data: {
|
||||
subjectId,
|
||||
appKey: AppKey,
|
||||
url,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,18 @@ export class SysPlusController extends BaseController {
|
||||
|
||||
await this.plusService.updateLicense(siteId, license);
|
||||
|
||||
return this.ok(true);
|
||||
}
|
||||
@Post('/bindUrl', { summary: 'sys:settings:edit' })
|
||||
async bindUrl(@Body(ALL) body: { url: string }) {
|
||||
const { url } = body;
|
||||
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
await this.plusService.bindUrl(installInfo.siteId, url);
|
||||
|
||||
installInfo.bindUrl = url;
|
||||
await this.sysSettingsService.saveSetting(installInfo);
|
||||
|
||||
return this.ok(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ export class SysInstallInfo extends BaseSettings {
|
||||
siteId?: string;
|
||||
bindUserId?: number;
|
||||
bindUrl?: string;
|
||||
accountServerBaseUrl?: string;
|
||||
appKey?: string;
|
||||
}
|
||||
|
||||
export class SysLicenseInfo extends BaseSettings {
|
||||
|
||||
Reference in New Issue
Block a user