|
@@ -16,7 +16,7 @@ class ReportPush(object):
|
|
# 参数:时间区间 和 项目列表
|
|
# 参数:时间区间 和 项目列表
|
|
sql_1_1 = """
|
|
sql_1_1 = """
|
|
SELECT SUM(pv) AS pv1 FROM a_idfa_behavior_sum
|
|
SELECT SUM(pv) AS pv1 FROM a_idfa_behavior_sum
|
|
- WHERE `report_d` >= %s and report_d < %s AND house_id IN %s
|
|
|
|
|
|
+ WHERE report_d >= %s and report_d < %s AND house_id IN %s
|
|
"""
|
|
"""
|
|
|
|
|
|
# ----集团PV--权限项目范围内,求和
|
|
# ----集团PV--权限项目范围内,求和
|
|
@@ -50,7 +50,7 @@ class ReportPush(object):
|
|
B.mobile
|
|
B.mobile
|
|
FROM
|
|
FROM
|
|
a_behavior_brand_mini_day A
|
|
a_behavior_brand_mini_day A
|
|
- LEFT JOIN `a_brand_app_customer` B ON A.brand_user_id = B.brand_customer_id
|
|
|
|
|
|
+ LEFT JOIN a_brand_app_customer B ON A.brand_user_id = B.brand_customer_id
|
|
WHERE
|
|
WHERE
|
|
A.report_d >= %s and A.report_d < %s
|
|
A.report_d >= %s and A.report_d < %s
|
|
AND A.house_id IN %s
|
|
AND A.house_id IN %s
|
|
@@ -70,7 +70,7 @@ class ReportPush(object):
|
|
mobile,
|
|
mobile,
|
|
created
|
|
created
|
|
FROM
|
|
FROM
|
|
- `d_user`
|
|
|
|
|
|
+ d_user
|
|
WHERE
|
|
WHERE
|
|
created >= %s
|
|
created >= %s
|
|
AND created < %s
|
|
AND created < %s
|
|
@@ -81,7 +81,7 @@ class ReportPush(object):
|
|
mobile,
|
|
mobile,
|
|
rlat_created
|
|
rlat_created
|
|
FROM
|
|
FROM
|
|
- `a_brand_app_customer_house_rlat`
|
|
|
|
|
|
+ a_brand_app_customer_house_rlat
|
|
WHERE
|
|
WHERE
|
|
rlat_created >= %s
|
|
rlat_created >= %s
|
|
AND rlat_created < %s
|
|
AND rlat_created < %s
|
|
@@ -100,7 +100,7 @@ class ReportPush(object):
|
|
mobile,
|
|
mobile,
|
|
wx_phone_time AS created
|
|
wx_phone_time AS created
|
|
FROM
|
|
FROM
|
|
- `d_user`
|
|
|
|
|
|
+ d_user
|
|
WHERE
|
|
WHERE
|
|
wx_phone_time >= %s
|
|
wx_phone_time >= %s
|
|
AND wx_phone_time < %s
|
|
AND wx_phone_time < %s
|
|
@@ -301,7 +301,7 @@ class ReportPush(object):
|
|
FROM
|
|
FROM
|
|
d_content_layout
|
|
d_content_layout
|
|
WHERE
|
|
WHERE
|
|
- `status` = '1'
|
|
|
|
|
|
+ status = '1'
|
|
and house_id <> 1
|
|
and house_id <> 1
|
|
group by house_id
|
|
group by house_id
|
|
union all
|
|
union all
|
|
@@ -312,7 +312,7 @@ class ReportPush(object):
|
|
d_content_layout aa join d_house bb
|
|
d_content_layout aa join d_house bb
|
|
on aa.house_id = bb.house_id
|
|
on aa.house_id = bb.house_id
|
|
WHERE
|
|
WHERE
|
|
- aa.`status` = '1'
|
|
|
|
|
|
+ aa.status = '1'
|
|
and bb.status = '1'
|
|
and bb.status = '1'
|
|
and aa.house_id <> 1
|
|
and aa.house_id <> 1
|
|
group by bb.brand_id
|
|
group by bb.brand_id
|
|
@@ -339,7 +339,7 @@ class ReportPush(object):
|
|
WHERE
|
|
WHERE
|
|
a.source IN (1, 2, 3, 4, 10)
|
|
a.source IN (1, 2, 3, 4, 10)
|
|
AND a.report_d >= %s
|
|
AND a.report_d >= %s
|
|
- AND a.report_d < '%s
|
|
|
|
|
|
+ AND a.report_d < %s
|
|
GROUP BY
|
|
GROUP BY
|
|
house_id,
|
|
house_id,
|
|
house_name,
|
|
house_name,
|
|
@@ -400,11 +400,11 @@ class ReportPush(object):
|
|
|
|
|
|
# 根据任务id获取推送客户信息
|
|
# 根据任务id获取推送客户信息
|
|
sql_4 = """
|
|
sql_4 = """
|
|
- select a.task_key, a.customer_id, b.customer_type, b.`name`, b.mail, GROUP_CONCAT(c.house_or_brand_id) as ids
|
|
|
|
|
|
+ select a.task_key, a.customer_id, b.customer_type, b.name, b.mail, GROUP_CONCAT(c.house_or_brand_id) as ids
|
|
from report_task_info a left join report_push_customer_info b on b.id = a.customer_id
|
|
from report_task_info a left join report_push_customer_info b on b.id = a.customer_id
|
|
left join report_customer_authority_info c on b.id = c.customer_id
|
|
left join report_customer_authority_info c on b.id = c.customer_id
|
|
where a.task_key = %s and a.status = b.status = c.status = 1
|
|
where a.task_key = %s and a.status = b.status = c.status = 1
|
|
- group by a.task_key, a.customer_id, b.customer_type, b.`name`, b.mail
|
|
|
|
|
|
+ group by a.task_key, a.customer_id, b.customer_type, b.name, b.mail
|
|
"""
|
|
"""
|
|
|
|
|
|
# 根据集团id获取项目id
|
|
# 根据集团id获取项目id
|
|
@@ -450,14 +450,13 @@ class ReportPush(object):
|
|
if customer_type == 1:
|
|
if customer_type == 1:
|
|
# 项目
|
|
# 项目
|
|
ids = customer[5]
|
|
ids = customer[5]
|
|
- if str(house_ids).find(',') != -1:
|
|
|
|
|
|
+ if str(ids).find(',') != -1:
|
|
house_ids = [x for x in str(ids).split(',')]
|
|
house_ids = [x for x in str(ids).split(',')]
|
|
else:
|
|
else:
|
|
house_ids = [ids]
|
|
house_ids = [ids]
|
|
pass
|
|
pass
|
|
elif customer_type == 2:
|
|
elif customer_type == 2:
|
|
# 集团
|
|
# 集团
|
|
- brands = []
|
|
|
|
brand_ids = customer[5]
|
|
brand_ids = customer[5]
|
|
if str(brand_ids).find(',') != -1:
|
|
if str(brand_ids).find(',') != -1:
|
|
brands = [x for x in str(brand_ids).split(',')]
|
|
brands = [x for x in str(brand_ids).split(',')]
|
|
@@ -522,7 +521,6 @@ class ReportPush(object):
|
|
result[3] = result_data_3
|
|
result[3] = result_data_3
|
|
result[4] = result_data_4
|
|
result[4] = result_data_4
|
|
result[5] = result_data_5
|
|
result[5] = result_data_5
|
|
- result[6] = result_data_6
|
|
|
|
break
|
|
break
|
|
# 7: 单个项目小程序获客来源场景分析
|
|
# 7: 单个项目小程序获客来源场景分析
|
|
|
|
|
|
@@ -547,11 +545,11 @@ class ReportPush(object):
|
|
number_1 = number_1_1 + number_1_2
|
|
number_1 = number_1_1 + number_1_2
|
|
result.append(number_1)
|
|
result.append(number_1)
|
|
# 2: 总浏览人数
|
|
# 2: 总浏览人数
|
|
- data_2 = self.db.select(self.sql_1_3, [time_range[0], time_range[1], house_ids, time_range[0], time_range[1]])
|
|
|
|
|
|
+ data_2 = self.db.select(self.sql_1_3, [time_range[0], time_range[1], house_ids, time_range[0], time_range[1], house_ids])
|
|
number_2 = data_2[0][0]
|
|
number_2 = data_2[0][0]
|
|
result.append(number_2)
|
|
result.append(number_2)
|
|
# 3:新增获客
|
|
# 3:新增获客
|
|
- data_3 = self.db.select(self.sql_1_4, [time_range[0], time_range[1], house_ids, time_range[0], time_range[1]])
|
|
|
|
|
|
+ data_3 = self.db.select(self.sql_1_4, [time_range[0], time_range[1], house_ids, time_range[0], time_range[1], house_ids])
|
|
number_3 = data_3[0][0]
|
|
number_3 = data_3[0][0]
|
|
result.append(number_3)
|
|
result.append(number_3)
|
|
# 4:新增获电
|
|
# 4:新增获电
|