消息(邮件/短信)模板服务
基于数据字典 MESSAGE_TEMPLATE 实现,可通过 API 或手动维护消息模板,并支持国际化。
| Modifiers | Name | Description |
|---|---|---|
static class |
TemplateService.Message |
通过模板生成的消息内容 |
static class |
TemplateService.Template |
模板定义 |
| Modifiers | Name | Description |
|---|---|---|
static Integer |
aliasOverridingOrder |
| Type | Name and description |
|---|---|
static void |
bootStrapInit()初始化 |
void |
createTemplateIfNotExists(TemplateService.Template template)创建消息模板 |
void |
createTemplateIfNotExists(String code, String name, String title, String bodyPrefix, String body, String bodySuffix, Boolean html, String notes = null) |
void |
createTemplatesIfNotExists(Collection<Template> templates) |
Map |
getMessage(String code, Map args) |
TemplateService.Template |
getTemplate(String code)获得模板 |
Message |
parseMessage(String code, Map args)根据模板格式化消息 |
void |
updateTemplate(TemplateService.Template template)更新消息模板 |
void |
updateTemplate(String code, String name = null, String title = null, String bodyPrefix = null, String body = null, String bodySuffix = null, Boolean html = null, String notes = null) |
| Methods inherited from class | Name |
|---|---|
class Object |
Object#wait(long, int), Object#wait(long), Object#wait(), Object#equals(Object), Object#toString(), Object#hashCode(), Object#getClass(), Object#notify(), Object#notifyAll() |
初始化
创建消息模板
获得模板
优先返回当前语言的模板。
根据模板格式化消息
code - 模板代码(可包含i18n后缀, 如 MESSAGE_TEMPLATE_A_zh_CN)args - 命名参数列表,参见 Template 的说明;如果 body 的值为列表,则会循环拼接多次正文模板为消息正文。更新消息模板