Skip to content

Commit

Permalink
修改to_user错误
Browse files Browse the repository at this point in the history
  • Loading branch information
ziminghua committed Dec 23, 2016
1 parent 364ee33 commit e09f0e3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions wxapp/wxapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_content(request):
post_content = request.data
ret, xml_content = wxcpt.DecryptMsg(post_content, signature, timestamp, nonce)
xml_tree = ET.fromstring(xml_content)
return xml_tree.find("Content").text, xml_tree.find("ToUserName")
return xml_tree.find("Content").text, xml_tree.find("ToUserName").text


@staticmethod
Expand All @@ -69,7 +69,13 @@ def get_query_param(request):

@staticmethod
def send_data(content, to_user, nonce):
template = "<xml><ToUserName><![CDATA[%s]]></ToUserName><FromUserName><![CDATA[ziminghua88]]></FromUserName><CreateTime>%s</CreateTime><MsgType><![CDATA[text]]></MsgType><Content><![CDATA[%s]]></Content></xml>"
template = """<xml>
<ToUserName><![CDATA[%s]]></ToUserName>
<FromUserName><![CDATA[ziminghua88]]></FromUserName>
<CreateTime>%s</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[%s]]></Content>
</xml>"""
return wxcpt.EncryptMsg(template % (to_user, str(int(time.time())), content), nonce)


0 comments on commit e09f0e3

Please sign in to comment.