Commit 12379576 authored by 黄奎's avatar 黄奎

1111

parent c5a80e61
...@@ -19,6 +19,10 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -19,6 +19,10 @@ namespace Mall.WebApi.Controllers.Adapay
[EnableCors("AllowCors")] [EnableCors("AllowCors")]
public class MessageController : ControllerBase public class MessageController : ControllerBase
{ {
public string token = "jjswviitto";
public string aes = "leHp9tJo9shWv63PFebqWT3UR6o5OKMD9YKFrDd2yxT";
public string appId = "wx5349e63aea0c8529";
/// <summary> /// <summary>
/// 接口认证 /// 接口认证
/// </summary> /// </summary>
...@@ -28,16 +32,22 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -28,16 +32,22 @@ namespace Mall.WebApi.Controllers.Adapay
/// <param name="nonce"></param> /// <param name="nonce"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public bool CheckSignature(string echostr, string signature, string timestamp, string nonce) public string CheckSignature(string echostr, string signature, string timestamp, string nonce)
{ {
string token = "jjsw"; Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(token, aes, appId);
string queryStr = string.Format("echostr:{0} signature:{1} timestamp:{2} nonce:{3}", echostr, signature, timestamp, nonce); string sVerifyMsgSig = signature;
Common.Plugin.LogHelper.WriteInfo(queryStr); string sVerifyTimeStamp = timestamp;
if (!CheckSignatureModule(token, signature, timestamp, nonce)) string sVerifyNonce = nonce;
string sVerifyEchoStr = echostr;
string sEchoStr = "";
int ret = wxcpt.VerifySignature(token, sVerifyTimeStamp, sVerifyNonce, sVerifyEchoStr, sVerifyMsgSig);
if (ret != 0)
{ {
return false; Common.Plugin.LogHelper.Write("验证Url失败:" + ret);
} }
return true;
return sEchoStr;
} }
/// <summary> /// <summary>
...@@ -80,5 +90,7 @@ namespace Mall.WebApi.Controllers.Adapay ...@@ -80,5 +90,7 @@ namespace Mall.WebApi.Controllers.Adapay
return false; return false;
} }
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment