Commit 8f9fd6f2 authored by litaolemo's avatar litaolemo

update

parent bee817f5
......@@ -262,8 +262,7 @@ exposure_sql = """
SELECT
cl_id,
card_id,
transaction_type,
count(distinct app_session_id) as session_pv
transaction_type
FROM
(
SELECT
......@@ -303,11 +302,17 @@ projects_demands_id_count = {}
baoguang_dict = {}
# 遍历card_id 找出对应的device_id是否在灰度里
# 找出card_id 对应帖子的标签 并分类汇总 得到 标签-计数字段
transaction_second_demands_dict = {}
transaction_projects_demands_type = {}
for res in sql_res:
# partition_date = res.partition_date
# print(res)
cl_id = res.cl_id
card_id = res.card_id
transaction_type = res.transaction_type
if cl_id in device_id_dict:
# print("has device")
......@@ -326,6 +331,15 @@ for res in sql_res:
second_demands_id_count[tag_id] = {}
second_demands_id_count[tag_id][int(card_id)] = 1
if tag_id in transaction_second_demands_dict:
try:
transaction_second_demands_dict[tag_id][transaction_type] += 1
except:
transaction_second_demands_dict[tag_id][transaction_type] = 1
else:
transaction_second_demands_dict[tag_id] = {}
transaction_second_demands_dict[tag_id][transaction_type] = 1
# if tag_id in baoguang_dict:
# baoguang_dict[tag_id] += session_pv
# else:
......@@ -341,6 +355,15 @@ for res in sql_res:
projects_demands_id_count[tag_id] = {}
projects_demands_id_count[tag_id][int(card_id)] = 1
if tag_id in transaction_projects_demands_type:
try:
transaction_projects_demands_type[tag_id][transaction_type] += 1
except:
transaction_projects_demands_type[tag_id][transaction_type] = 1
else:
transaction_projects_demands_type[tag_id] = {}
transaction_projects_demands_type[tag_id][transaction_type] = 1
final_projects_list = []
second_demands_list = []
print(projects_demands_id_count)
......@@ -356,7 +379,7 @@ for tag_id in second_demands_tag_count:
"exporsure_count": len(second_demands_id_count[tag_id]) if second_demands_id_count.get(tag_id) else 0,
}
print(temp_dict['tag_name'], temp_dict['device_count'], temp_dict['tractate_count'], temp_dict['exporsure_count'])
print(temp_dict['tag_name'], temp_dict['tractate_count'], temp_dict['exporsure_count'], temp_dict['device_count'],transaction_second_demands_dict[tag_id])
# print(temp_dict)
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# print("error" , second_demands_id_count[tag_id])
......@@ -384,7 +407,7 @@ for tag_id in projects_demands_tag_count:
# if temp_dict['tractate_count'] < temp_dict['exporsure_count']:
# print("error" , projects_demands_id_count[tag_id])
print(temp_dict['tag_name'], temp_dict['device_count'], temp_dict['tractate_count'], temp_dict['exporsure_count'])
print(temp_dict['tag_name'], temp_dict['tractate_count'], temp_dict['exporsure_count'], temp_dict['device_count'],transaction_projects_demands_type[tag_id])
# print(2)
# for tag_id in tags_v3_count_dict:
# if tag_id not in projects_demands_tag_count:
......
......@@ -4,14 +4,6 @@
# @email : litao@igengmei.com
# @author : litao
# -*- coding:UTF-8 -*-
# @Time : 2020/9/11 10:59
# @File : portary_article_distribution.py
# @email : litao@igengmei.com
# @author : litao
import hashlib
import json
......
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