mirror of
https://github.com/certd/certd.git
synced 2026-04-15 21:40:53 +08:00
chore: 1
This commit is contained in:
@@ -42,10 +42,13 @@ export class EmailService implements IEmailService {
|
||||
* receivers: string[];
|
||||
*/
|
||||
|
||||
await this.plusService.request('/activation/emailSend', {
|
||||
subject: email.subject,
|
||||
text: email.content,
|
||||
to: email.receivers,
|
||||
await this.plusService.request({
|
||||
url: '/activation/emailSend',
|
||||
data: {
|
||||
subject: email.subject,
|
||||
text: email.content,
|
||||
to: email.receivers,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { Config, Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { SysSettingsService } from '../../system/service/sys-settings-service.js';
|
||||
import { SysInstallInfo } from '../../system/service/models.js';
|
||||
import { appKey, getPlusInfo } from '@certd/pipeline';
|
||||
@@ -11,8 +11,16 @@ import { logger } from '../../../utils/logger.js';
|
||||
export class PlusService {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
@Config('plus.server.baseUrl')
|
||||
plusServerBaseUrl;
|
||||
|
||||
async request(url: string, data: any) {
|
||||
async requestWithoutSign(config: any) {
|
||||
config.baseURL = this.plusServerBaseUrl;
|
||||
return await request(config);
|
||||
}
|
||||
|
||||
async request(config: any) {
|
||||
const { url, data } = config;
|
||||
const timestamps = Date.now();
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
const sign = await this.sign(data, timestamps);
|
||||
@@ -29,10 +37,9 @@ export class PlusService {
|
||||
'Content-Type': 'application/json',
|
||||
'X-Plus-Subject': requestHeaderStr,
|
||||
};
|
||||
const baseUrl = 'http://127.0.0.1:11007';
|
||||
return await request({
|
||||
url: url,
|
||||
baseURL: baseUrl,
|
||||
baseURL: this.plusServerBaseUrl,
|
||||
method: 'POST',
|
||||
data: data,
|
||||
headers: headers,
|
||||
@@ -51,4 +58,12 @@ export class PlusService {
|
||||
logger.info('content:', content, 'sign:', sign);
|
||||
return sign;
|
||||
}
|
||||
|
||||
async active(formData: { code: any; appKey: string; subjectId: string }) {
|
||||
return await this.requestWithoutSign({
|
||||
url: '/activation/active',
|
||||
method: 'post',
|
||||
data: formData,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user