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