mirror of
https://github.com/certd/certd.git
synced 2026-05-18 22:57:31 +08:00
chore: 模版发邮件 plus
This commit is contained in:
@@ -78,7 +78,14 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="border border-gray-300 px-4 py-2">
|
||||
<AddonSelector v-model:model-value="item.addonId" addon-type="emailTemplate" from="sys" :type="item.name" :placeholder="t('certd.sys.setting.email.templateProviderSelectorPlaceholder')" />
|
||||
<AddonSelector
|
||||
v-model:model-value="item.addonId"
|
||||
:disabled="!settingStore.isPlus"
|
||||
addon-type="emailTemplate"
|
||||
from="sys"
|
||||
:type="item.name"
|
||||
:placeholder="t('certd.sys.setting.email.templateProviderSelectorPlaceholder')"
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@@ -150,10 +150,10 @@ export class EmailService implements IEmailService {
|
||||
|
||||
|
||||
async sendByTemplate(req: EmailSendByTemplateReq) {
|
||||
const emailConf = await this.sysSettingsService.getSetting<SysEmailConf>(SysEmailConf);
|
||||
|
||||
const template = emailConf?.templates?.[req.type]
|
||||
let content = null
|
||||
if (isPlus()) {
|
||||
const emailConf = await this.sysSettingsService.getSetting<SysEmailConf>(SysEmailConf);
|
||||
const template = emailConf?.templates?.[req.type]
|
||||
if (template && template.addonId) {
|
||||
const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getAddonById(template.addonId, true, 0)
|
||||
if (addon) {
|
||||
@@ -176,10 +176,13 @@ export class EmailService implements IEmailService {
|
||||
content = await addon.buildDefaultContent({ data: req.data })
|
||||
} catch (e) {
|
||||
// 对应的通知类型模版可能没有注册或者开发
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!content) {
|
||||
const addon: ITemplateProvider<EmailContent> = await this.addonGetterService.getBlank("emailTemplate", "common")
|
||||
content = await addon.buildDefaultContent({ data: req.data })
|
||||
//common类型的一定有,已经开发了
|
||||
}
|
||||
}
|
||||
return await this.send({
|
||||
...req.email,
|
||||
|
||||
Reference in New Issue
Block a user