perf: 支持邮件模版设置

This commit is contained in:
xiaojunnuo
2025-12-14 01:36:20 +08:00
parent 437d956cad
commit a6c0d2c6f1
31 changed files with 703 additions and 214 deletions
@@ -1,6 +1,7 @@
import { ALL, Body, Controller, Inject, Post, Provide, Query } from "@midwayjs/core";
import {
addonRegistry,
AddonService,
CrudController,
SysPrivateSettings,
SysPublicSettings,
@@ -30,6 +31,8 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
pipelineService: PipelineService;
@Inject()
codeService: CodeService;
@Inject()
addonService: AddonService;
getService() {
return this.service;
@@ -86,6 +89,25 @@ export class SysSettingsController extends CrudController<SysSettingsService> {
return this.ok(conf);
}
@Post('/getEmailTemplates', { summary: 'sys:settings:view' })
async getEmailTemplates(@Body(ALL) body) {
const conf = await getEmailSettings(this.service, this.userSettingsService);
const templates = conf.templates || {}
const emailTemplateProviders = await this.addonService.getDefineList("emailTemplate")
const proviers = []
for (const item of emailTemplateProviders) {
const templateConf = templates[item.name] || {}
proviers.push({
name: item.name,
title: item.title,
addonId : templateConf.addonId,
})
}
return this.ok(proviers);
}
@Post('/saveEmailSettings', { summary: 'sys:settings:edit' })
async saveEmailSettings(@Body(ALL) body) {
const conf = await getEmailSettings(this.service, this.userSettingsService);