优化项目
This commit is contained in:
parent
f0569f43f8
commit
1b32e3ba6b
@ -10,12 +10,16 @@ using ZR.Common;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers
|
||||
{
|
||||
public class HomeController : BaseController
|
||||
/// <summary>
|
||||
/// 公共模块
|
||||
/// </summary>
|
||||
[Route("[controller]/[action]")]
|
||||
public class CommonController : BaseController
|
||||
{
|
||||
private OptionsSetting OptionsSetting;
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
public HomeController(IOptions<OptionsSetting> options)
|
||||
public CommonController(IOptions<OptionsSetting> options)
|
||||
{
|
||||
OptionsSetting = options.Value;
|
||||
}
|
||||
@ -25,50 +29,18 @@ namespace ZR.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet, Route("health/index")]
|
||||
[Log()]
|
||||
public IActionResult Health()
|
||||
{
|
||||
return SUCCESS(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加密
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult Encrypt(string content)
|
||||
{
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
throw new Exception("content不能为空");
|
||||
}
|
||||
string key = ConfigUtils.Instance.GetConfig("DbKey");
|
||||
string encryptTxt = NETCore.Encrypt.EncryptProvider.DESEncrypt(content, key);
|
||||
return Ok(new { content, encryptTxt });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解密
|
||||
/// </summary>
|
||||
/// <param name="content"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult Decrypt(string content)
|
||||
{
|
||||
if (string.IsNullOrEmpty(content))
|
||||
{
|
||||
throw new Exception("content不能为空");
|
||||
}
|
||||
string key = ConfigUtils.Instance.GetConfig("DbKey");
|
||||
string encryptTxt = NETCore.Encrypt.EncryptProvider.DESDecrypt(content, key);
|
||||
return Ok(new { content, encryptTxt });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送邮件
|
||||
/// </summary>
|
||||
/// <param name="sendEmailVo">请求参数接收实体</param>
|
||||
/// <returns></returns>
|
||||
[ActionPermissionFilter(Permission = "tool:email:send")]
|
||||
[Log(Title = "发送邮件", IsSaveRequestData = false)]
|
||||
public IActionResult SendEmail([FromBody] SendEmailDto sendEmailVo)
|
||||
{
|
||||
if (sendEmailVo == null || string.IsNullOrEmpty(sendEmailVo.Subject) || string.IsNullOrEmpty(sendEmailVo.ToUser))
|
||||
@ -16,7 +16,7 @@ export function upload(data) {
|
||||
*/
|
||||
export function sendEmail(data) {
|
||||
return request({
|
||||
url: '/home/SendEmail',
|
||||
url: '/common/SendEmail',
|
||||
method: 'POST',
|
||||
data: data,
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user