Commit a371d573 authored by 魏艺敏's avatar 魏艺敏

push codes

parent c530a989
This diff is collapsed.
This diff is collapsed.
......@@ -10,21 +10,29 @@ SELECT day_id `日期`
,valid_msg_num as `有效私信咨询人次-总计`
,clue_dev as `授权电话线索设备数-总计`
,clue_num as `授权电话线索人次-总计`
,call_dev as `拨打电话线索设备数-总计`
,call_num as `拨打电话线索人次-总计`
,valid_call_dev as `有效电话线索设备数-总计`
,valid_call_num as `有效电话线索人次-总计`
,call_dev+call_dev_d as `拨打电话线索设备数-总计`
,call_num+call_num_d as `拨打电话线索人次-总计`
,valid_call_dev+valid_call_dev_d as `有效电话线索设备数-总计`
,valid_call_num+valid_call_num_d as `有效电话线索人次-总计`
,call_dev as `当天拨打电话线索设备数-总计`
,call_num as `当天拨打电话线索人次-总计`
,valid_call_dev as `当天有效电话线索设备数-总计`
,valid_call_num as `当天有效电话线索人次-总计`
,msg_dev_4 `私信咨询设备数-3级以上商户`
,msg_num_4 `私信咨询人次-3级以上商户`
,valid_msg_dev_4 `有效私信咨询设备数-3级以上商户`
,valid_msg_num_4 as `有效私信咨询人次-3级以上商户`
,clue_dev_4 as `授权电话线索设备数-3级以上商户`
,clue_num_4 as `授权电话线索人次-3级以上商户`
,call_dev_4 as `拨打电话线索设备数-3级以上商户`
,call_num_4 as `拨打电话线索人次-3级以上商户`
,valid_call_dev_4 as `有效电话线索设备数-3级以上商户`
,valid_call_num_4 as `有效电话线索人次-3级以上商户`
,msg_dev_3 `私信咨询设备数-3级以上商户`
,msg_num_3 `私信咨询人次-3级以上商户`
,valid_msg_dev_3 `有效私信咨询设备数-3级以上商户`
,valid_msg_num_3 as `有效私信咨询人次-3级以上商户`
,clue_dev_3 as `授权电话线索设备数-3级以上商户`
,clue_num_3 as `授权电话线索人次-3级以上商户`
,call_dev_3+call_dev_3_d as `拨打电话线索设备数-3级以上商户`
,call_num_3+valid_call_num_3 as `拨打电话线索人次-3级以上商户`
,valid_call_dev_3+valid_call_dev_3_d as `有效电话线索设备数-3级以上商户`
,valid_call_num_3+valid_call_num_3_d as `有效电话线索人次-3级以上商户`
,call_dev_3 as `当天拨打电话线索设备数-3级以上商户`
,call_num_3 as `当天拨打电话线索人次-3级以上商户`
,valid_call_dev_3 as `当天有效电话线索设备数-3级以上商户`
,valid_call_num_3 as `当天有效电话线索人次-3级以上商户`
,msg_dev_kyc `私信咨询设备数-kyc`
,msg_num_kyc `私信咨询人次-kyc`
......@@ -32,10 +40,14 @@ SELECT day_id `日期`
,valid_msg_num_kyc as `有效私信咨询人次-kyc`
,clue_dev_kyc as `授权电话线索设备数-kyc`
,clue_num_kyc as `授权电话线索人次-kyc`
,call_dev_kyc as `拨打电话线索设备数-kyc`
,call_num_kyc as `拨打电话线索人次-kyc`
,valid_call_dev_kyc as `有效电话线索设备数-kyc`
,valid_call_num_kyc as `有效电话线索人次-kyc`
,call_dev_kyc+call_dev_kyc_d as `拨打电话线索设备数-kyc`
,call_num_kyc+call_num_kyc_d as `拨打电话线索人次-kyc`
,valid_call_dev_kyc+valid_call_dev_kyc_d as `有效电话线索设备数-kyc`
,valid_call_num_kyc+valid_call_num_kyc_d as `有效电话线索人次-kyc`
,call_dev_kyc as `当天拨打电话线索设备数-kyc`
,call_num_kyc as `当天拨打电话线索人次-kyc`
,valid_call_dev_kyc as `当天有效电话线索设备数-kyc`
,valid_call_num_kyc as `当天有效电话线索人次-kyc`
,msg_dev_qa `私信咨询设备数-需求自测`
,msg_num_qa `私信咨询人次-需求自测`
......@@ -43,10 +55,14 @@ SELECT day_id `日期`
,valid_msg_num_qa as `有效私信咨询人次-需求自测`
,clue_dev_qa as `授权电话线索设备数-需求自测`
,clue_num_qa as `授权电话线索人次-需求自测`
,call_dev_qa as `拨打电话线索设备数-需求自测`
,call_num_qa as `拨打电话线索人次-需求自测`
,valid_call_dev_qa as `有效电话线索设备数-需求自测`
,valid_call_num_qa as `有效电话线索人次-需求自测`
,call_dev_qa+call_dev_qa_d as `拨打电话线索设备数-需求自测`
,call_num_qa+call_num_qa_d as `拨打电话线索人次-需求自测`
,valid_call_dev_qa+valid_call_dev_qa_d as `有效电话线索设备数-需求自测`
,valid_call_num_qa+valid_call_num_qa_d as `有效电话线索人次-需求自测`
,call_dev_qa_d as `当天拨打电话线索设备数-需求自测`
,call_num_qa_d as `当天拨打电话线索人次-需求自测`
,valid_call_dev_qa_d as `当天有效电话线索设备数-需求自测`
,valid_call_num_qa_d as `当天有效电话线索人次-需求自测`
FROM pm.tl_pm_userclue_d
where partition_day in ('20200901','202001001','20201101','20201201','20210101',regexp_replace(date_sub(current_date,1),'-',''))
order by `日期`,`系统`,`新老`,`是否灰度`
......@@ -41,7 +41,7 @@ FROM
SELECT t1.partition_date as `日期`
,t1.device_type as `设备类型`
,t1.active_type as `活跃类型`
,t2.channel as `渠道`
,t1.channel as `渠道`
,count(case when type='美购详情页' then cl_id end ) as `美购详情页浏览pv`
,count(case when type='加购物车' then cl_id end ) as `加购物车点击pv`
,count(case when type='评价列表页' then cl_id end ) as `评价列表页点击pv`
......@@ -71,6 +71,7 @@ FROM
AND partition_date<regexp_replace((current_date),'-','')
AND page_name = 'welfare_detail'
AND action='page_view'
and params['is_first']=1
)pv
LEFT JOIN
( -- 去掉疑似机构刷量的PV和UV
......@@ -265,30 +266,37 @@ FROM
)click
JOIN
(
SELECT partition_date,device_os_type as device_type,m.device_id
,case WHEN active_type = '4' THEN '老活跃设备'
WHEN active_type in ('1','2') then '新增设备' END as active_type
,array(CASE WHEN first_channel_source_type like '%xinyouxingkong%' or a.device_id is not NULL
or first_channel_source_type in ('promotion_aisi','promotion_koomobi_km00','promotion_koomobi_km01')
or first_channel_source_type like '%longyuzhixing%' or first_channel_source_type like '%jingmeng%'
or first_channel_source_type like '%mailuo%' THEN '可疑'
WHEN (partition_date>='20190601' and tmp.col2 = 'AI')
or (partition_date < '20200301' AND partition_date>='20190601' and first_channel_source_type like 'promotion_toutiao_jy%')
or (partition_date>='20200601' and ((first_channel_source_type like 'promotion_toutiao_jy%') or (first_channel_source_type like 'dyand%') or (first_channel_source_type like 'douyin%')))
THEN 'AI' ELSE '其他' END , '合计') as channel
FROM online.ml_device_day_active_status m
select partition_date,device_type,device_id,active_type,t.channel
from
(
select partition_date,device_os_type as device_type,m.device_id
,case when active_type = '4' then '老活跃设备'
when active_type in ('1','2') then '新增设备' end as active_type
,array(case when (a.device_id is not null or b.device_id is not null
or first_channel_source_type like '%xinyouxingkong%'
or first_channel_source_type like '%jingmeng%'
or first_channel_source_type like '%longyuzhixing%'
or first_channel_source_type like '%mailuo%') then '渠道可疑'
when tmp.is_ai_channel='true' then 'AI' else '其他' end , '合计') as channel
from online.ml_device_day_active_status m
LEFT JOIN
(SELECT col1,col2 --col1:子渠道,col2:是否属于AI,col3:标识
FROM pm.tl_pm_ydl
WHERE col3='0204_danlei_channel')tmp
on first_channel_source_type=tmp.col1
(select code,is_spam,is_ai_channel,partition_day
from DIM.DIM_AI_CHANNEL_ZP_NEW
where partition_day >=regexp_replace(DATE_SUB(current_date,90) ,'-','') and partition_day<regexp_replace((current_date),'-',''))tmp
on first_channel_source_type=tmp.code and m.partition_date=tmp.partition_day
LEFT JOIN
(SELECT DISTINCT device_id
FROM al.al_pm_ct_dv_deviceappversionrollbackfrom20190101_d
WHERE partition_day = regexp_replace(DATE_SUB(current_date,2) ,'-',''))a
(select distinct device_id
from al.al_pm_ct_dv_deviceappversionrollbackfrom20190101_d
where partition_day = regexp_replace(DATE_SUB(current_date,2) ,'-',''))a
ON m.device_id = a.device_id
LEFT JOIN
(select device_id,day_id
from pm.tl_pm_channel_d
where partition_day = regexp_replace(DATE_SUB(current_date,1) ,'-','')
group by device_id,day_id)b
ON m.device_id = b.device_id AND m.partition_date = b.day_id
where partition_date >= regexp_replace(DATE_SUB(current_date,90) ,'-','')
AND partition_date < regexp_replace((current_date),'-','')
AND partition_date < regexp_replace((current_date),'-','')
AND active_type in ('1','2','4')
and first_channel_source_type not in ('yqxiu1','yqxiu2','yqxiu3','yqxiu4','yqxiu5','mxyc1','mxyc2','mxyc3'
,'wanpu','jinshan','jx','maimai','zhuoyi','huatian','suopingjingling','mocha','mizhe','meika','lamabang'
......@@ -298,12 +306,13 @@ FROM
,'promotion_qianka','promotion_xiaoyu','promotion_dianru','promotion_malioaso','promotion_malioaso-shequ'
,'promotion_shike','promotion_julang_jl03','promotion_zuimei','','unknown')
AND first_channel_source_type not like 'promotion\_jf\_%'
)a
LATERAL VIEW explode(a.channel) t AS channel
)mas
ON click.cl_id=mas.device_id
AND click.partition_date=mas.partition_date
)t1
LATERAL VIEW explode(t1.channel) t2 AS channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t2.channel
GROUP BY t1.partition_date,t1.device_type,t1.active_type,t1.channel
)T1
ORDER BY `日期` desc,`设备类型`,`活跃类型`,`渠道`
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