Commit e2bbb0f1 authored by 赵威's avatar 赵威

update logic

parent 7bbda6d5
......@@ -149,26 +149,17 @@ def choice_pictorial_push_tag(device_id, user_id):
def get_lintags_by_user_id(user_id):
try:
devices = AccountRegExtra.objects.filter(user_id=user_id, is_online=True, is_deleted=False).values_list("device_id", flat=True)
print(devices)
if devices:
linucb_recommend_redis_prefix = "physical:linucb:tag_recommend:device_id:"
device_id = devices[0]
redis_key = linucb_recommend_redis_prefix + str(device_id)
print(redis_key)
print(redis_client.info)
try:
tag_data = redis_client.get(redis_key)
tag_data = redis_client.get(redis_key)
lintags = []
if tag_data is None:
lintags = []
if tag_data is None:
lintags = []
else:
lintags = json.loads(str(tag_data, encoding="utf-8"))
print(lintags)
print("=====")
except Exception as e:
print(e)
print("error!!")
return {"lin_tag_list": tag_list}
else:
lintags = json.loads(str(tag_data, encoding="utf-8"))
return {"lin_tag_list": lintags[:3]}
return {"lin_tag_list": []}
except Exception as e:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
......
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