Commit 57066c01 authored by 张彦钊's avatar 张彦钊

change test file

parent eef3fcd3
......@@ -28,9 +28,6 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
tag_score[i["content"]] = i["score"]
elif i["content"] in name_tag.keys():
tag_score[name_tag[i["content"]]] = i["score"]
print(tag_score)
tag_sort = sorted(tag_score.items(), key=lambda x: x[1], reverse=True)
tags = []
if len(tag_sort) > 5:
......@@ -40,10 +37,9 @@ def get_user_profile(device_id = "9C5E7C73-380C-4623-8F48-A64C8034E315"):
for i in tag_sort:
tags.append(i[0])
print(tags)
return tags
def get_searchworlds_to_tagid():
try:
sql = 'select id, name from api_tag where is_online = 1 and tag_type < 4'
......@@ -63,17 +59,23 @@ def get_searchworlds_to_tagid():
print(e)
def transform_to_tag(user_profile):
pass
def get_queues(device_id,city_id):
pass
db = pymysql.connect(host='172.16.40.158', port=4000, user='root',
passwd='3SYz54LS9#^9sBvC', db='jerry_test')
cursor = db.cursor()
sql = "select native_queue,nearby_queue,nation_queue,megacity_queue from esmm_device_diary_queue " \
"where device_id = '{}' and city_id = '{}' limit 1".format(device_id,city_id)
cursor.execute(sql)
# if 判断是不是空
result = list(cursor.fetchall())
print(result)
result = list(cursor.fetchone())
print(result)
return result
def tag_boost(cid_list, tag_score):
......@@ -91,10 +93,9 @@ def make_sample(uid,city_id,native_queue,nearby_queue,megacity_queue,nation_queu
if __name__ == "__main__":
# users_list = get_esmm_users()
# total_samples = list()
name_tag = get_searchworlds_to_tagid()
get_user_profile()
# name_tag = get_searchworlds_to_tagid()
# for i in users_list:
# tag_score = get_user_profile(i[0])
# tag_list = get_user_profile(i[0])
# native,nearby,megacity,nation = get_queues(i[0],i[1])
#
# native_sort_list = tag_boost(native, tag_score)
......@@ -106,6 +107,7 @@ if __name__ == "__main__":
# total_samples.todf
# to_data_base(df)
# to kv
get_queues("868973042175678","beijing")
......
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