Skip to content

Commit

Permalink
wechat bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benben17 committed May 15, 2024
1 parent 1c7127d commit 67a200a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions book/utils/wxMsg.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
def check_signature(token, signature, timestamp, nonce):
"""微信校验签名"""
temp_arr = [token, timestamp, nonce]
temp_arr.sort()
temp_str = ''.join(temp_arr)
hash_str = hashlib.sha1(temp_str.encode('utf-8')).hexdigest()
return hash_str == signature
if len(temp_arr) > 0:
temp_arr.sort()
temp_str = ''.join(temp_arr)
hash_str = hashlib.sha1(temp_str.encode('utf-8')).hexdigest()
return hash_str == signature
else:
return ''


create_time = str(int(time.time()))
Expand Down

0 comments on commit 67a200a

Please sign in to comment.