“服务端开发文档-注册事件回调接口”让人困惑
Re“服务端开发文档-注册事件回调接口”让人困惑
遇到同样的问题,我的返回内容是:{'msg_signature':'411c8a224ccff4faa8ef233a2686f88a243255c8','timeStamp':'1503296132','nonce':'s9psbfYd','encrypt':'kuaShC+LOwtDYotihRDRW56GFmX8QZ8FOAY+J0jsDP/FqwUJaHDfzs3HsfX/R6oAVqatwIW3yAgNQCCxjVywYQ=='}
但是一直提示{'errcode':71009,'errmsg':'返回文本非success'},请问最后是怎么解决的呢?
-------------------------
Re“服务端开发文档-注册事件回调接口”让人困惑
C#版本的, 下载C#的sdk,企业调用,回调使用下面的代码,有个地方改了, 终于调试通了,坑死我了。
string msgSignature = Request['signature'];//消息签名
string timestamp = Request['timestamp'];//时间戳
string nonce = Request['nonce'];//随机号
string mToken = ConfigurationManager.AppSettings['DingTalkToken'];
string mSuiteKey = 'dingcxxxxxxxxxxxxxxxxxxxxxx';//更换key
string mEncodingAesKey = ConfigurationManager.AppSettings['DingTalkEncodingAESKey'];
//post数据包数据中的加密数据
var encryptStr = GetPostParam();
string newSignature = '';
DingTalkCrypt.GenerateSignature(mToken, timestamp, nonce, encryptStr, ref newSignature);
if (msgSignature != newSignature)
{
LogHelper.Info('消息有可能被篡改!签名验证错误! ');
return “”;
}
var sReplyEchoStr = '';
DingTalkCrypt suiteAuth = new DingTalkCrypt(mToken, mEncodingAesKey, mSuiteKey);
var ret = suiteAuth.VerifyURL(msgSignature, timestamp, nonce, encryptStr, ref sReplyEchoStr);
if (ret != 0)
{
LogHelper.Info('ERR: VerifyURL fail, ret: ' + ret);
return “”;
}
DingTalkCrypt dingTalk = new DingTalkCrypt(mToken, mEncodingAesKey, mSuiteKey);
string plainText = '';
dingTalk.DecryptMsg(msgSignature, timestamp, nonce, encryptStr, ref plainText);
Hashtable tb = (Hashtable)JsonConvert.DeserializeObject(plainText, typeof(Hashtable));
string eventType = tb['EventType'].ToString();
string result = '';
switch (eventType)
{
case 'bpms_task_change'://审批通知
break;
case 'bpms_instance_change'://审批通知
break;
case 'check_url'://测试url
string encrypt = '';
string signature = '';
dingTalk = new DingTalkCrypt(mToken, mEncodingAesKey, mSuiteKey);
dingTalk.EncryptMsg('success', timestamp, nonce, ref encrypt, ref signature);
Hashtable json = new Hashtable
{
{'msg_signature', signature},
{'timeStamp', timestamp},
{'nonce', nonce},
{'encrypt', encrypt}
};
result = JsonConvert.SerializeObject(json);
return result;
break;
}
赞0
踩0