Commit 53d1971d authored by 张彦钊's avatar 张彦钊

change test file

parent 83c781a9
......@@ -158,22 +158,22 @@ def question_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_question"
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("cuznai")
print("cunza")
else:
r.set(key, json.dumps(",".join(cids)))
r.set(key, json.dumps(cids))
r.expire(key, 7 * 24 * 60 * 60)
print("bucunza")
return "question good"
except Exception as e:
......@@ -238,7 +238,8 @@ def diary_write(device_id,cid):
# ssc.start()
# ssc.awaitTermination()
diary_write("hello",16283654)
question_write("hello",176661)
question_write("hello",226749)
......
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