Commit 1ef54615 authored by 张彦钊's avatar 张彦钊

测试获取用户画像方法

parent 1ed4a89f
......@@ -192,9 +192,9 @@ def diary_write(device_id,cid):
# ssc.start()
# ssc.awaitTermination()
def make_data(device_id,city_id):
def make_data(device_id,city_id,key_head):
r = redis.StrictRedis.from_url("redis://redis.paas-test.env:6379/2")
key = "device_diary_queue_rerank:device_id:" + device_id + ":city_id:" + city_id
key = key_head + device_id + ":city_id:" + city_id
r.hset(name=key, key="native_queue", value=native)
r.hset(name=key, key="nearby_queue", value=nearby)
r.hset(name=key, key="nation_queue", value=nation)
......@@ -202,11 +202,14 @@ def make_data(device_id,city_id):
print(r.hgetall(key))
if __name__ == "__main__":
native = ",".join([str(i) for i in (range(2, 6))])
nearby = ",".join([str(i) for i in (range(6, 10))])
nation = ",".join([str(i) for i in (range(10, 13))])
megacity = ",".join([str(i) for i in (range(13, 16))])
make_data("hello","beijing")
native = ",".join([str(i) for i in (range(69, 72))])
nearby = ",".join([str(i) for i in (range(73, 76))])
nation = ",".join([str(i) for i in (range(77, 80))])
megacity = ",".join([str(i) for i in (range(81, 83))])
# key_head = "device_diary_queue_rerank:device_id:"
key_head = "device_diary_queue:device_id:"
make_data("868663038800471", "beijing", key_head)
......
This diff is collapsed.
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