This commit is contained in:
xiaojunnuo
2024-11-07 02:05:20 +08:00
parent 17638f3d3a
commit cd83a6f209
2 changed files with 37 additions and 66 deletions

View File

@@ -1,7 +1,5 @@
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
import { BaseController, PlusService, SysInstallInfo, SysSettingsService } from '@certd/lib-server';
import { AppKey } from '@certd/plus-core';
import { logger } from '@certd/basic';
/**
*/
@@ -17,23 +15,8 @@ export class SysPlusController extends BaseController {
@Post('/active', { summary: 'sys:settings:edit' })
async active(@Body(ALL) body) {
const { code } = body;
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
const siteId = installInfo.siteId;
const formData = {
appKey: AppKey,
code,
subjectId: siteId,
};
const res: any = await this.plusService.active(formData);
if (res.code > 0) {
logger.error('激活失败', res.message);
return this.fail(res.message, 1);
}
const license = res.data.license;
await this.plusService.updateLicense(license);
await this.plusService.active(code);
return this.ok(true);
}
@@ -42,7 +25,7 @@ export class SysPlusController extends BaseController {
const { url } = body;
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
await this.plusService.bindUrl(installInfo.siteId, url);
await this.plusService.bindUrl(url);
installInfo.bindUrl = url;
await this.sysSettingsService.saveSetting(installInfo);