LMS.service/LMS.Common/Templates/EmailTemplateService.cs
lq1405 57402e0dda V1.0.4
1. 新增用户注册需要邮箱验证码
2. 机器码、软件权限控制、用户 隔离,除非超级管理员,其他用户只能看到自己下面的用户,管理员可以看到除超级管理员以外的所有
2025-03-16 23:01:50 +08:00

38 lines
1.1 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace LMS.Common.Templates
{
public class EmailTemplateService()
{
/// <summary>
/// 注册邮件模板
/// </summary>
public const string RegisterHtmlTemplates = """
<!DOCTYPE html>
<html>
<body>
<h1>LMS Registration Code</h1>
<p>Hi there,</p>
<p>Your code is <strong>{RegisterCode}</strong></p>
<p>The code is valid for 10 minutes, if it is not you, please ignore it.</p>
</body>
</html>
""";
/// <summary>
/// 替换模板的占位符
/// </summary>
/// <param name="template"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public static string ReplaceTemplate(string template, Dictionary<string, string> parameters)
{
// 替换占位符
foreach (var param in parameters)
{
template = template.Replace($"{{{param.Key}}}", param.Value);
}
return template;
}
}
}