import base64
if __name__ == '__main__':
# 抢红包的参数base64加密
grab_param = {
"redEnvelopeId": "a5f27aa8-cc66-4b02-bd81-014af278c659",
"topicId": "group_1",
"userName": "user_2"
}
content = base64.b64encode(str(grab_param).encode("utf-8")).decode()
print("抢红包base64加密body:", content)
# 发红包的参数base64加密
send_param = {
"totalAmount": 100,
"totalCount": 10,
"topicId": "group_1",
"userName": "user_2",
"message": "恭喜发财",
}
content = base64.b64encode(str(send_param).encode("utf-8")).decode()
print("抢红包base64加密body:", content)