Commit b6f46c1b authored by litaolemo's avatar litaolemo

update

parent d5d5fbe2
......@@ -77,7 +77,7 @@ spark.sql("CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDF
sql = """
select card_id from strategy_content_exposure_index where card_content_type="user_post" and preciseexposure_num>=50 and ctr>=0.05 and avg_page_stay>=20 and create_day="2020-09-17"
"""
second_demands_count_dict, tags_v3_count_dict,card_id_list = get_user_post_from_mysql(sql)
second_demands_count_dict, tags_v3_count_dict, second_demands_card_id_list,tags_v3_card_id_list = get_user_post_from_mysql(sql)
print(card_id_list)
t = 2
day_num = 0 - t
......@@ -271,8 +271,7 @@ for res in sql_res:
# print(res)
cl_id = res.cl_id
card_id = res.card_id
if int(card_id) not in card_id_list:
continue
if cl_id in device_id_dict:
# print("has device")
# print(type(card_id),card_id)
......@@ -280,6 +279,8 @@ for res in sql_res:
session_pv = res.session_pv
# card_id_set.update(card_id)
if cl_id in second_demands_tag_dict:
if int(card_id) not in second_demands_card_id_list:
continue
for tag_id in second_demands_tag_dict[cl_id]:
if tag_id in second_demands_id_count:
second_demands_id_count[tag_id][int(card_id)] = 1
......@@ -293,6 +294,8 @@ for res in sql_res:
# baoguang_dict[tag_id] = session_pv
if cl_id in projects_demands_tag_dict:
if int(card_id) not in tags_v3_card_id_list:
continue
for tag_id in projects_demands_tag_dict[cl_id]:
if tag_id in projects_demands_id_count:
projects_demands_id_count[tag_id][int(card_id)] = 1
......@@ -330,7 +333,7 @@ for tag_id in projects_demands_tag_count:
"tag_name": tag_id,
"device_count": projects_demands_tag_count[tag_id],
"tractate_count": tags_v3_count_dict.get(tag_id),
"exporsure_count": len(second_demands_id_count[tag_id]) if second_demands_id_count.get(tag_id) else 0,
"exporsure_count": len(projects_demands_id_count[tag_id]) if projects_demands_id_count.get(tag_id) else 0,
}
print(temp_dict)
......
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