Commit 62d71c5b authored by 张彦钊's avatar 张彦钊

change test file

parent 0c1bc073
......@@ -117,21 +117,20 @@ def answer_write(device_id,cid):
cursor.execute(sql)
result = cursor.fetchall()
db.close()
cids = [str(i[0]) for i in result]
cids = [i[0] for i in result]
if len(cids) != 0:
r = redis.Redis(host="172.16.40.135", port=5379, password="")
r = redis.Redis(host="172.16.40.135", port=5379, password="", db=2)
key = str(device_id) + "_dislike_answer"
if r.exists(key):
value = eval(r.get(key)).split(",")
value = json.loads(r.get(key).decode('utf-8'))
value.extend(cids)
value = ",".join([str(i) for i in set(value)])
cids = json.dumps(value)
r.set(key, cids)
print("cunza")
else:
r.set(key, json.dumps(",".join(cids)))
r.set(key, json.dumps(cids))
r.expire(key, 7 * 24 * 60 * 60)
......@@ -238,7 +237,8 @@ def diary_write(device_id,cid):
# ssc.start()
# ssc.awaitTermination()
print(tractate_write("hello",10078))
answer_write("hello",656482)
answer_write("hello","656482")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment