Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bugfix: 兼容企业内部智能机器人场景&fix解密后明文用int返回 #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
niweixiaoshihaomei wants to merge 2 commits into sbzhu:master
base: master
Choose a base branch
Loading
from niweixiaoshihaomei:bugfix/for-python3-json
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions callback_json_python3/WXBizJsonMsgCrypt.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ def decrypt(self,text,receiveid):
except Exception as e:
print(e)
return ierror.WXBizMsgCrypt_IllegalBuffer,None
if from_receiveid != receiveid:

# 兼容企业内部智能机器人,企业内部智能机器人解析出来的from_receiveid是'',参考官网:https://developer.work.weixin.qq.com/document/path/101033
if from_receiveid and from_receiveid != receiveid:
print("receiveid not match", receiveid, from_receiveid)
return ierror.WXBizMsgCrypt_ValidateCorpid_Error,None
return 0,json_content
Expand Down Expand Up @@ -230,7 +232,8 @@ def VerifyURL(self, sMsgSignature, sTimeStamp, sNonce, sEchoStr):
return ierror.WXBizMsgCrypt_ValidateSignature_Error, None
pc = Prpcrypt(self.key)
ret,sReplyEchoStr = pc.decrypt(sEchoStr,self.m_sReceiveId)
return ret,sReplyEchoStr
# 转成int类型,企信的消息要求是int类型的,解析出来的字符串返回会报错:echostr校验失败,请您检查是否正确解密并输出明文echostr
return ret,int(sReplyEchoStr)

def EncryptMsg(self, sReplyMsg, sNonce, timestamp = None):
#将企业回复用户的消息加密打包
Expand Down

AltStyle によって変換されたページ (->オリジナル) /