Commit 7389bd28 authored by 张彦钊's avatar 张彦钊

change

parent 27c0ccc8
......@@ -16,7 +16,7 @@ def all_click(x):
print("美购搜索点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'search_result_welfare_click_item' "
"and app['version'] in ('7.15.0','7.14.0')"
"and app['version'] >='7.14.0'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
total.append(tmp)
sum = sum + tmp
......@@ -24,7 +24,7 @@ def all_click(x):
print("美购首页相关推荐")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'goto_welfare_detail' "
"and app['version'] in ('7.15.0','7.14.0') and params['from'] = 'welfare_home_list_item'"
"and app['version'] >='7.14.0' and params['from'] = 'welfare_home_list_item'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
total.append(tmp)
sum = sum + tmp
......@@ -32,7 +32,7 @@ def all_click(x):
home_page_sum = 0
print("首页点击'全部'icon按钮进入的列表-美购卡片点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '6'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
home_page_sum = home_page_sum + tmp
......@@ -40,7 +40,7 @@ def all_click(x):
print("首页点击icon进入的列表-美购卡片点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'goto_welfare_detail' "
"and app['version'] in ('7.15.0','7.14.0') "
"and app['version'] >='7.14.0' "
"and params['from'] = 'category' and params['cpc_referer'] = '19'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
home_page_sum = home_page_sum + tmp
......@@ -50,14 +50,14 @@ def all_click(x):
meigou_homepage_sum = 0
print("美购首页'全部'点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '21'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
meigou_homepage_sum = meigou_homepage_sum + tmp
print("美购首页icon美购点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '18'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
meigou_homepage_sum = meigou_homepage_sum + tmp
......@@ -78,7 +78,7 @@ def cpc_click(x):
print("美购搜索点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'search_result_welfare_click_item' "
"and app['version'] in ('7.15.0','7.14.0') and params['is_cpc'] = '1'"
"and app['version'] >='7.14.0' and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
total.append(tmp)
sum = sum + tmp
......@@ -86,7 +86,7 @@ def cpc_click(x):
print("美购首页相关推荐")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'goto_welfare_detail' "
"and app['version'] in ('7.15.0','7.14.0') and params['from'] = 'welfare_home_list_item' "
"and app['version'] >='7.14.0' and params['from'] = 'welfare_home_list_item' "
"and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
total.append(tmp)
......@@ -95,7 +95,7 @@ def cpc_click(x):
home_page_sum = 0
print("首页点击'全部'icon按钮进入的列表-美购卡片点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '6' "
"and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
......@@ -104,7 +104,7 @@ def cpc_click(x):
print("首页点击icon进入的列表-美购卡片点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates "
"where partition_date='{}'and action = 'goto_welfare_detail' "
"and app['version'] in ('7.15.0','7.14.0') "
"and app['version'] >='7.14.0' "
"and params['from'] = 'category' and params['cpc_referer'] = '19' "
"and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
......@@ -115,7 +115,7 @@ def cpc_click(x):
meigou_home_sum = 0
print("美购首页'全部'点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '21' "
"and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
......@@ -123,7 +123,7 @@ def cpc_click(x):
print("美购首页icon美购点击")
tmp = spark.sql("select count(*) from online.bl_hdfs_maidian_updates where partition_date='{}' "
"and action = 'goto_welfare_detail' and app['version'] in ('7.15.0','7.14.0') "
"and action = 'goto_welfare_detail' and app['version'] >='7.14.0' "
"and params['from'] = 'welfare_list' and params['cpc_referer'] = '18' "
"and params['is_cpc'] = '1'"
.format(date)).rdd.map(lambda x: x[0]).collect()[0]
......@@ -159,9 +159,10 @@ if __name__ == '__main__':
df = pd.DataFrame(all_list)
df = df.rename(columns={0:"日期",1: "搜索点击", 2: "相关推荐",3:"首页icon",4:"美购首页icon",5: "总点击",
6: "搜索点击cpc", 7: "相关推荐cpc",8:"首页icon_cpc",9:"美购首页icon_cpc",
10:"cpc总点击"})
df = df.rename(columns={0: "date",1: "search", 2: "xiangguan",3:"home",4:"service_home",
5: "all_clcik",
6: "cpc_search", 7: "cpc_xiangguan",8:"cpc_home",9:"cpc_service_home",
10:"cpc_all"})
df.to_csv('/home/gmuser/cpc.csv', index=False)
spark.stop()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment