Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
1f2d1fb0
Commit
1f2d1fb0
authored
May 04, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
27bb383a
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1620 additions
and
19 deletions
+1620
-19
workspace.xml
.idea/workspace.xml
+45
-17
en-cn.properties
conf/en-cn.properties
+4
-0
meigou-detail-page.zip
jobs/meigou-detail-page/meigou-detail-page.zip
+0
-0
step1_1.job
jobs/meigou-detail-page/step1_1.job
+4
-0
step1_2.job
jobs/meigou-detail-page/step1_2.job
+4
-0
step1_3.job
jobs/meigou-detail-page/step1_3.job
+4
-0
step1_4.job
jobs/meigou-detail-page/step1_4.job
+4
-0
step2.job
jobs/meigou-detail-page/step2.job
+5
-0
workspace.xml
lib/java/bi-report-service/.idea/workspace.xml
+12
-2
meigou-detail-page-dispense-pv.sql
sqls/meigou-detail-page/meigou-detail-page-dispense-pv.sql
+302
-0
meigou-detail-page-dispense-uv.sql
sqls/meigou-detail-page/meigou-detail-page-dispense-uv.sql
+276
-0
meigou-detail-page-source-pv.sql
sqls/meigou-detail-page/meigou-detail-page-source-pv.sql
+483
-0
meigou-detail-page-source-uv.sql
sqls/meigou-detail-page/meigou-detail-page-source-uv.sql
+477
-0
No files found.
.idea/workspace.xml
View file @
1f2d1fb0
...
...
@@ -2,7 +2,17 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/sbin/test.sh"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/meigou-detail-page.zip"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/step1_1.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/step1_3.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/step1_4.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/step2.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/sqls/meigou-detail-page/meigou-detail-page-dispense-pv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/sqls/meigou-detail-page/meigou-detail-page-dispense-uv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/sqls/meigou-detail-page/meigou-detail-page-source-pv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/sqls/meigou-detail-page/meigou-detail-page-source-uv.sql"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/conf/en-cn.properties"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/conf/en-cn.properties"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/jobs/demo_param/step1_6.job"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/jobs/meigou-detail-page/step1_2.job"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -60,7 +70,7 @@
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"aspect.path.notification.shown"
value=
"true"
/>
<property
name=
"ignore_missing_gitignore"
value=
"true"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/
sqls/demo
"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$/
jobs/meigou-detail-page
"
/>
<property
name=
"project.structure.last.edited"
value=
"Global Libraries"
/>
<property
name=
"project.structure.proportion"
value=
"0.0"
/>
<property
name=
"project.structure.side.proportion"
value=
"0.2"
/>
...
...
@@ -75,9 +85,11 @@
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
</key>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/sqls/demo"
/>
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
<recent
name=
"$PROJECT_DIR$/jobs/demo"
/>
<recent
name=
"$PROJECT_DIR$/jobs/meigou-detail-page"
/>
<recent
name=
"$PROJECT_DIR$/jobs"
/>
<recent
name=
"$PROJECT_DIR$/sqls/meigou-detail-page"
/>
<recent
name=
"$PROJECT_DIR$/sqls/shell"
/>
<recent
name=
"$PROJECT_DIR$/jobs/report_service"
/>
</key>
</component>
<component
name=
"RunManager"
>
...
...
@@ -123,7 +135,7 @@
<workItem
from=
"1588154352798"
duration=
"195000"
/>
<workItem
from=
"1588220085338"
duration=
"7993000"
/>
<workItem
from=
"1588248522289"
duration=
"2820000"
/>
<workItem
from=
"1588344251422"
duration=
"
4196
000"
/>
<workItem
from=
"1588344251422"
duration=
"
8938
000"
/>
</task>
<task
id=
"LOCAL-00001"
summary=
"add init codes."
>
<created>
1587723565207
</created>
...
...
@@ -265,7 +277,21 @@
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1588232535161
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"21"
/>
<task
id=
"LOCAL-00021"
summary=
"update codes"
>
<created>
1588522573935
</created>
<option
name=
"number"
value=
"00021"
/>
<option
name=
"presentableId"
value=
"LOCAL-00021"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1588522573935
</updated>
</task>
<task
id=
"LOCAL-00022"
summary=
"update codes"
>
<created>
1588522705925
</created>
<option
name=
"number"
value=
"00022"
/>
<option
name=
"presentableId"
value=
"LOCAL-00022"
/>
<option
name=
"project"
value=
"LOCAL"
/>
<updated>
1588522705925
</updated>
</task>
<option
name=
"localTasksCounter"
value=
"23"
/>
<servers
/>
</component>
<component
name=
"TypeScriptGeneratedFilesManager"
>
...
...
@@ -322,33 +348,35 @@
<screen
x=
"246"
y=
"1080"
width=
"1920"
height=
"1151"
/>
</state>
<state
x=
"806"
y=
"1321"
key=
"#com.intellij.execution.impl.EditConfigurationsDialog/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587721119316"
/>
<state
x=
"
936"
y=
"1465"
key=
"#com.intellij.fileTypes.FileTypeChooser"
timestamp=
"1587721869266
"
>
<screen
x=
"
246"
y=
"1080"
width=
"1920"
height=
"1151
"
/>
<state
x=
"
690"
y=
"400"
key=
"#com.intellij.fileTypes.FileTypeChooser"
timestamp=
"1588522985742
"
>
<screen
x=
"
0"
y=
"22"
width=
"1920"
height=
"1129
"
/>
</state>
<state
x=
"690"
y=
"400"
key=
"#com.intellij.fileTypes.FileTypeChooser/0.22.1920.1129@0.22.1920.1129"
timestamp=
"1588522985742"
/>
<state
x=
"936"
y=
"1465"
key=
"#com.intellij.fileTypes.FileTypeChooser/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587721869266"
/>
<state
x=
"826"
y=
"1351"
key=
"#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog"
timestamp=
"1587720303076"
>
<screen
x=
"246"
y=
"1080"
width=
"1920"
height=
"1151"
/>
</state>
<state
x=
"826"
y=
"1351"
key=
"#com.intellij.ide.util.frameworkSupport.AddFrameworkSupportDialog/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587720303076"
/>
<state
x=
"554"
y=
"1
86"
key=
"CommitChangelistDialog2"
timestamp=
"1588232534973
"
>
<screen
x=
"0"
y=
"22"
width=
"1920"
height=
"1
058
"
/>
<state
x=
"554"
y=
"1
97"
key=
"CommitChangelistDialog2"
timestamp=
"1588522705736
"
>
<screen
x=
"0"
y=
"22"
width=
"1920"
height=
"1
129
"
/>
</state>
<state
x=
"554"
y=
"197"
key=
"CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129"
timestamp=
"158
7891829124
"
/>
<state
x=
"554"
y=
"197"
key=
"CommitChangelistDialog2/0.22.1920.1129@0.22.1920.1129"
timestamp=
"158
8522705736
"
/>
<state
x=
"554"
y=
"186"
key=
"CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058"
timestamp=
"1588232534973"
/>
<state
x=
"800"
y=
"1258"
key=
"CommitChangelistDialog2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587900238196"
/>
<state
x=
"
1038"
y=
"1373"
key=
"RollbackChangesDialog"
timestamp=
"1587898773703
"
>
<screen
x=
"
246"
y=
"1080"
width=
"1920"
height=
"1151
"
/>
<state
x=
"
792"
y=
"309"
key=
"RollbackChangesDialog"
timestamp=
"1588521468770
"
>
<screen
x=
"
0"
y=
"22"
width=
"1920"
height=
"1129
"
/>
</state>
<state
x=
"792"
y=
"309"
key=
"RollbackChangesDialog/0.22.1920.1129@0.22.1920.1129"
timestamp=
"1588521468770"
/>
<state
x=
"1038"
y=
"1373"
key=
"RollbackChangesDialog/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587898773703"
/>
<state
x=
"448"
y=
"176"
key=
"SettingsEditor"
timestamp=
"1588346857662"
>
<screen
x=
"0"
y=
"22"
width=
"1920"
height=
"1129"
/>
</state>
<state
x=
"448"
y=
"176"
key=
"SettingsEditor/0.22.1920.1129@0.22.1920.1129"
timestamp=
"1588346857662"
/>
<state
x=
"694"
y=
"1237"
key=
"SettingsEditor/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587720319782"
/>
<state
x=
"560"
y=
"3
12"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1588232541898
"
>
<screen
x=
"0"
y=
"22"
width=
"1920"
height=
"1
058
"
/>
<state
x=
"560"
y=
"3
31"
key=
"Vcs.Push.Dialog.v2"
timestamp=
"1588522707302
"
>
<screen
x=
"0"
y=
"22"
width=
"1920"
height=
"1
129
"
/>
</state>
<state
x=
"560"
y=
"331"
key=
"Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129"
timestamp=
"158
7891830625
"
/>
<state
x=
"560"
y=
"331"
key=
"Vcs.Push.Dialog.v2/0.22.1920.1129@0.22.1920.1129"
timestamp=
"158
8522707302
"
/>
<state
x=
"560"
y=
"312"
key=
"Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@0.22.1920.1058"
timestamp=
"1588232541898"
/>
<state
x=
"806"
y=
"1395"
key=
"Vcs.Push.Dialog.v2/246.1080.1920.1151/0.22.1920.1058@246.1080.1920.1151"
timestamp=
"1587900239771"
/>
<state
x=
"578"
y=
"257"
key=
"search.everywhere.popup"
timestamp=
"1588231057499"
>
...
...
conf/en-cn.properties
View file @
1f2d1fb0
demo
=
示例程序-demo
demo_bak
=
示例程序-demo_bak
demo_param
=
带参数的示例程序
meigou-detail-page-dispense-pv
=
美购详情页分发pv
meigou-detail-page-dispense-uv
=
美购详情页分发uv
meigou-detail-page-source-pv
=
美购详情页来源pv
meigou-detail-page-source-uv
=
美购详情页来源uv
jobs/meigou-detail-page/meigou-detail-page.zip
0 → 100644
View file @
1f2d1fb0
File added
jobs/meigou-detail-page/step1_1.job
0 → 100644
View file @
1f2d1fb0
#step1_1.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online bl_hdfs_maidian_updates
\ No newline at end of file
jobs/meigou-detail-page/step1_2.job
0 → 100644
View file @
1f2d1fb0
#step1_2.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_device_day_active_status
\ No newline at end of file
jobs/meigou-detail-page/step1_3.job
0 → 100644
View file @
1f2d1fb0
#step1_4.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_device_day_active_status
\ No newline at end of file
jobs/meigou-detail-page/step1_4.job
0 → 100644
View file @
1f2d1fb0
#step1_4.job
type=command
command=sh /home/bi/bi-report/lib/shell/waitsuccess.sh hive online ml_hospital_spam_pv_day
\ No newline at end of file
jobs/meigou-detail-page/step2.job
0 → 100644
View file @
1f2d1fb0
#step2.job
type=command
dependencies=step1_1,step1_2,step1_3,step1_4
command=curl -X GET http://localhost:8553/api/report/sendEmail/zhaojianwei@igengmei.com/jianweizhao@yeah.net/meigou-detail-page
\ No newline at end of file
lib/java/bi-report-service/.idea/workspace.xml
View file @
1f2d1fb0
...
...
@@ -2,7 +2,17 @@
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"73604af3-3cbc-41f8-9a5f-e6a14a2ada76"
name=
"Default Changelist"
comment=
"add"
>
<change
afterPath=
"$PROJECT_DIR$/../../../sbin/test.sh"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/meigou-detail-page.zip"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/step1_1.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/step1_3.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/step1_4.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/step2.job"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../sqls/meigou-detail-page/meigou-detail-page-dispense-pv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../sqls/meigou-detail-page/meigou-detail-page-dispense-uv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../sqls/meigou-detail-page/meigou-detail-page-source-pv.sql"
afterDir=
"false"
/>
<change
afterPath=
"$PROJECT_DIR$/../../../sqls/meigou-detail-page/meigou-detail-page-source-uv.sql"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../../../conf/en-cn.properties"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../../../conf/en-cn.properties"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../../../jobs/demo_param/step1_6.job"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../../../jobs/meigou-detail-page/step1_2.job"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
...
@@ -218,7 +228,7 @@
<workItem
from=
"1588148891822"
duration=
"2318000"
/>
<workItem
from=
"1588152718016"
duration=
"1463000"
/>
<workItem
from=
"1588154601852"
duration=
"28557000"
/>
<workItem
from=
"1588344252163"
duration=
"
5720
000"
/>
<workItem
from=
"1588344252163"
duration=
"
6866
000"
/>
</task>
<servers
/>
</component>
...
...
sqls/meigou-detail-page/meigou-detail-page-dispense-pv.sql
0 → 100644
View file @
1f2d1fb0
SELECT
`日期`
,
`设备类型`
,
`活跃类型`
,
`渠道`
,
`美购详情页浏览pv`
,(
`加购物车点击pv`
+
`评价列表页点击pv`
+
`立即支付点击pv`
+
`私信及电话咨询pv`
+
`选择美购项目点击pv`
+
`机构主页点击pv`
+
`机构的其他美购点击pv`
+
`推荐美购点击pv`
+
`收藏点击pv`
+
`右上角购物车点击pv`
+
`医生主页点击pv`
+
`分享点击pv`
+
`机构导航点击pv`
)
as
`美购详情页分发pv加总`
,
concat
(
round
((
`加购物车点击pv`
+
`评价列表页点击pv`
+
`立即支付点击pv`
+
`私信及电话咨询pv`
+
`选择美购项目点击pv`
+
`机构主页点击pv`
+
`机构的其他美购点击pv`
+
`推荐美购点击pv`
+
`收藏点击pv`
+
`右上角购物车点击pv`
+
`医生主页点击pv`
+
`分享点击pv`
+
`机构导航点击pv`
)
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`美购详情页分发pv占比加总`
,
`加购物车点击pv`
,
concat
(
round
(
`加购物车点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`加购物车点击pv占比`
,
`评价列表页点击pv`
,
concat
(
round
(
`评价列表页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`评价列表页点击pv占比`
,
`立即支付点击pv`
,
concat
(
round
(
`立即支付点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`立即支付点击pv占比`
,
`私信及电话咨询pv`
,
concat
(
round
(
`私信及电话咨询pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`私信及电话咨询pv占比`
,
`选择美购项目点击pv`
,
concat
(
round
(
`选择美购项目点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`选择美购项目点击pv占比`
,
`机构主页点击pv`
,
concat
(
round
(
`机构主页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构主页点击pv占比`
,
`机构的其他美购点击pv`
,
concat
(
round
(
`机构的其他美购点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构的其他美购点击pv占比`
,
`推荐美购点击pv`
,
concat
(
round
(
`推荐美购点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`推荐美购点击pv占比`
,
`收藏点击pv`
,
concat
(
round
(
`收藏点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`收藏点击pv占比`
,
`右上角购物车点击pv`
,
concat
(
round
(
`右上角购物车点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`右上角购物车点击pv占比`
,
`医生主页点击pv`
,
concat
(
round
(
`医生主页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`医生主页点击pv占比`
,
`分享点击pv`
,
concat
(
round
(
`分享点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`分享点击pv占比`
,
`机构导航点击pv`
,
concat
(
round
(
`机构导航点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构导航点击pv占比`
FROM
(
SELECT
t1
.
partition_date
as
`日期`
,
t1
.
device_type
as
`设备类型`
,
t1
.
active_type
as
`活跃类型`
,
t2
.
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`
,
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`
,
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`
,
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`
,
count
(
case
when
type
=
'分享'
then
cl_id
end
)
as
`分享点击pv`
,
count
(
case
when
type
=
'机构导航'
then
cl_id
end
)
as
`机构导航点击pv`
FROM
(
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device_type
,
mas
.
channel
FROM
(
--浏览需要去掉疑似机构刷量的设备
SELECT
pv
.
partition_date
as
partition_date
,
pv
.
cl_id
as
cl_id
,
type
FROM
(
SELECT
partition_date
,
cl_id
,
'美购详情页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
pv
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
pv
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
UNION
ALL
SELECT
partition_date
,
cl_id
,
'加购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_add'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'右上角购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_navbar_cart'
UNION
ALL
--点击查看更多评论
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_comment'
UNION
ALL
--点击外显的评价标签
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'service_comment_click_tag'
UNION
ALL
--点击外显的日记卡片
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_detail_comment_click_diary_card'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'立即支付'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_buy'
UNION
ALL
--点击选择更美项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_choose'
UNION
ALL
--7.22新版本--点击外露的美购项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'service_sku'
UNION
ALL
--7.22新版本--点击查看更多
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_all'
UNION
ALL
--点击私信按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--7.20之后灰度上线的快捷咨询按钮和预约面诊按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
UNION
ALL
--点击机构下面的在线咨询和电话咨询
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea_contact'
AND
params
[
'connect_type'
]
in
(
'onlineconsult'
,
'phone'
)
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'organization'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构的其他美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_seller_service_item'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构导航'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_address'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'推荐美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_card'
AND
params
[
'card_content_type'
]
=
'service'
AND
params
[
'tab_name'
]
=
'推荐'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'收藏'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_favor'
AND
params
[
'favor_type'
]
=
'service'
AND
params
[
'motion'
]
=
'do'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'医生主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'doctor'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'分享'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
)
click
JOIN
(
SELECT
partition_date
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
device_id
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'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
\_
%'
)
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
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/meigou-detail-page/meigou-detail-page-dispense-uv.sql
0 → 100644
View file @
1f2d1fb0
SELECT
`日期`
,
`设备类型`
,
`活跃类型`
,
`渠道`
,
`美购详情页浏览uv`
,
`加购物车点击uv`
,
concat
(
round
(
`加购物车点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`加购物车点击uv占比`
,
`评价列表页点击uv`
,
concat
(
round
(
`评价列表页点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`评价列表页点击uv占比`
,
`立即支付点击uv`
,
concat
(
round
(
`立即支付点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`立即支付点击uv占比`
,
`私信及电话咨询uv`
,
concat
(
round
(
`私信及电话咨询uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`私信及电话咨询uv占比`
,
`选择美购项目点击uv`
,
concat
(
round
(
`选择美购项目点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`选择美购项目点击uv占比`
,
`机构主页点击uv`
,
concat
(
round
(
`机构主页点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`机构主页点击uv占比`
,
`机构的其他美购点击uv`
,
concat
(
round
(
`机构的其他美购点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`机构的其他美购点击uv占比`
,
`推荐美购点击uv`
,
concat
(
round
(
`推荐美购点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`推荐美购点击uv占比`
,
`收藏点击uv`
,
concat
(
round
(
`收藏点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`收藏点击uv占比`
,
`右上角购物车点击uv`
,
concat
(
round
(
`右上角购物车点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`右上角购物车点击uv占比`
,
`医生主页点击uv`
,
concat
(
round
(
`医生主页点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`医生主页点击uv占比`
,
`分享点击uv`
,
concat
(
round
(
`分享点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`分享点击uv占比`
,
`机构导航点击uv`
,
concat
(
round
(
`机构导航点击uv`
/
`美购详情页浏览uv`
*
100
,
4
),
'%'
)
as
`机构导航点击uv占比`
FROM
(
SELECT
t1
.
partition_date
as
`日期`
,
t1
.
device_type
as
`设备类型`
,
t1
.
active_type
as
`活跃类型`
,
t2
.
channel
as
`渠道`
,
count
(
distinct
case
when
type
=
'美购详情页'
then
cl_id
end
)
as
`美购详情页浏览uv`
,
count
(
distinct
case
when
type
=
'加购物车'
then
cl_id
end
)
as
`加购物车点击uv`
,
count
(
distinct
case
when
type
=
'评价列表页'
then
cl_id
end
)
as
`评价列表页点击uv`
,
count
(
distinct
case
when
type
=
'立即支付'
then
cl_id
end
)
as
`立即支付点击uv`
,
count
(
distinct
case
when
type
=
'私信及电话咨询'
then
cl_id
end
)
as
`私信及电话咨询uv`
,
count
(
distinct
case
when
type
=
'选择美购项目'
then
cl_id
end
)
as
`选择美购项目点击uv`
,
count
(
distinct
case
when
type
=
'机构主页'
then
cl_id
end
)
as
`机构主页点击uv`
,
count
(
distinct
case
when
type
=
'机构的其他美购'
then
cl_id
end
)
as
`机构的其他美购点击uv`
,
count
(
distinct
case
when
type
=
'推荐美购'
then
cl_id
end
)
as
`推荐美购点击uv`
,
count
(
distinct
case
when
type
=
'收藏'
then
cl_id
end
)
as
`收藏点击uv`
,
count
(
distinct
case
when
type
=
'右上角购物车'
then
cl_id
end
)
as
`右上角购物车点击uv`
,
count
(
distinct
case
when
type
=
'医生主页'
then
cl_id
end
)
as
`医生主页点击uv`
,
count
(
distinct
case
when
type
=
'分享'
then
cl_id
end
)
as
`分享点击uv`
,
count
(
distinct
case
when
type
=
'机构导航'
then
cl_id
end
)
as
`机构导航点击uv`
FROM
(
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device_type
,
mas
.
channel
FROM
(
--浏览需要去掉疑似机构刷量的设备
SELECT
pv
.
partition_date
as
partition_date
,
pv
.
cl_id
as
cl_id
,
type
FROM
(
SELECT
partition_date
,
cl_id
,
'美购详情页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
pv
LEFT
JOIN
(
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
pv
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
UNION
ALL
SELECT
partition_date
,
cl_id
,
'加购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_add'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'右上角购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_navbar_cart'
UNION
ALL
--点击查看更多评论
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_comment'
UNION
ALL
--点击外显的评价标签
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'service_comment_click_tag'
UNION
ALL
--点击外显的日记卡片
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_detail_comment_click_diary_card'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'立即支付'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_buy'
UNION
ALL
--点击选择更美项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_choose'
UNION
ALL
--7.22新版本--点击外露的美购项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'service_sku'
UNION
ALL
--7.22新版本--点击查看更多
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_all'
UNION
ALL
--点击私信按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--7.20之后灰度上线的快捷咨询按钮和预约面诊按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
UNION
ALL
--点击机构下面的在线咨询和电话咨询
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea_contact'
AND
params
[
'connect_type'
]
in
(
'onlineconsult'
,
'phone'
)
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'organization'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构的其他美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_seller_service_item'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构导航'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_address'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'推荐美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_card'
AND
params
[
'card_content_type'
]
=
'service'
AND
params
[
'tab_name'
]
=
'推荐'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'收藏'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_favor'
AND
params
[
'favor_type'
]
=
'service'
AND
params
[
'motion'
]
=
'do'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'医生主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'doctor'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'分享'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
'20191201'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
)
click
JOIN
(
SELECT
partition_date
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
device_id
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'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
\_
%'
)
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
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
\ No newline at end of file
sqls/meigou-detail-page/meigou-detail-page-source-pv.sql
0 → 100644
View file @
1f2d1fb0
SELECT
T1
.
partition_date
as
`日期`
,
T1
.
device_type
as
`设备类型`
,
T1
.
active_type
as
`活跃类型`
,
T1
.
channel
as
`渠道`
,
T1
.
wel_pv
as
`美购详情页pv`
,(
T2
.
search_result_welfare_pv
+
T2
.
welfare_list_pv
+
T2
.
organization_detail_pv
+
T2
.
category_pv
+
T2
.
sign_pv
+
T2
.
special_pv
+
T2
.
my_cart_pv
+
T2
.
search_result_more_pv
+
T2
.
welfare_home_pv
+
T2
.
conversation_detail_pv
+
T2
.
wel_pv
+
T2
.
order_detail_pv
+
T2
.
expert_detail_pv
+
T2
.
ai_report_pv
+
T2
.
diary_detail_pv
+
T2
.
zone_pv
)
as
`转化美购pv总量`
,
concat
(
round
((
T2
.
search_result_welfare_pv
+
T2
.
welfare_list_pv
+
T2
.
organization_detail_pv
+
T2
.
category_pv
+
T2
.
sign_pv
+
T2
.
special_pv
+
T2
.
my_cart_pv
+
T2
.
search_result_more_pv
+
T2
.
welfare_home_pv
+
T2
.
conversation_detail_pv
+
T2
.
wel_pv
+
T2
.
order_detail_pv
+
T2
.
expert_detail_pv
+
T2
.
ai_report_pv
+
T2
.
diary_detail_pv
+
T2
.
zone_pv
)
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`转化美购pv占比加总`
,
T1
.
search_result_welfare_pv
as
`搜索结果美购页pv`
,
T2
.
search_result_welfare_pv
as
`搜索结果美购页-转化pv`
,
T3
.
result_wel_add_pv
as
`搜索结果美购页-转化点击加车pv`
,
T3
.
result_wel_buy_pv
as
`搜索结果美购页-转化点击立即支付pv`
,
T3
.
result_wel_msg_pv
as
`搜索结果美购页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
search_result_welfare_pv
/
T1
.
search_result_welfare_pv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-转化pv率`
,
concat
(
round
(
T2
.
search_result_welfare_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-转化美购pv占比`
,
concat
(
round
(
T3
.
result_wel_add_pv
/
T2
.
search_result_welfare_pv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击加车率`
,
concat
(
round
(
T3
.
result_wel_buy_pv
/
T2
.
search_result_welfare_pv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击立即支付率`
,
concat
(
round
(
T3
.
result_wel_msg_pv
/
T2
.
search_result_welfare_pv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击私信咨询率`
,
T1
.
welfare_list_pv
as
`美购列表页pv`
,
T2
.
welfare_list_pv
as
`美购列表页-转化pv`
,
T3
.
wel_list_add_pv
as
`美购列表页-转化点击加车pv`
,
T3
.
wel_list_buy_pv
as
`美购列表页-转化点击立即支付pv`
,
T3
.
wel_list_msg_pv
as
`美购列表页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
welfare_list_pv
*
100
,
4
),
'%'
)
as
`美购列表页-转化pv率`
,
concat
(
round
(
T2
.
welfare_list_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`美购列表页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_list_add_pv
/
T2
.
welfare_list_pv
*
100
,
4
),
'%'
)
as
`美购列表页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_pv
/
T2
.
welfare_list_pv
*
100
,
4
),
'%'
)
as
`美购列表页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_pv
/
T2
.
welfare_list_pv
*
100
,
4
),
'%'
)
as
`美购列表页-点击私信咨询率`
,
T1
.
organization_detail_pv
as
`医院主页pv`
,
T2
.
organization_detail_pv
as
`医院主页-转化pv`
,
T3
.
org_add_pv
as
`医院主页-转化点击加车pv`
,
T3
.
org_buy_pv
as
`医院主页-转化点击立即支付pv`
,
T3
.
org_msg_pv
as
`医院主页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
organization_detail_pv
/
T1
.
organization_detail_pv
*
100
,
4
),
'%'
)
as
`医院主页-转化pv率`
,
concat
(
round
(
T2
.
organization_detail_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`医院主页-转化美购pv占比`
,
concat
(
round
(
T3
.
org_add_pv
/
T2
.
organization_detail_pv
*
100
,
4
),
'%'
)
as
`医院主页-点击加车率`
,
concat
(
round
(
T3
.
org_buy_pv
/
T2
.
organization_detail_pv
*
100
,
4
),
'%'
)
as
`医院主页-点击立即支付率`
,
concat
(
round
(
T3
.
org_msg_pv
/
T2
.
organization_detail_pv
*
100
,
4
),
'%'
)
as
`医院主页-点击私信咨询率`
,
T1
.
category_pv
as
`品类聚合页pv`
,
T2
.
category_pv
as
`品类聚合页-转化pv`
,
T3
.
category_add_pv
as
`品类聚合页-转化点击加车pv`
,
T3
.
category_buy_pv
as
`品类聚合页-转化点击立即支付pv`
,
T3
.
category_msg_pv
as
`品类聚合页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
category_pv
/
T1
.
category_pv
*
100
,
4
),
'%'
)
as
`品类聚合页-转化pv率`
,
concat
(
round
(
T2
.
category_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`品类聚合页-转化美购pv占比`
,
concat
(
round
(
T3
.
category_add_pv
/
T2
.
category_pv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击加车率`
,
concat
(
round
(
T3
.
category_buy_pv
/
T2
.
category_pv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
category_msg_pv
/
T2
.
category_pv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击私信咨询率`
,
T1
.
sign_pv
as
`签到页pv`
,
T2
.
sign_pv
as
`签到页-转化pv`
,
T3
.
sign_add_pv
as
`签到页-转化点击加车pv`
,
T3
.
sign_buy_pv
as
`签到页-转化点击立即支付pv`
,
T3
.
sign_msg_pv
as
`签到页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
sign_pv
*
100
,
4
),
'%'
)
as
`签到页-转化pv率`
,
concat
(
round
(
T2
.
sign_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`签到页-转化美购pv占比`
,
concat
(
round
(
T3
.
sign_add_pv
/
T2
.
sign_pv
*
100
,
4
),
'%'
)
as
`签到页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_pv
/
T2
.
sign_pv
*
100
,
4
),
'%'
)
as
`签到页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_pv
/
T2
.
sign_pv
*
100
,
4
),
'%'
)
as
`签到页-点击私信咨询率`
,
T1
.
special_pv
as
`专题和大促页pv`
,
T2
.
special_pv
as
`专题和大促页-转化pv`
,
T3
.
special_add_pv
as
`专题和大促页-转化点击加车pv`
,
T3
.
special_buy_pv
as
`专题和大促页-转化点击立即支付pv`
,
T3
.
special_msg_pv
as
`专题和大促页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
special_pv
*
100
,
4
),
'%'
)
as
`专题和大促页-转化pv率`
,
concat
(
round
(
T2
.
special_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`专题和大促页-转化美购pv占比`
,
concat
(
round
(
T3
.
special_add_pv
/
T2
.
special_pv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_pv
/
T2
.
special_pv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_pv
/
T2
.
special_pv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击私信咨询率`
,
T1
.
my_cart_pv
as
`购物车pv`
,
T2
.
my_cart_pv
as
`购物车-转化pv`
,
T3
.
cart_add_pv
as
`购物车-转化点击加车pv`
,
T3
.
cart_buy_pv
as
`购物车-转化点击立即支付pv`
,
T3
.
cart_msg_pv
as
`购物车-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
my_cart_pv
/
T1
.
my_cart_pv
*
100
,
4
),
'%'
)
as
`购物车-转化pv率`
,
concat
(
round
(
T2
.
my_cart_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`购物车-转化美购pv占比`
,
concat
(
round
(
T3
.
cart_add_pv
/
T2
.
my_cart_pv
*
100
,
4
),
'%'
)
as
`购物车-点击加车率`
,
concat
(
round
(
T3
.
cart_buy_pv
/
T2
.
my_cart_pv
*
100
,
4
),
'%'
)
as
`购物车-点击立即支付率`
,
concat
(
round
(
T3
.
cart_msg_pv
/
T2
.
my_cart_pv
*
100
,
4
),
'%'
)
as
`购物车-点击私信咨询率`
,
T1
.
search_result_more_pv
as
`搜索结果综合页pv`
,
T2
.
search_result_more_pv
as
`搜索结果综合页-转化pv`
,
T3
.
result_more_add_pv
as
`搜索结果综合页-转化点击加车pv`
,
T3
.
result_more_buy_pv
as
`搜索结果综合页-转化点击立即支付pv`
,
T3
.
result_more_msg_pv
as
`搜索结果综合页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
search_result_more_pv
/
T1
.
search_result_more_pv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-转化pv率`
,
concat
(
round
(
T2
.
search_result_more_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-转化美购pv占比`
,
concat
(
round
(
T3
.
result_more_add_pv
/
T2
.
search_result_more_pv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击加车率`
,
concat
(
round
(
T3
.
result_more_buy_pv
/
T2
.
search_result_more_pv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击立即支付率`
,
concat
(
round
(
T3
.
result_more_msg_pv
/
T2
.
search_result_more_pv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击私信咨询率`
,
T1
.
welfare_home_pv
as
`美购首页pv`
,
T2
.
welfare_home_pv
as
`美购首页-转化pv`
,
T3
.
wel_home_add_pv
as
`美购首页-转化点击加车pv`
,
T3
.
wel_home_buy_pv
as
`美购首页-转化点击立即支付pv`
,
T3
.
wel_home_msg_pv
as
`美购首页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
welfare_home_pv
*
100
,
4
),
'%'
)
as
`美购首页-转化pv率`
,
concat
(
round
(
T2
.
welfare_home_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`美购首页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_home_add_pv
/
T2
.
welfare_home_pv
*
100
,
4
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_pv
/
T2
.
welfare_home_pv
*
100
,
4
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_pv
/
T2
.
welfare_home_pv
*
100
,
4
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
conversation_detail_pv
as
`私信详情页pv`
,
T2
.
conversation_detail_pv
as
`私信详情页-转化pv`
,
T3
.
conv_add_pv
as
`私信详情页-转化点击加车pv`
,
T3
.
conv_buy_pv
as
`私信详情页-转化点击立即支付pv`
,
T3
.
conv_msg_pv
as
`私信详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
conversation_detail_pv
*
100
,
4
),
'%'
)
as
`私信详情页-转化pv率`
,
concat
(
round
(
T2
.
conversation_detail_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`私信详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
conv_add_pv
/
T2
.
conversation_detail_pv
*
100
,
4
),
'%'
)
as
`私信详情页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_pv
/
T2
.
conversation_detail_pv
*
100
,
4
),
'%'
)
as
`私信详情页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_pv
/
T2
.
conversation_detail_pv
*
100
,
4
),
'%'
)
as
`私信详情页-点击私信咨询率`
,
T1
.
wel_pv
as
`美购详情页pv`
,
T2
.
wel_pv
as
`其他美购详情页-转化pv`
,
T3
.
wel_add_pv
as
`其他美购详情页-转化点击加车pv`
,
T3
.
wel_buy_pv
as
`其他美购详情页-转化点击立即支付pv`
,
T3
.
wel_msg_pv
as
`其他美购详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`其他美购详情页-转化pv率`
,
concat
(
round
(
T2
.
wel_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`其他美购详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
wel_add_pv
/
T2
.
wel_pv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_pv
/
T2
.
wel_pv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_pv
/
T2
.
wel_pv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
order_detail_pv
as
`订单详情页pv`
,
T2
.
order_detail_pv
as
`订单详情页-转化pv`
,
T3
.
order_add_pv
as
`订单详情页-转化点击加车pv`
,
T3
.
order_buy_pv
as
`订单详情页-转化点击立即支付pv`
,
T3
.
order_msg_pv
as
`订单详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
order_detail_pv
/
T1
.
order_detail_pv
*
100
,
4
),
'%'
)
as
`订单详情页-转化pv率`
,
concat
(
round
(
T2
.
order_detail_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`订单详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
order_add_pv
/
T2
.
order_detail_pv
*
100
,
4
),
'%'
)
as
`订单详情页-点击加车率`
,
concat
(
round
(
T3
.
order_buy_pv
/
T2
.
order_detail_pv
*
100
,
4
),
'%'
)
as
`订单详情页-点击立即支付率`
,
concat
(
round
(
T3
.
order_msg_pv
/
T2
.
order_detail_pv
*
100
,
4
),
'%'
)
as
`订单详情页-点击私信咨询率`
,
T1
.
expert_detail_pv
as
`医生主页pv`
,
T2
.
expert_detail_pv
as
`医生主页-转化pv`
,
T3
.
exp_add_pv
as
`医生主页-转化点击加车pv`
,
T3
.
exp_buy_pv
as
`医生主页-转化点击立即支付pv`
,
T3
.
exp_msg_pv
as
`医生主页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
expert_detail_pv
/
T1
.
expert_detail_pv
*
100
,
4
),
'%'
)
as
`医生主页-转化pv率`
,
concat
(
round
(
T2
.
expert_detail_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`医生主页-转化美购pv占比`
,
concat
(
round
(
T3
.
exp_add_pv
/
T2
.
expert_detail_pv
*
100
,
4
),
'%'
)
as
`医生主页-点击加车率`
,
concat
(
round
(
T3
.
exp_buy_pv
/
T2
.
expert_detail_pv
*
100
,
4
),
'%'
)
as
`医生主页-点击立即支付率`
,
concat
(
round
(
T3
.
exp_msg_pv
/
T2
.
expert_detail_pv
*
100
,
4
),
'%'
)
as
`医生主页-点击私信咨询率`
,
T1
.
ai_report_pv
as
`AI结果页pv`
,
T2
.
ai_report_pv
as
`AI结果页-转化pv`
,
T3
.
ai_add_pv
as
`AI结果页-转化点击加车pv`
,
T3
.
ai_buy_pv
as
`AI结果页-转化点击立即支付pv`
,
T3
.
ai_msg_pv
as
`AI结果页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
ai_report_pv
*
100
,
4
),
'%'
)
as
`AI结果页-转化pv率`
,
concat
(
round
(
T2
.
ai_report_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`AI结果页-转化美购pv占比`
,
concat
(
round
(
T3
.
ai_add_pv
/
T2
.
ai_report_pv
*
100
,
4
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_pv
/
T2
.
ai_report_pv
*
100
,
4
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_pv
/
T2
.
ai_report_pv
*
100
,
4
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
diary_detail_pv
as
`日记本详情页pv`
,
T2
.
diary_detail_pv
as
`日记本详情页-转化pv`
,
T3
.
diary_add_pv
as
`日记本详情页-转化点击加车pv`
,
T3
.
diary_buy_pv
as
`日记本详情页-转化点击立即支付pv`
,
T3
.
diary_msg_pv
as
`日记本详情页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
diary_detail_pv
/
T1
.
diary_detail_pv
*
100
,
4
),
'%'
)
as
`日记本详情页-转化pv率`
,
concat
(
round
(
T2
.
diary_detail_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`日记本详情页-转化美购pv占比`
,
concat
(
round
(
T3
.
diary_add_pv
/
T2
.
diary_detail_pv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击加车率`
,
concat
(
round
(
T3
.
diary_buy_pv
/
T2
.
diary_detail_pv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击立即支付率`
,
concat
(
round
(
T3
.
diary_msg_pv
/
T2
.
diary_detail_pv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击私信咨询率`
,
T1
.
zone_pv
as
`内容聚合页pv`
,
T2
.
zone_pv
as
`内容聚合页-转化pv`
,
T3
.
zone_add_pv
as
`内容聚合页-转化点击加车pv`
,
T3
.
zone_buy_pv
as
`内容聚合页-转化点击立即支付pv`
,
T3
.
zone_msg_pv
as
`内容聚合页-转化点击私信咨询pv`
,
concat
(
round
(
T2
.
zone_pv
/
T1
.
zone_pv
*
100
,
4
),
'%'
)
as
`内容聚合页-转化pv率`
,
concat
(
round
(
T2
.
zone_pv
/
T1
.
wel_pv
*
100
,
4
),
'%'
)
as
`内容聚合页-转化美购pv占比`
,
concat
(
round
(
T3
.
zone_add_pv
/
T2
.
zone_pv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击加车率`
,
concat
(
round
(
T3
.
zone_buy_pv
/
T2
.
zone_pv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
zone_msg_pv
/
T2
.
zone_pv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击私信咨询率`
FROM
(
--能够走向美购详情页的各页面pv/uv
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
page_name
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_pv
,
count
(
case
when
page_name
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_pv
,
count
(
case
when
page_name
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_pv
,
count
(
case
when
page_name
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_pv
,
count
(
case
when
page_name
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_pv
,
count
(
case
when
page_name
=
'category'
then
t1
.
cl_id
end
)
as
category_pv
,
count
(
case
when
page_name
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_pv
,
count
(
case
when
page_name
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_pv
,
count
(
case
when
page_name
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_pv
,
count
(
case
when
page_name
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_pv
,
count
(
case
when
page_name
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_pv
,
count
(
case
when
page_name
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_pv
,
count
(
case
when
page_name
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_pv
,
count
(
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
page_name
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_pv
,
count
(
case
when
page_name
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_pv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
page_name
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T1
LEFT
JOIN
(
--不同referrer下的美购详情页pv/uv
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
referrer
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_pv
,
count
(
case
when
referrer
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_pv
,
count
(
case
when
referrer
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_pv
,
count
(
case
when
referrer
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_pv
,
count
(
case
when
referrer
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_pv
,
count
(
case
when
referrer
=
'category'
then
t1
.
cl_id
end
)
as
category_pv
,
count
(
case
when
referrer
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_pv
,
count
(
case
when
referrer
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_pv
,
count
(
case
when
referrer
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_pv
,
count
(
case
when
referrer
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_pv
,
count
(
case
when
referrer
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_pv
,
count
(
case
when
referrer
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_pv
,
count
(
case
when
referrer
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_pv
--专题和大促
,
count
(
case
when
referrer
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_pv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_pv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
referrer
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T2
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_type
=
T2
.
device_type
AND
T1
.
active_type
=
T2
.
active_type
AND
T1
.
channel
=
T2
.
channel
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_add_pv
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_buy_pv
,
count
(
case
when
referrer
=
'welfare_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_msg_pv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_more_add_pv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_more_buy_pv
,
count
(
case
when
referrer
=
'search_result_more'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_more_msg_pv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_wel_add_pv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_wel_buy_pv
,
count
(
case
when
referrer
=
'search_result_welfare'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_wel_msg_pv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
org_add_pv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
org_buy_pv
,
count
(
case
when
referrer
=
'organization_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
org_msg_pv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
exp_add_pv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
exp_buy_pv
,
count
(
case
when
referrer
=
'expert_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
exp_msg_pv
,
count
(
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
category_add_pv
,
count
(
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
category_buy_pv
,
count
(
case
when
referrer
=
'category'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
category_msg_pv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_list_add_pv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_list_buy_pv
,
count
(
case
when
referrer
=
'welfare_list'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_list_msg_pv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_home_add_pv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_home_buy_pv
,
count
(
case
when
referrer
=
'welfare_home'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_home_msg_pv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
conv_add_pv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
conv_buy_pv
,
count
(
case
when
referrer
=
'conversation_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
conv_msg_pv
,
count
(
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
cart_add_pv
,
count
(
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
cart_buy_pv
,
count
(
case
when
referrer
=
'my_cart'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
cart_msg_pv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
diary_add_pv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
diary_buy_pv
,
count
(
case
when
referrer
=
'diary_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
diary_msg_pv
,
count
(
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
order_add_pv
,
count
(
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
order_buy_pv
,
count
(
case
when
referrer
=
'order_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
order_msg_pv
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
sign_add_pv
,
count
(
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
sign_buy_pv
,
count
(
case
when
referrer
=
'new_sign'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
sign_msg_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_pv
,
count
(
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
zone_add_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
zone_buy_pv
,
count
(
case
when
referrer
=
'zone_v3'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
zone_msg_pv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
ai_add_pv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
ai_buy_pv
,
count
(
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
ai_msg_pv
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
--点击加车/支付
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
)
UNION
ALL
--点击私信按钮
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--点击私信区域(目前referrer缺失,故通过拆解referrer_link的方式获得)
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
(
SELECT
partition_date
,
cl_id
,
action
,
t2
.
referrer
as
referrer
,
row_number
()
over
(
PARTITION
BY
t1
.
referrer_link
,
t1
.
cl_id
ORDER
BY
t2
.
link_id
desc
)
as
rank
from
(
SELECT
partition_date
,
params
[
'referrer_link'
]
as
referrer_link
,
cl_id
,
action
,
json_split
(
params
[
'referrer_link'
],
'string'
)
as
a
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
)
t1
lateral
view
posexplode
(
a
)
t2
as
link_id
,
referrer
)
t3
where
rank
=
1
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T3
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_type
=
T3
.
device_type
AND
T1
.
active_type
=
T3
.
active_type
AND
T1
.
channel
=
T3
.
channel
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
\ No newline at end of file
sqls/meigou-detail-page/meigou-detail-page-source-uv.sql
0 → 100644
View file @
1f2d1fb0
SELECT
T1
.
partition_date
as
`日期`
,
T1
.
device_type
as
`设备类型`
,
T1
.
active_type
as
`活跃类型`
,
T1
.
channel
as
`渠道`
,
T1
.
wel_uv
as
`美购详情页uv`
,
T1
.
search_result_welfare_uv
as
`搜索结果美购页uv`
,
T2
.
search_result_welfare_uv
as
`搜索结果美购页-转化uv`
,
T3
.
result_wel_add_uv
as
`搜索结果美购页-转化点击加车uv`
,
T3
.
result_wel_buy_uv
as
`搜索结果美购页-转化点击立即支付uv`
,
T3
.
result_wel_msg_uv
as
`搜索结果美购页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
search_result_welfare_uv
/
T1
.
search_result_welfare_uv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-转化uv率`
,
concat
(
round
(
T2
.
search_result_welfare_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-转化美购uv占比`
,
concat
(
round
(
T3
.
result_wel_add_uv
/
T2
.
search_result_welfare_uv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击加车率`
,
concat
(
round
(
T3
.
result_wel_buy_uv
/
T2
.
search_result_welfare_uv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击立即支付率`
,
concat
(
round
(
T3
.
result_wel_msg_uv
/
T2
.
search_result_welfare_uv
*
100
,
4
),
'%'
)
as
`搜索结果美购页-点击私信咨询率`
,
T1
.
welfare_list_uv
as
`美购列表页uv`
,
T2
.
welfare_list_uv
as
`美购列表页-转化uv`
,
T3
.
wel_list_add_uv
as
`美购列表页-转化点击加车uv`
,
T3
.
wel_list_buy_uv
as
`美购列表页-转化点击立即支付uv`
,
T3
.
wel_list_msg_uv
as
`美购列表页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
welfare_list_uv
*
100
,
4
),
'%'
)
as
`美购列表页-转化uv率`
,
concat
(
round
(
T2
.
welfare_list_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`美购列表页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_list_add_uv
/
T2
.
welfare_list_uv
*
100
,
4
),
'%'
)
as
`美购列表页-点击加车率`
,
concat
(
round
(
T3
.
wel_list_buy_uv
/
T2
.
welfare_list_uv
*
100
,
4
),
'%'
)
as
`美购列表页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_list_msg_uv
/
T2
.
welfare_list_uv
*
100
,
4
),
'%'
)
as
`美购列表页-点击私信咨询率`
,
T1
.
organization_detail_uv
as
`医院主页uv`
,
T2
.
organization_detail_uv
as
`医院主页-转化uv`
,
T3
.
org_add_uv
as
`医院主页-转化点击加车uv`
,
T3
.
org_buy_uv
as
`医院主页-转化点击立即支付uv`
,
T3
.
org_msg_uv
as
`医院主页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
organization_detail_uv
/
T1
.
organization_detail_uv
*
100
,
4
),
'%'
)
as
`医院主页-转化uv率`
,
concat
(
round
(
T2
.
organization_detail_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`医院主页-转化美购uv占比`
,
concat
(
round
(
T3
.
org_add_uv
/
T2
.
organization_detail_uv
*
100
,
4
),
'%'
)
as
`医院主页-点击加车率`
,
concat
(
round
(
T3
.
org_buy_uv
/
T2
.
organization_detail_uv
*
100
,
4
),
'%'
)
as
`医院主页-点击立即支付率`
,
concat
(
round
(
T3
.
org_msg_uv
/
T2
.
organization_detail_uv
*
100
,
4
),
'%'
)
as
`医院主页-点击私信咨询率`
,
T1
.
category_uv
as
`品类聚合页uv`
,
T2
.
category_uv
as
`品类聚合页-转化uv`
,
T3
.
category_add_uv
as
`品类聚合页-转化点击加车uv`
,
T3
.
category_buy_uv
as
`品类聚合页-转化点击立即支付uv`
,
T3
.
category_msg_uv
as
`品类聚合页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
category_uv
/
T1
.
category_uv
*
100
,
4
),
'%'
)
as
`品类聚合页-转化uv率`
,
concat
(
round
(
T2
.
category_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`品类聚合页-转化美购uv占比`
,
concat
(
round
(
T3
.
category_add_uv
/
T2
.
category_uv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击加车率`
,
concat
(
round
(
T3
.
category_buy_uv
/
T2
.
category_uv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
category_msg_uv
/
T2
.
category_uv
*
100
,
4
),
'%'
)
as
`品类聚合页-点击私信咨询率`
,
T1
.
sign_uv
as
`签到页uv`
,
T2
.
sign_uv
as
`签到页-转化uv`
,
T3
.
sign_add_uv
as
`签到页-转化点击加车uv`
,
T3
.
sign_buy_uv
as
`签到页-转化点击立即支付uv`
,
T3
.
sign_msg_uv
as
`签到页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
sign_uv
*
100
,
4
),
'%'
)
as
`签到页-转化uv率`
,
concat
(
round
(
T2
.
sign_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`签到页-转化美购uv占比`
,
concat
(
round
(
T3
.
sign_add_uv
/
T2
.
sign_uv
*
100
,
4
),
'%'
)
as
`签到页-点击加车率`
,
concat
(
round
(
T3
.
sign_buy_uv
/
T2
.
sign_uv
*
100
,
4
),
'%'
)
as
`签到页-点击立即支付率`
,
concat
(
round
(
T3
.
sign_msg_uv
/
T2
.
sign_uv
*
100
,
4
),
'%'
)
as
`签到页-点击私信咨询率`
,
T1
.
special_uv
as
`专题和大促页uv`
,
T2
.
special_uv
as
`专题和大促页-转化uv`
,
T3
.
special_add_uv
as
`专题和大促页-转化点击加车uv`
,
T3
.
special_buy_uv
as
`专题和大促页-转化点击立即支付uv`
,
T3
.
special_msg_uv
as
`专题和大促页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
special_uv
*
100
,
4
),
'%'
)
as
`专题和大促页-转化uv率`
,
concat
(
round
(
T2
.
special_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`专题和大促页-转化美购uv占比`
,
concat
(
round
(
T3
.
special_add_uv
/
T2
.
special_uv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击加车率`
,
concat
(
round
(
T3
.
special_buy_uv
/
T2
.
special_uv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击立即支付率`
,
concat
(
round
(
T3
.
special_msg_uv
/
T2
.
special_uv
*
100
,
4
),
'%'
)
as
`专题和大促页-点击私信咨询率`
,
T1
.
my_cart_uv
as
`购物车uv`
,
T2
.
my_cart_uv
as
`购物车-转化uv`
,
T3
.
cart_add_uv
as
`购物车-转化点击加车uv`
,
T3
.
cart_buy_uv
as
`购物车-转化点击立即支付uv`
,
T3
.
cart_msg_uv
as
`购物车-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
my_cart_uv
/
T1
.
my_cart_uv
*
100
,
4
),
'%'
)
as
`购物车-转化uv率`
,
concat
(
round
(
T2
.
my_cart_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`购物车-转化美购uv占比`
,
concat
(
round
(
T3
.
cart_add_uv
/
T2
.
my_cart_uv
*
100
,
4
),
'%'
)
as
`购物车-点击加车率`
,
concat
(
round
(
T3
.
cart_buy_uv
/
T2
.
my_cart_uv
*
100
,
4
),
'%'
)
as
`购物车-点击立即支付率`
,
concat
(
round
(
T3
.
cart_msg_uv
/
T2
.
my_cart_uv
*
100
,
4
),
'%'
)
as
`购物车-点击私信咨询率`
,
T1
.
search_result_more_uv
as
`搜索结果综合页uv`
,
T2
.
search_result_more_uv
as
`搜索结果综合页-转化uv`
,
T3
.
result_more_add_uv
as
`搜索结果综合页-转化点击加车uv`
,
T3
.
result_more_buy_uv
as
`搜索结果综合页-转化点击立即支付uv`
,
T3
.
result_more_msg_uv
as
`搜索结果综合页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
search_result_more_uv
/
T1
.
search_result_more_uv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-转化uv率`
,
concat
(
round
(
T2
.
search_result_more_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-转化美购uv占比`
,
concat
(
round
(
T3
.
result_more_add_uv
/
T2
.
search_result_more_uv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击加车率`
,
concat
(
round
(
T3
.
result_more_buy_uv
/
T2
.
search_result_more_uv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击立即支付率`
,
concat
(
round
(
T3
.
result_more_msg_uv
/
T2
.
search_result_more_uv
*
100
,
4
),
'%'
)
as
`搜索结果综合页-点击私信咨询率`
,
T1
.
welfare_home_uv
as
`美购首页uv`
,
T2
.
welfare_home_uv
as
`美购首页-转化uv`
,
T3
.
wel_home_add_uv
as
`美购首页-转化点击加车uv`
,
T3
.
wel_home_buy_uv
as
`美购首页-转化点击立即支付uv`
,
T3
.
wel_home_msg_uv
as
`美购首页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
welfare_home_uv
*
100
,
4
),
'%'
)
as
`美购首页-转化uv率`
,
concat
(
round
(
T2
.
welfare_home_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`美购首页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_home_add_uv
/
T2
.
welfare_home_uv
*
100
,
4
),
'%'
)
as
`美购首页-点击加车率`
,
concat
(
round
(
T3
.
wel_home_buy_uv
/
T2
.
welfare_home_uv
*
100
,
4
),
'%'
)
as
`美购首页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_home_msg_uv
/
T2
.
welfare_home_uv
*
100
,
4
),
'%'
)
as
`美购首页-点击私信咨询率`
,
T1
.
conversation_detail_uv
as
`私信详情页uv`
,
T2
.
conversation_detail_uv
as
`私信详情页-转化uv`
,
T3
.
conv_add_uv
as
`私信详情页-转化点击加车uv`
,
T3
.
conv_buy_uv
as
`私信详情页-转化点击立即支付uv`
,
T3
.
conv_msg_uv
as
`私信详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
conversation_detail_uv
*
100
,
4
),
'%'
)
as
`私信详情页-转化uv率`
,
concat
(
round
(
T2
.
conversation_detail_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`私信详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
conv_add_uv
/
T2
.
conversation_detail_uv
*
100
,
4
),
'%'
)
as
`私信详情页-点击加车率`
,
concat
(
round
(
T3
.
conv_buy_uv
/
T2
.
conversation_detail_uv
*
100
,
4
),
'%'
)
as
`私信详情页-点击立即支付率`
,
concat
(
round
(
T3
.
conv_msg_uv
/
T2
.
conversation_detail_uv
*
100
,
4
),
'%'
)
as
`私信详情页-点击私信咨询率`
,
T1
.
wel_uv
as
`美购详情页uv`
,
T2
.
wel_uv
as
`其他美购详情页-转化uv`
,
T3
.
wel_add_uv
as
`其他美购详情页-转化点击加车uv`
,
T3
.
wel_buy_uv
as
`其他美购详情页-转化点击立即支付uv`
,
T3
.
wel_msg_uv
as
`其他美购详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`其他美购详情页-转化uv率`
,
concat
(
round
(
T2
.
wel_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`其他美购详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
wel_add_uv
/
T2
.
wel_uv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击加车率`
,
concat
(
round
(
T3
.
wel_buy_uv
/
T2
.
wel_uv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击立即支付率`
,
concat
(
round
(
T3
.
wel_msg_uv
/
T2
.
wel_uv
*
100
,
4
),
'%'
)
as
`其他美购详情页-点击私信咨询率`
,
T1
.
order_detail_uv
as
`订单详情页uv`
,
T2
.
order_detail_uv
as
`订单详情页-转化uv`
,
T3
.
order_add_uv
as
`订单详情页-转化点击加车uv`
,
T3
.
order_buy_uv
as
`订单详情页-转化点击立即支付uv`
,
T3
.
order_msg_uv
as
`订单详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
order_detail_uv
/
T1
.
order_detail_uv
*
100
,
4
),
'%'
)
as
`订单详情页-转化uv率`
,
concat
(
round
(
T2
.
order_detail_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`订单详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
order_add_uv
/
T2
.
order_detail_uv
*
100
,
4
),
'%'
)
as
`订单详情页-点击加车率`
,
concat
(
round
(
T3
.
order_buy_uv
/
T2
.
order_detail_uv
*
100
,
4
),
'%'
)
as
`订单详情页-点击立即支付率`
,
concat
(
round
(
T3
.
order_msg_uv
/
T2
.
order_detail_uv
*
100
,
4
),
'%'
)
as
`订单详情页-点击私信咨询率`
,
T1
.
expert_detail_uv
as
`医生主页uv`
,
T2
.
expert_detail_uv
as
`医生主页-转化uv`
,
T3
.
exp_add_uv
as
`医生主页-转化点击加车uv`
,
T3
.
exp_buy_uv
as
`医生主页-转化点击立即支付uv`
,
T3
.
exp_msg_uv
as
`医生主页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
expert_detail_uv
/
T1
.
expert_detail_uv
*
100
,
4
),
'%'
)
as
`医生主页-转化uv率`
,
concat
(
round
(
T2
.
expert_detail_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`医生主页-转化美购uv占比`
,
concat
(
round
(
T3
.
exp_add_uv
/
T2
.
expert_detail_uv
*
100
,
4
),
'%'
)
as
`医生主页-点击加车率`
,
concat
(
round
(
T3
.
exp_buy_uv
/
T2
.
expert_detail_uv
*
100
,
4
),
'%'
)
as
`医生主页-点击立即支付率`
,
concat
(
round
(
T3
.
exp_msg_uv
/
T2
.
expert_detail_uv
*
100
,
4
),
'%'
)
as
`医生主页-点击私信咨询率`
,
T1
.
ai_report_uv
as
`AI结果页uv`
,
T2
.
ai_report_uv
as
`AI结果页-转化uv`
,
T3
.
ai_add_uv
as
`AI结果页-转化点击加车uv`
,
T3
.
ai_buy_uv
as
`AI结果页-转化点击立即支付uv`
,
T3
.
ai_msg_uv
as
`AI结果页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
ai_report_uv
*
100
,
4
),
'%'
)
as
`AI结果页-转化uv率`
,
concat
(
round
(
T2
.
ai_report_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`AI结果页-转化美购uv占比`
,
concat
(
round
(
T3
.
ai_add_uv
/
T2
.
ai_report_uv
*
100
,
4
),
'%'
)
as
`AI结果页-点击加车率`
,
concat
(
round
(
T3
.
ai_buy_uv
/
T2
.
ai_report_uv
*
100
,
4
),
'%'
)
as
`AI结果页-点击立即支付率`
,
concat
(
round
(
T3
.
ai_msg_uv
/
T2
.
ai_report_uv
*
100
,
4
),
'%'
)
as
`AI结果页-点击私信咨询率`
,
T1
.
diary_detail_uv
as
`日记本详情页uv`
,
T2
.
diary_detail_uv
as
`日记本详情页-转化uv`
,
T3
.
diary_add_uv
as
`日记本详情页-转化点击加车uv`
,
T3
.
diary_buy_uv
as
`日记本详情页-转化点击立即支付uv`
,
T3
.
diary_msg_uv
as
`日记本详情页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
diary_detail_uv
/
T1
.
diary_detail_uv
*
100
,
4
),
'%'
)
as
`日记本详情页-转化uv率`
,
concat
(
round
(
T2
.
diary_detail_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`日记本详情页-转化美购uv占比`
,
concat
(
round
(
T3
.
diary_add_uv
/
T2
.
diary_detail_uv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击加车率`
,
concat
(
round
(
T3
.
diary_buy_uv
/
T2
.
diary_detail_uv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击立即支付率`
,
concat
(
round
(
T3
.
diary_msg_uv
/
T2
.
diary_detail_uv
*
100
,
4
),
'%'
)
as
`日记本详情页-点击私信咨询率`
,
T1
.
zone_uv
as
`内容聚合页uv`
,
T2
.
zone_uv
as
`内容聚合页-转化uv`
,
T3
.
zone_add_uv
as
`内容聚合页-转化点击加车uv`
,
T3
.
zone_buy_uv
as
`内容聚合页-转化点击立即支付uv`
,
T3
.
zone_msg_uv
as
`内容聚合页-转化点击私信咨询uv`
,
concat
(
round
(
T2
.
zone_uv
/
T1
.
zone_uv
*
100
,
4
),
'%'
)
as
`内容聚合页-转化uv率`
,
concat
(
round
(
T2
.
zone_uv
/
T1
.
wel_uv
*
100
,
4
),
'%'
)
as
`内容聚合页-转化美购uv占比`
,
concat
(
round
(
T3
.
zone_add_uv
/
T2
.
zone_uv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击加车率`
,
concat
(
round
(
T3
.
zone_buy_uv
/
T2
.
zone_uv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击立即支付率`
,
concat
(
round
(
T3
.
zone_msg_uv
/
T2
.
zone_uv
*
100
,
4
),
'%'
)
as
`内容聚合页-点击私信咨询率`
FROM
(
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
page_name
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
distinct
case
when
page_name
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
distinct
case
when
page_name
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
distinct
case
when
page_name
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
distinct
case
when
page_name
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
distinct
case
when
page_name
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
distinct
case
when
page_name
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
distinct
case
when
page_name
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
distinct
case
when
page_name
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
distinct
case
when
page_name
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
distinct
case
when
page_name
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
distinct
case
when
page_name
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
distinct
case
when
page_name
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
distinct
case
when
page_name
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
distinct
case
when
page_name
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
distinct
case
when
page_name
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
page_name
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
page_name
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T1
LEFT
JOIN
(
--不同referrer下的美购详情页uv/uv
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
then
t1
.
cl_id
end
)
as
wel_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
then
t1
.
cl_id
end
)
as
search_result_more_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
then
t1
.
cl_id
end
)
as
search_result_welfare_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
then
t1
.
cl_id
end
)
as
organization_detail_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
then
t1
.
cl_id
end
)
as
expert_detail_uv
,
count
(
distinct
case
when
referrer
=
'category'
then
t1
.
cl_id
end
)
as
category_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
then
t1
.
cl_id
end
)
as
welfare_list_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
then
t1
.
cl_id
end
)
as
welfare_home_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
then
t1
.
cl_id
end
)
as
conversation_detail_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
then
t1
.
cl_id
end
)
as
my_cart_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
then
t1
.
cl_id
end
)
as
diary_detail_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
then
t1
.
cl_id
end
)
as
order_detail_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
then
t1
.
cl_id
end
)
as
sign_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
then
t1
.
cl_id
end
)
as
special_uv
--专题和大促
,
count
(
distinct
case
when
referrer
=
'zone_v3'
then
t1
.
cl_id
end
)
as
zone_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
then
t1
.
cl_id
end
)
as
ai_report_uv
--待之后增加模拟整形页面
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
SELECT
partition_date
,
referrer
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T2
ON
T1
.
partition_date
=
T2
.
partition_date
and
T1
.
device_type
=
T2
.
device_type
AND
T1
.
active_type
=
T2
.
active_type
AND
T1
.
channel
=
T2
.
channel
LEFT
JOIN
(
--点击加车/支付/私信的不同来源
SELECT
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_msg_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_more_add_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_more_buy_uv
,
count
(
distinct
case
when
referrer
=
'search_result_more'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_more_msg_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
result_wel_add_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
result_wel_buy_uv
,
count
(
distinct
case
when
referrer
=
'search_result_welfare'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
result_wel_msg_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
org_add_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
org_buy_uv
,
count
(
distinct
case
when
referrer
=
'organization_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
org_msg_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
exp_add_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
exp_buy_uv
,
count
(
distinct
case
when
referrer
=
'expert_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
exp_msg_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
category_add_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
category_buy_uv
,
count
(
distinct
case
when
referrer
=
'category'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
category_msg_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_list_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_list_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_list'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_list_msg_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
wel_home_add_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
wel_home_buy_uv
,
count
(
distinct
case
when
referrer
=
'welfare_home'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
wel_home_msg_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
conv_add_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
conv_buy_uv
,
count
(
distinct
case
when
referrer
=
'conversation_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
conv_msg_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
cart_add_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
cart_buy_uv
,
count
(
distinct
case
when
referrer
=
'my_cart'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
cart_msg_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
diary_add_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
diary_buy_uv
,
count
(
distinct
case
when
referrer
=
'diary_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
diary_msg_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
order_add_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
order_buy_uv
,
count
(
distinct
case
when
referrer
=
'order_detail'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
order_msg_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
sign_add_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
sign_buy_uv
,
count
(
distinct
case
when
referrer
=
'new_sign'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
sign_msg_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
special_add_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
special_buy_uv
,
count
(
distinct
case
when
referrer
in
(
'special_polymer'
,
'newt_welfare_special'
,
'welfare_special'
,
'activity_promotion_seckill'
,
'activity_promotion'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
special_msg_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
zone_add_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
zone_buy_uv
,
count
(
distinct
case
when
referrer
=
'zone_v3'
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
zone_msg_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_add'
then
t1
.
cl_id
end
)
as
ai_add_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
=
'welfare_multiattribute_click_buy'
then
t1
.
cl_id
end
)
as
ai_buy_uv
,
count
(
distinct
case
when
referrer
in
(
'report_result'
,
'face_detect_result'
)
and
action
in
(
'welfare_detail_click_message'
,
'on_click_button'
)
then
t1
.
cl_id
end
)
as
ai_msg_uv
FROM
(
SELECT
t1
.
partition_date
,
t1
.
referrer
,
t1
.
action
,
t1
.
cl_id
,
mas
.
device_type
,
mas
.
active_type
,
mas
.
channel
FROM
(
--点击加车/支付
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
in
(
'welfare_multiattribute_click_add'
,
'welfare_multiattribute_click_buy'
)
UNION
ALL
--点击私信按钮
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--点击私信区域(目前referrer缺失,故通过拆解referrer_link的方式获得)
SELECT
partition_date
,
referrer
,
action
,
cl_id
FROM
(
SELECT
partition_date
,
cl_id
,
action
,
t2
.
referrer
as
referrer
,
row_number
()
over
(
PARTITION
BY
t1
.
referrer_link
,
t1
.
cl_id
ORDER
BY
t2
.
link_id
desc
)
as
rank
from
(
SELECT
partition_date
,
params
[
'referrer_link'
]
as
referrer_link
,
cl_id
,
action
,
json_split
(
params
[
'referrer_link'
],
'string'
)
as
a
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
)
t1
lateral
view
posexplode
(
a
)
t2
as
link_id
,
referrer
)
t3
where
rank
=
1
)
t1
JOIN
(
SELECT
partition_date
,
device_id
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
FROM
online
.
ml_device_day_active_status
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
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'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
)
mas
ON
t1
.
cl_id
=
mas
.
device_id
AND
t1
.
partition_date
=
mas
.
partition_date
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
t1
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T3
ON
T1
.
partition_date
=
T3
.
partition_date
and
T1
.
device_type
=
T3
.
device_type
AND
T1
.
active_type
=
T3
.
active_type
AND
T1
.
channel
=
T3
.
channel
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment