using Infrastructure; using Infrastructure.Attribute; using Microsoft.AspNetCore.Mvc; using System; namespace ZR.Admin.WebApi.Controllers { public class HomeController : BaseController { /// /// 心跳 /// /// [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 }); } } }