Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
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
黎涛
meta_base_code
Commits
f2ba94ec
Commit
f2ba94ec
authored
Sep 16, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
fd5d9132
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
user_behavior_path.py
new_user_analysis/user_behavior_path.py
+18
-18
No files found.
new_user_analysis/user_behavior_path.py
View file @
f2ba94ec
...
...
@@ -85,7 +85,6 @@ spark.sql("CREATE TEMPORARY FUNCTION json_map AS 'brickhouse.udf.json.JsonMapUDF
spark
.
sql
(
"CREATE TEMPORARY FUNCTION is_json AS 'com.gmei.hive.common.udf.UDFJsonFormatCheck'"
)
spark
.
sql
(
"CREATE TEMPORARY FUNCTION arrayMerge AS 'com.gmei.hive.common.udf.UDFArryMerge'"
)
task_list
=
[]
task_days
=
30
...
...
@@ -205,14 +204,14 @@ name_dict = {
"diary_card_click_vote"
:
"日记本卡片点赞或取消赞"
,
"diary_detail_bottom_click_same_service"
:
"日记贴详情页点击同类美购按钮"
,
"diary_detail_bottom_click_samediary_icon"
:
"日记本详情页_底栏_点击_同类日记按钮"
,
"diary_item_click_avatar"
:
"日记本卡片 -
点击作者头像"
,
"diary_item_click_banner"
:
"首页精选tab -
点击feed流banner"
,
"diary_item_click_comment"
:
"日记本卡片 -
点击评论按钮"
,
"diary_item_click_image"
:
"日记本卡片 -
点击图片"
,
"diary_item_click_vote"
:
"日记本卡片 -
点赞"
,
"diary_item_click_avatar"
:
"日记本卡片-
点击作者头像"
,
"diary_item_click_banner"
:
"首页精选tab-
点击feed流banner"
,
"diary_item_click_comment"
:
"日记本卡片-
点击评论按钮"
,
"diary_item_click_image"
:
"日记本卡片-
点击图片"
,
"diary_item_click_vote"
:
"日记本卡片-
点赞"
,
"diary_list_click_item"
:
"跳转到日记本详情页"
,
"diary_order_wow_click"
:
"订单评价弹窗_点击"
,
"diary_topic_image_click"
:
"日记贴创建页 -
点击已添加的图片"
,
"diary_topic_image_click"
:
"日记贴创建页-
点击已添加的图片"
,
"diarybook_detail_bottom_click_collect"
:
"日记详情页点击收藏按钮"
,
"diarybook_detail_click_add_diary"
:
"日记详情页点击更新日记按钮"
,
"diarybook_detail_click_adjust"
:
"日记详情页点击手术时间不准按钮"
,
...
...
@@ -241,7 +240,7 @@ name_dict = {
"diarybook_detail_click_service_block"
:
"日记详情页点击顶部美购卡片"
,
"diarybook_detail_click_service_related"
:
"日记详情页点击美购卡片"
,
"diarybook_detail_click_sort"
:
"日记详情页点击排序项按钮"
,
"diarybook_detail_click_tag_block"
:
"点击顶部
TAG区域"
,
"diarybook_detail_click_tag_block"
:
"点击顶部
TAG区域"
,
"diarybook_detail_click_topafter_picture"
:
"日记详情页点击顶部afte图"
,
"diarybook_detail_click_unfold_topic"
:
"日记详情页点击展开全文按钮"
,
"diarybook_detail_click_view_all_comments"
:
"日记详情页点击查看全部评论按钮"
,
...
...
@@ -433,7 +432,7 @@ name_dict = {
"on_click_tab"
:
"tab切换点击"
,
"on_click_top_card"
:
"跳转到问题详情页或者回答详情页"
,
"on_click_ugc_diary"
:
"搜索结果页(综合tab)-点击日记本卡片"
,
"on_click_ugc_diary_comment"
:
"日记本卡片 -
点击评论icon"
,
"on_click_ugc_diary_comment"
:
"日记本卡片-
点击评论icon"
,
"on_click_ugc_diary_follow"
:
"点击日记本关注按钮"
,
"on_click_ugc_diary_like"
:
"日记本卡片点赞"
,
"on_click_ugc_diary_more"
:
"点击查看更多按钮"
,
...
...
@@ -643,14 +642,14 @@ name_dict = {
"welfare_special_click_diary"
:
"美购专题页点击精选案例栏的日记本卡片"
,
"welfare_special_click_doctor_rank_item"
:
"美购专题页点击医生排行榜"
,
"welfare_special_click_expert"
:
"点击医生列表中的医生"
,
"welfare_special_click_more"
:
"点击外显美购专题的 banner 或 “查看更多”
按钮"
,
"welfare_special_click_more"
:
"点击外显美购专题的banner或“查看更多”
按钮"
,
"welfare_special_click_related_service"
:
"点击外显美购专题的美购"
,
"welfare_special_click_service"
:
"美购专题页点击美购卡片"
,
"welfare_special_click_service_rank_item"
:
"美购专题页点击排行榜中的美购卡片"
,
"welfare_special_click_storey_tab"
:
"美购专题页点击TAB按钮"
,
"welfare_special_click_storey_template"
:
"美购专题页点击图片"
,
"welfare_special_click_tab"
:
"美购专题页点击推荐内容栏中的卡片"
,
"welfare_special_click_tag"
:
"点击美购分组 tag
按钮"
,
"welfare_special_click_tag"
:
"点击美购分组tag
按钮"
,
"welfare_special_click_template"
:
"美购专题页点击固定模版"
,
"wiki_detail_click_adv"
:
"点击广告位"
,
"wiki_detail_click_benefits_item"
:
"百科详情页点击推荐美购卡片"
,
...
...
@@ -937,7 +936,7 @@ for t in range(1, task_days):
on t2.device_id=dev.device_id
WHERE spam_pv.device_id IS NULL
and dev.device_id is null
"""
.
format
(
today_str
=
today_str
,
yesterday_str_format
=
yesterday_str_format
,
today_str_format
=
today_str_format
)
"""
.
format
(
today_str
=
today_str
,
yesterday_str_format
=
yesterday_str_format
,
today_str_format
=
today_str_format
)
print
(
new_urser_device_id_sql
)
new_urser_device_id_df
=
spark
.
sql
(
new_urser_device_id_sql
)
...
...
@@ -945,10 +944,9 @@ WHERE spam_pv.device_id IS NULL
new_urser_device_id_df
.
show
(
1
)
sql_res
=
new_urser_device_id_df
.
collect
()
print
(
"-------------------------------"
)
for
count
,
res
in
enumerate
(
sql_res
):
print
(
count
,
res
)
for
count
,
res
in
enumerate
(
sql_res
):
print
(
count
,
res
)
res_dict
=
{}
maidian_sql
=
"""select t1.device_id,t2.track as track from
...
...
@@ -977,6 +975,7 @@ on t1.device_id = t2.cl_id""".format(partition_date=yesterday_str)
res_dict
[
one_key_word
]
=
1
print
(
res_dict
)
exception_list
=
(
"report_status"
,
"is_open_push"
)
for
action
in
res_dict
:
partition_date
=
yesterday_str
pid
=
hashlib
.
md5
((
partition_date
+
action
)
.
encode
(
"utf8"
))
.
hexdigest
()
...
...
@@ -984,9 +983,12 @@ on t1.device_id = t2.cl_id""".format(partition_date=yesterday_str)
action_ch
=
name_dict
.
get
(
action
)
if
not
action_ch
:
action_ch
=
action
if
action_ch
in
exception_list
:
continue
instert_sql
=
"""replace into new_user_click_count(
partition_day,pid,action_count,action_ch,action) VALUES('{partition_day}','{pid}',{action_count},'{action_ch}','{action}');"""
.
format
(
partition_date
=
partition_date
,
partition_day
=
yesterday_str
,
pid
=
pid
,
action_count
=
action_count
,
action_ch
=
action_ch
,
action
=
action
partition_date
=
partition_date
,
partition_day
=
yesterday_str
,
pid
=
pid
,
action_count
=
action_count
,
action_ch
=
action_ch
,
action
=
action
)
print
(
instert_sql
)
# cursor.execute("set names 'UTF8'")
...
...
@@ -998,5 +1000,3 @@ on t1.device_id = t2.cl_id""".format(partition_date=yesterday_str)
print
(
res
)
# cursor.executemany()
db
.
close
()
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