diff --git a/packages/ui/certd-server/.env.development.yaml b/packages/ui/certd-server/.env.development.yaml index 80433258..fac1338b 100644 --- a/packages/ui/certd-server/.env.development.yaml +++ b/packages/ui/certd-server/.env.development.yaml @@ -6,10 +6,10 @@ plus: server: baseUrl: 'https://api.ai.handsfree.work' -#typeorm: -# dataSource: -# default: -# database: './data/db1.sqlite' +typeorm: + dataSource: + default: + database: './data/db2.sqlite' #account: # server: # baseUrl: 'http://127.0.0.1:1017/subject' diff --git a/packages/ui/certd-server/src/modules/basic/service/plus-service.ts b/packages/ui/certd-server/src/modules/basic/service/plus-service.ts index 3b155131..6021d60f 100644 --- a/packages/ui/certd-server/src/modules/basic/service/plus-service.ts +++ b/packages/ui/certd-server/src/modules/basic/service/plus-service.ts @@ -47,28 +47,24 @@ export class PlusService { } licenseInfo.license = license; await this.sysSettingsService.saveSetting(licenseInfo); - await this.verify(); - } - async verify() { - const licenseInfo: SysLicenseInfo = await this.sysSettingsService.getSetting(SysLicenseInfo); - const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo); - - if (!licenseInfo.license) { - return; - } - const verifyRes = await verify({ - subjectId: installInfo.siteId, - license: licenseInfo.license, - plusRequestService: this.plusRequestService, - bindUrl: installInfo?.bindUrl, - }); - + const verifyRes = await this.verify(); if (!verifyRes.isPlus) { const message = verifyRes.message || '授权码校验失败'; logger.error(message); throw new Error(message); } } + async verify() { + const licenseInfo: SysLicenseInfo = await this.sysSettingsService.getSetting(SysLicenseInfo); + const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo); + + return await verify({ + subjectId: installInfo.siteId, + license: licenseInfo.license, + plusRequestService: this.plusRequestService, + bindUrl: installInfo?.bindUrl, + }); + } async bindUrl(subjectId: string, url: string) { return await this.plusRequestService.request({