Commit 1968bf6c authored by litaolemo's avatar litaolemo

update

parent 2d842c77
...@@ -200,9 +200,9 @@ for redis_count, device_id in enumerate(device_id_dict): ...@@ -200,9 +200,9 @@ for redis_count, device_id in enumerate(device_id_dict):
# print(count_res) # print(count_res)
for tag in second_demands: for tag in second_demands:
if tag in second_demands_tag_count: if tag in second_demands_tag_count:
second_demands_tag_count[tag] += 1 second_demands_tag_count[int(tag)] += 1
else: else:
second_demands_tag_count[tag] = 1 second_demands_tag_count[int(tag)] = 1
if tag in second_demands_count_dict: if tag in second_demands_count_dict:
total_tractate_content_num += second_demands_count_dict[tag] total_tractate_content_num += second_demands_count_dict[tag]
second_demands_tag_dict[device_id] = second_demands second_demands_tag_dict[device_id] = second_demands
...@@ -211,9 +211,9 @@ for redis_count, device_id in enumerate(device_id_dict): ...@@ -211,9 +211,9 @@ for redis_count, device_id in enumerate(device_id_dict):
# print(count_res) # print(count_res)
for tag in projects: for tag in projects:
if tag in projects_demands_tag_count: if tag in projects_demands_tag_count:
projects_demands_tag_count[tag] += 1 projects_demands_tag_count[int(tag)] += 1
else: else:
projects_demands_tag_count[tag] = 1 projects_demands_tag_count[int(tag)] = 1
if tag in tags_v3_count_dict: if tag in tags_v3_count_dict:
total_tractate_content_num += tags_v3_count_dict[tag] total_tractate_content_num += tags_v3_count_dict[tag]
...@@ -271,10 +271,10 @@ for res in sql_res: ...@@ -271,10 +271,10 @@ for res in sql_res:
# print(res) # print(res)
cl_id = res.cl_id cl_id = res.cl_id
if cl_id in device_id_dict: if cl_id in device_id_dict:
print("has device") # print("has device")
card_id = res.card_id card_id = res.card_id
print(type(card_id),card_id) # print(type(card_id),card_id)
if str(card_id) not in card_id_list:continue if int(card_id) not in card_id_list:continue
print("has card_id") print("has card_id")
session_pv = res.session_pv session_pv = res.session_pv
# card_id_set.update(card_id) # card_id_set.update(card_id)
...@@ -308,11 +308,10 @@ second_demands_list = [] ...@@ -308,11 +308,10 @@ second_demands_list = []
for tag_id in second_demands_tag_count: for tag_id in second_demands_tag_count:
temp_dict = { temp_dict = {
"tag_name": tag_id, "tag_name": tag_id,
# "device_count": second_demands_tag_count[tag_id], "device_count": second_demands_tag_count[tag_id],
# "tractate_count": second_demands_count_dict.get(tag_id), "tractate_count": second_demands_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(second_demands_id_count[tag_id]) if second_demands_id_count.get(tag_id) else 0,
# "session_pv_count": len(set(second_demands_id_count[tag_id]))
} }
print(temp_dict) print(temp_dict)
...@@ -320,9 +319,9 @@ print("----------------------------------------------") ...@@ -320,9 +319,9 @@ print("----------------------------------------------")
for tag_id in projects_demands_tag_count: for tag_id in projects_demands_tag_count:
temp_dict = { temp_dict = {
"tag_name": tag_id, "tag_name": tag_id,
# "device_count": projects_demands_tag_count[tag_id], "device_count": projects_demands_tag_count[tag_id],
# "tractate_count": tags_v3_count_dict.get(tag_id), "tractate_count": tags_v3_count_dict.get(tag_id),
"exporsure_count": len(projects_demands_id_count[tag_id]) if projects_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,
# "session_pv_count": len(set(second_demands_id_count[tag_id]))
} }
print(temp_dict) print(temp_dict)
\ No newline at end of file
...@@ -344,7 +344,7 @@ def get_user_post_from_mysql(sql): ...@@ -344,7 +344,7 @@ def get_user_post_from_mysql(sql):
sql_res = con_sql_doris_prod(sql) sql_res = con_sql_doris_prod(sql)
for card_id in sql_res: for card_id in sql_res:
print(type(card_id[0]),card_id) print(type(card_id[0]),card_id)
card_id_list.append(str(card_id[0])) card_id_list.append(int(card_id[0]))
es_res = get_tractate_tags_from_es(card_id[0]) es_res = get_tractate_tags_from_es(card_id[0])
for position in es_res["_source"]["second_demands"]: for position in es_res["_source"]["second_demands"]:
if position in second_demands_count_dict: if position in second_demands_count_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