This commit is contained in:
xiaojunnuo
2024-09-25 09:46:13 +08:00
parent 3460d3ddca
commit ae816e614c
2 changed files with 16 additions and 20 deletions

View File

@@ -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({