Commit 6eefb8cb authored by 张彦钊's avatar 张彦钊

change test file

parent eb4988d4
......@@ -73,17 +73,34 @@ def get_queues(device_id,city_id):
else:
return []
def tag_boost(cid_str, tag_score="1"):
def tag_boost(cid_str, tag_list="a"):
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)
if len(cids) > 6 and len(tag_list) > 0:
db = pymysql.connect(host='172.16.40.158', port=4000, user='root', passwd='3SYz54LS9#^9sBvC', db='eagle')
sql = "select id,group_concat(diary_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 id".format(tuple(cids))
# sql = "select id,group_concat(diary_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 " \
# "where id in {} group by id".format(tuple(cids), tuple(tag_list))
cursor = db.cursor()
cursor.execute(sql)
result = cursor.fetchall()
print(result)
# if len(result) > 0:
# cid_tag = {}
# for i in result:
# cid_tag[i[0]] = i[1]
# if
#
# else:
# return cid_str
else:
return cid_str
else:
return 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