mirror of
https://github.com/certd/certd.git
synced 2026-04-24 12:27:25 +08:00
Merge remote-tracking branch 'origin/v2-dev-cname-common' into v2-dev-cname-common
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
# key: ./data/ssl/cert.key
|
||||
# cert: ./data/ssl/cert.crt
|
||||
#plus:
|
||||
# server:
|
||||
# baseUrl: 'http://127.0.0.1:11007'
|
||||
|
||||
#flyway:
|
||||
# scriptDir: './db/migration-pg'
|
||||
|
||||
#typeorm:
|
||||
# dataSource:
|
||||
# default:
|
||||
# type: postgres
|
||||
# host: localhost
|
||||
# port: 5433
|
||||
# username: postgres
|
||||
# password: root
|
||||
# database: postgres
|
||||
|
||||
typeorm:
|
||||
dataSource:
|
||||
default:
|
||||
database: './data/db-plus-dev.sqlite'
|
||||
|
||||
# plus server: 'http://127.0.0.1:11007'
|
||||
|
||||
account:
|
||||
server:
|
||||
baseUrl: 'http://127.0.0.1:1017/subject'
|
||||
@@ -10,6 +10,7 @@
|
||||
"commdev": "cross-env NODE_ENV=commdev mwtsc --watch --run @midwayjs/mock/app",
|
||||
"commpro": "cross-env NODE_ENV=commpro mwtsc --watch --run @midwayjs/mock/app",
|
||||
"pgdev": "cross-env NODE_ENV=pgdev mwtsc --watch --run @midwayjs/mock/app",
|
||||
"local-plus": "cross-env NODE_ENV=localplus mwtsc --watch --run @midwayjs/mock/app",
|
||||
"pgpl": "cross-env NODE_ENV=pgpl mwtsc --watch --run @midwayjs/mock/app",
|
||||
"dev-new": "cross-env NODE_ENV=devnew mwtsc --watch --run @midwayjs/mock/app",
|
||||
"rm-db-new": "rimraf ./data/db-new.sqlite",
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { ALL, Body, Controller, Inject, Post, Provide } from '@midwayjs/core';
|
||||
import { BaseController, PlusService } from '@certd/lib-server';
|
||||
import { AppKey } from '@certd/plus-core';
|
||||
import { SysSettingsService } from '@certd/lib-server';
|
||||
import { SysInstallInfo } from '@certd/lib-server';
|
||||
import { BaseController, PlusService, SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
|
||||
export type PreBindUserReq = {
|
||||
userId: number;
|
||||
@@ -23,18 +20,8 @@ export class BasicController extends BaseController {
|
||||
|
||||
@Post('/preBindUser', { summary: 'sys:settings:edit' })
|
||||
public async preBindUser(@Body(ALL) body: PreBindUserReq) {
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
// 设置缓存内容
|
||||
await this.plusService.requestWithoutSign({
|
||||
url: '/activation/subject/preBind',
|
||||
method: 'POST',
|
||||
data: {
|
||||
userId: body.userId,
|
||||
appKey: AppKey,
|
||||
subjectId: installInfo.siteId,
|
||||
},
|
||||
});
|
||||
|
||||
await this.plusService.userPreBind(body.userId);
|
||||
return this.ok({});
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -49,14 +49,7 @@ export class EmailService implements IEmailService {
|
||||
* receivers: string[];
|
||||
*/
|
||||
|
||||
await this.plusService.request({
|
||||
url: '/activation/emailSend',
|
||||
data: {
|
||||
subject: email.subject,
|
||||
text: email.content,
|
||||
to: email.receivers,
|
||||
},
|
||||
});
|
||||
await this.plusService.sendEmail(email);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -32,7 +32,7 @@ export class CommonDnsProvider implements IDnsProvider {
|
||||
|
||||
await this.plusService.register();
|
||||
|
||||
const res = await this.plusService.requestWithoutSign({
|
||||
const res = await this.plusService.requestWithToken({
|
||||
url: '/activation/certd/cname/recordCreate',
|
||||
data: {
|
||||
subjectId: this.plusService.getSubjectId(),
|
||||
@@ -45,7 +45,7 @@ export class CommonDnsProvider implements IDnsProvider {
|
||||
return res;
|
||||
}
|
||||
async removeRecord(options: RemoveRecordOptions<any>) {
|
||||
const res = await this.plusService.requestWithoutSign({
|
||||
const res = await this.plusService.requestWithToken({
|
||||
url: '/activation/certd/cname/recordRemove',
|
||||
data: {
|
||||
subjectId: this.plusService.getSubjectId(),
|
||||
|
||||
Reference in New Issue
Block a user