Commit 12379576 authored by 黄奎's avatar 黄奎

1111

parent c5a80e61
......@@ -19,6 +19,10 @@ namespace Mall.WebApi.Controllers.Adapay
[EnableCors("AllowCors")]
public class MessageController : ControllerBase
{
public string token = "jjswviitto";
public string aes = "leHp9tJo9shWv63PFebqWT3UR6o5OKMD9YKFrDd2yxT";
public string appId = "wx5349e63aea0c8529";
/// <summary>
/// 接口认证
/// </summary>
......@@ -28,16 +32,22 @@ namespace Mall.WebApi.Controllers.Adapay
/// <param name="nonce"></param>
/// <returns></returns>
[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";
string queryStr = string.Format("echostr:{0} signature:{1} timestamp:{2} nonce:{3}", echostr, signature, timestamp, nonce);
Common.Plugin.LogHelper.WriteInfo(queryStr);
if (!CheckSignatureModule(token, signature, timestamp, nonce))
Tencent.WXBizMsgCrypt wxcpt = new Tencent.WXBizMsgCrypt(token, aes, appId);
string sVerifyMsgSig = signature;
string sVerifyTimeStamp = timestamp;
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>
......@@ -80,5 +90,7 @@ namespace Mall.WebApi.Controllers.Adapay
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