mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
fix(email-service): 优化商业版测试邮件内容中带的url链接
This commit is contained in:
@@ -8,7 +8,7 @@ import { isComm, isPlus } from '@certd/plus-core';
|
||||
import nodemailer from 'nodemailer';
|
||||
import { SendMailOptions } from 'nodemailer';
|
||||
import { UserSettingsService } from '../../mine/service/user-settings-service.js';
|
||||
import { AddonService, PlusService, SysEmailConf, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
|
||||
import { AddonService, PlusService, SysEmailConf, SysInstallInfo, SysSettingsService, SysSiteInfo } from '@certd/lib-server';
|
||||
import { getEmailSettings } from '../../sys/settings/fix.js';
|
||||
import { UserEmailSetting } from "../../mine/service/models.js";
|
||||
import { AddonGetterService } from '../../pipeline/service/addon-getter-service.js';
|
||||
@@ -131,12 +131,21 @@ export class EmailService implements IEmailService {
|
||||
data: {
|
||||
title: '测试邮件,from certd',
|
||||
content: '测试邮件,from certd',
|
||||
url: "https://certd.handfree.work",
|
||||
url: await this.getTestEmailUrl(),
|
||||
},
|
||||
receivers: [receiver],
|
||||
});
|
||||
}
|
||||
|
||||
private async getTestEmailUrl() {
|
||||
const defaultUrl = "https://certd.docmirror.cn";
|
||||
if (!isComm()) {
|
||||
return defaultUrl;
|
||||
}
|
||||
const installInfo = await this.sysSettingsService.getSetting<SysInstallInfo>(SysInstallInfo);
|
||||
return installInfo?.bindUrl || installInfo?.bindUrl2 || defaultUrl;
|
||||
}
|
||||
|
||||
async list(userId: any) {
|
||||
const userEmailSetting = await this.settingsService.getSetting<UserEmailSetting>(userId,null, UserEmailSetting)
|
||||
return userEmailSetting.list;
|
||||
@@ -157,7 +166,6 @@ export class EmailService implements IEmailService {
|
||||
await this.settingsService.saveSetting(userId, null, userEmailSetting)
|
||||
}
|
||||
|
||||
|
||||
async sendByTemplate(req: EmailSendByTemplateReq) {
|
||||
let content = null
|
||||
const emailConf = await this.sysSettingsService.getSetting<SysEmailConf>(SysEmailConf);
|
||||
|
||||
Reference in New Issue
Block a user