68 lines
2.4 KiB
C#
68 lines
2.4 KiB
C#
using System;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Description;
|
|
using ESCG = CommercialApi.GeneralMethod;
|
|
using HZQR.Common;
|
|
|
|
namespace CommercialApi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 公共方法相关接口
|
|
/// </summary>
|
|
public class CommonController : BaseController
|
|
{
|
|
#region 方法 -> 解密字符串
|
|
/// <summary>
|
|
/// 解密字符串
|
|
/// </summary>
|
|
/// <param name="characterString">字符串</param>
|
|
/// <returns></returns>
|
|
[Route("Common/GetDecryptString")]
|
|
[AcceptVerbs("GET")]
|
|
[ResponseType(typeof(string))]
|
|
public IHttpActionResult GetDecryptString(string characterString)
|
|
{
|
|
try
|
|
{
|
|
return Ok(ESCG.Common.ReturnJson(100, "解密成功", characterString.ToDecrypt()));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
string Parameter = "入参信息:字符串【" + characterString + "】";
|
|
LogUtil.WriteLog(null, "解密失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetDecryptString");
|
|
return Ok(ESCG.Common.ReturnJson(999, "解密失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 方法 -> 加密字符串
|
|
/// <summary>
|
|
/// 加密字符串
|
|
/// </summary>
|
|
/// <param name="characterString">字符串</param>
|
|
/// <returns></returns>
|
|
[Route("Common/GetEncryptString")]
|
|
[AcceptVerbs("GET")]
|
|
[ResponseType(typeof(string))]
|
|
public IHttpActionResult GetEncryptString(string characterString)
|
|
{
|
|
try
|
|
{
|
|
return Ok(ESCG.Common.ReturnJson(100, "加密成功", characterString.ToEncrypt()));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
string Parameter = "入参信息:字符串【" + characterString + "】";
|
|
LogUtil.WriteLog(null, "加密失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetEncryptString");
|
|
return Ok(ESCG.Common.ReturnJson(999, "加密失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |