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

change test file

parent c911f510
...@@ -76,20 +76,21 @@ def write_redis(device_id,cid_list): ...@@ -76,20 +76,21 @@ def write_redis(device_id,cid_list):
"and c.id = {} and c.tag_type = '3'".format(tags) "and c.id = {} and c.tag_type = '3'".format(tags)
cursor.execute(sql) cursor.execute(sql)
result = cursor.fetchall() result = cursor.fetchall()
return result db.close()
# cids = list(set([i[0] for i in result])) cids = list(set([i[0] for i in result]))
# if len(cids) != 0: if len(cids) != 0:
#
# r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379') r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
# key = str(device_id) + "_dislike_diary" key = str(device_id) + "_dislike_diary"
# if r.exists(key): if r.exists(key):
# value = eval(r.get(key)) value = eval(r.get(key))
# value.extend(cids) value.extend(cids)
# cids = json.dumps(list(set(value))) cids = json.dumps(list(set(value)))
# r.set(key, json.dumps(cids)) r.set(key, json.dumps(cids))
# else: else:
# r.set(key, json.dumps(cids)) r.set(key, json.dumps(cids))
# r.expire(key, 60*60) r.expire(key, 6)
return "good"
except Exception as e: except Exception as e:
print("insert redis fail") print("insert redis fail")
......
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