diff --git a/ZR.Admin.WebApi/Controllers/HomeController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs similarity index 61% rename from ZR.Admin.WebApi/Controllers/HomeController.cs rename to ZR.Admin.WebApi/Controllers/CommonController.cs index c670ea5..d252b86 100644 --- a/ZR.Admin.WebApi/Controllers/HomeController.cs +++ b/ZR.Admin.WebApi/Controllers/CommonController.cs @@ -10,12 +10,16 @@ using ZR.Common; namespace ZR.Admin.WebApi.Controllers { - public class HomeController : BaseController + /// + /// 公共模块 + /// + [Route("[controller]/[action]")] + public class CommonController : BaseController { private OptionsSetting OptionsSetting; private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); - public HomeController(IOptions options) + public CommonController(IOptions options) { OptionsSetting = options.Value; } @@ -25,50 +29,18 @@ namespace ZR.Admin.WebApi.Controllers /// /// [HttpGet, Route("health/index")] - [Log()] public IActionResult Health() { return SUCCESS(true); } - /// - /// 加密 - /// - /// - /// - 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 }); - } - - /// - /// 解密 - /// - /// - /// - 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 }); - } - /// /// 发送邮件 /// /// 请求参数接收实体 /// [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)) diff --git a/ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs b/ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs similarity index 100% rename from ZR.Admin.WebApi/Controllers/CodeGeneratorController.cs rename to ZR.Admin.WebApi/Controllers/System/CodeGeneratorController.cs diff --git a/ZR.Vue/src/api/common.js b/ZR.Vue/src/api/common.js index b106f3b..a13d608 100644 --- a/ZR.Vue/src/api/common.js +++ b/ZR.Vue/src/api/common.js @@ -16,7 +16,7 @@ export function upload(data) { */ export function sendEmail(data) { return request({ - url: '/home/SendEmail', + url: '/common/SendEmail', method: 'POST', data: data, })