This commit is contained in:
2018-11-06 16:36:00 +08:00
parent c5b64d5466
commit df3597792d
2 changed files with 14 additions and 11 deletions
+12 -9
View File
@@ -7,12 +7,15 @@ using COMCMS.Common;
using COMCMS.Core;
using COMCMS.Web.Filter;
using XCode;
using COMCMS.Web.Common;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace COMCMS.Web.Controllers.api
{
[Produces("application/json")]
[Route("api/[controller]/[action]")]
[WebAPIHandleError]
public class IndexController : Controller
{
// GET: api/<controller>
@@ -23,7 +26,7 @@ namespace COMCMS.Web.Controllers.api
return cfg;
}
//#region 测试验签
#region 测试验签
/// <summary>
/// 测试验签
/// </summary>
@@ -32,13 +35,13 @@ namespace COMCMS.Web.Controllers.api
/// <param name="timeStamp"></param>
/// <param name="signature"></param>
/// <returns></returns>
//[HttpGet]
//[CheckFilter]
//public ReJSON CheckSign(string id, string random = "", string timeStamp = "", string signature = "")
//{
// return new ReJSON("验签成功!");
//}
//#endregion
[HttpGet]
[CheckFilter]
public ReJson CheckSign(string id, string random = "", string timeStamp = "", string signature = "")
{
return new ReJson("验签成功!");
}
#endregion
//#region 测试出错
//[HttpGet]
+2 -2
View File
@@ -37,7 +37,7 @@ namespace COMCMS.Web.Filter
var notVali = ValiSignature(context.HttpContext);
if (notVali == null)
if (notVali != null)
{
await context.HttpContext.Response.WriteAsync(notVali.ToJson());
}
@@ -74,7 +74,7 @@ namespace COMCMS.Web.Filter
}
//没有签名返回错误
if (string.IsNullOrEmpty(signature))
throw new Exception("signature Is Null");
return new ReJson(40004, "signature 为空!");
if (!MySign.CheckSign(pars, signature))
{