yzk_wechat_event/apps/msg/pub.py

27 lines
563 B
Python

import json
from redis import StrictRedis
rc = StrictRedis(host='localhost', port=6379, db=0)
data = {
"create_time": 1671796836,
"update_time": 1671796836,
"remark": "test message",
"corp_id": 12345,
"vid": 123456789,
"msg_type": 1,
"to_vid": 987654321,
"to_room_id": 1122334455,
"send_time": "1671705497",
"content": "this is a test message",
"aeskey": "123456789abcdefg",
"origin_data": {
"foo": "bar"
}
}
for i in range(10):
value_new = json.dumps(data)
rc.publish("jqr:msg", value_new)