From 8658d431a7e29a9e7a8225c12455507dda991dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A8=BE=E6=98=8E=E5=8D=8E?= <565209960@qq.com> Date: Fri, 23 Dec 2016 10:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A9=E5=8A=A0=E5=AF=86=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E6=96=B9=E4=BE=BF=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- authentication/WXBizMsgCrypt.py | 14 +++++++------- wxapp/wxapp.py | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/authentication/WXBizMsgCrypt.py b/authentication/WXBizMsgCrypt.py index 7ecae1e..6c372e7 100644 --- a/authentication/WXBizMsgCrypt.py +++ b/authentication/WXBizMsgCrypt.py @@ -156,13 +156,13 @@ def encrypt(self, text, appid): text = pkcs7.encode(text) # 加密 cryptor = AES.new(self.key, self.mode, self.key[:16]) - try: - ciphertext = cryptor.encrypt(text) - # 使用BASE64对加密后的字符串进行编码 - return ierror.WXBizMsgCrypt_OK, base64.b64encode(ciphertext) - except Exception, e: - #print e - return ierror.WXBizMsgCrypt_EncryptAES_Error, None + #try: + ciphertext = cryptor.encrypt(text) + # 使用BASE64对加密后的字符串进行编码 + return ierror.WXBizMsgCrypt_OK, base64.b64encode(ciphertext) + #except Exception, e: + # print e + # return ierror.WXBizMsgCrypt_EncryptAES_Error, None def decrypt(self, text, appid): """对解密后的明文进行补位删除 diff --git a/wxapp/wxapp.py b/wxapp/wxapp.py index e53e015..74367d0 100644 --- a/wxapp/wxapp.py +++ b/wxapp/wxapp.py @@ -49,7 +49,7 @@ def weather_search(request): if ret == 0: return encrypt_xml else: - return ret + return str(ret) @staticmethod def get_content(request):