Commit 16dba7ac authored by 张彦钊's avatar 张彦钊

change test file

parent 62d71c5b
......@@ -132,6 +132,7 @@ def answer_write(device_id,cid):
else:
r.set(key, json.dumps(cids))
r.expire(key, 7 * 24 * 60 * 60)
print("bucunza")
except Exception as e:
......@@ -198,22 +199,22 @@ def diary_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_diary"
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("cunz")
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 "diary good"
except Exception as e:
......@@ -237,8 +238,8 @@ def diary_write(device_id,cid):
# ssc.start()
# ssc.awaitTermination()
answer_write("hello",656482)
answer_write("hello","656482")
diary_write("hello",16951169)
diary_write("hello","16283654")
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