From 1b32e3ba6b2876a9593940ad9ed066d142b3451a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Wed, 1 Dec 2021 21:50:38 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...{HomeController.cs => CommonController.cs} | 42 ++++---------------
.../{ => System}/CodeGeneratorController.cs | 0
ZR.Vue/src/api/common.js | 2 +-
3 files changed, 8 insertions(+), 36 deletions(-)
rename ZR.Admin.WebApi/Controllers/{HomeController.cs => CommonController.cs} (61%)
rename ZR.Admin.WebApi/Controllers/{ => System}/CodeGeneratorController.cs (100%)
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,
})