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

change test file

parent 5c91b38f
......@@ -59,10 +59,6 @@ def get_searchworlds_to_tagid():
print(e)
def transform_to_tag(user_profile):
pass
def get_queues(device_id,city_id):
db = pymysql.connect(host='172.16.40.158', port=4000, user='root',
passwd='3SYz54LS9#^9sBvC', db='jerry_test')
......@@ -73,13 +69,24 @@ def get_queues(device_id,city_id):
result = cursor.fetchone()
db.close()
if len(result) > 0:
print(result)
return list(result)
else:
return []
def tag_boost(cid_list, tag_score):
pass
def tag_boost(cid_str, tag_score="1"):
if cid_str is not None or cid_str != "":
cids = cid_str.split(",")
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='eagle')
sql = "select diary_id,group_concat(id) from " \
"(select a.diary_id,b.id from src_mimas_prod_api_diary_tags a left join src_zhengxing_api_tag b " \
"on a.tag_id = b.id where b.tag_type < '4' and a.diary_id in {}) tmp group by diary_id".format(tuple(cids))
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchall()
print(result)
else:
return cid_str
def to_data_base(df,table_name = "tag_boost_device_diary_queue"):
......@@ -96,7 +103,7 @@ if __name__ == "__main__":
# name_tag = get_searchworlds_to_tagid()
# for i in users_list:
# tag_list = get_user_profile(i[0])
# native,nearby,megacity,nation = get_queues(i[0],i[1])
# queues = get_queues(i[0],i[1])
#
# native_sort_list = tag_boost(native, tag_score)
# nearby_sort_list = tag_boost(nearby, tag_score)
......@@ -107,7 +114,8 @@ if __name__ == "__main__":
# total_samples.todf
# to_data_base(df)
# to kv
get_queues("868973042175678","beijing")
cid_str = "16473983,16296886,16199213,16193883,16419499,16372783,16430184,16617593,16498902,16238415,16214258,15715721,16213338,15349114,14091428,16268804,15485655,16448547,16179842,16685025,16612412,16683132,15646229,16482213,16485831,16436136,16353856,16400696,16193006,16294202,16393228,16716816,16713343,16780702,16107140,16647027,16112786,16503037,16372681,16207971,16179934,16480641,16295094,16204980,16317847,16434907,16117929,15633591,16116818"
tag_boost(cid_str)
......
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