mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
chore: 整理依赖
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { AppKey, PlusRequestService, verify } from '@certd/plus-core';
|
||||
import { AppKey, getPlusInfo, PlusRequestService, verify } from '@certd/plus-core';
|
||||
import { logger } from '@certd/basic';
|
||||
import { SysInstallInfo, SysLicenseInfo, SysSettingsService } from '../../settings/index.js';
|
||||
|
||||
@Provide()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
export class PlusService {
|
||||
@@ -80,4 +79,22 @@ export class PlusService {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async register() {
|
||||
if (getPlusInfo().secret) {
|
||||
return;
|
||||
}
|
||||
const plusRequestService = await this.getPlusRequestService();
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
const res = await plusRequestService.requestWithoutSign({
|
||||
url: '/activation/subject/register',
|
||||
method: 'post',
|
||||
data: {
|
||||
appKey: AppKey,
|
||||
subjectId: installInfo.siteId,
|
||||
installTime: installInfo.installTime,
|
||||
},
|
||||
});
|
||||
await this.updateLicense(res.license);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user