Commit d31e0ac6 authored by 张彦钊's avatar 张彦钊

change test file

parent b666e659
......@@ -203,21 +203,20 @@ def tractate_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="")
key = str(device_id) + "_dislike_tractate"
if r.exists(key):
value = r.get(key).split(b",")
value = json.loads(r.hgetall(key)[b"queue"])
value.extend(cids)
value = ",".join([str(i) for i in set(value)])
cids = json.dumps(value)
r.set(key, cids)
cids = json.dumps(list(set(value)))
r.set(key, json.dumps(cids))
print("存在")
else:
r.set(key,json.dumps(b",".join(cids)))
r.expire(key, 7*24*60*60)
r.hset(key, "queue", json.dumps(cids))
r.expire(key, 7 * 24 * 60 * 60)
# return "tractate good"
#
# except Exception as e:
......
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