Browse Source

MOD:添加创角人数,注册人数

cxyu 3 years ago
parent
commit
09803dfc17
3 changed files with 11 additions and 4 deletions
  1. 7 3
      data_manage/pitcher_panel.py
  2. 3 0
      data_manage/public_analysis.py
  3. 1 1
      urls.py

+ 7 - 3
data_manage/pitcher_panel.py

@@ -128,7 +128,7 @@ def get_channel_overview(user_id, channel, pitcher, stage, book, start, end, pag
     op6 = f" and stage='{stage}'" if stage else ''
     op7 = f" and book='{book}'" if book else ''
 
-    sql = f"""select channel,dt date,
+    sql = f"""select channel,dt date,reg_num,create_user_num,
        view_count,click_count,
        round(if(view_count=0,0,click_count/view_count),4) click_rate,
        follow_user,
@@ -161,6 +161,8 @@ from dw_channel where 1=1 {op}  {op1} {op2} {op3} {op4} {op6} {op7} {op5} """
 
     print(sql)
     sumsql = f"""select '总计' date,
+    sum(reg_num) reg_num,
+    sum(create_user_num) create_user_num,
                 sum(view_count) view_count,
                 sum(click_count) click_count,
                 round(sum(click_count)/sum(view_count),4) click_rate,
@@ -476,7 +478,7 @@ def get_channel_order_trend(user_id, channel, pitcher, start, end, page, page_si
     op5 = f" order by {order_by} {order}" if order_by and order else ''
 
     base_sql_multi_channel = f'''
-            ( select a.dt,group_concat(a.channel) channel ,group_concat(a.pitcher ) pitcher ,
+            ( select a.dt,a.create_user_num,a.reg_num,group_concat(a.channel) channel ,group_concat(a.pitcher ) pitcher ,
         group_concat(a.stage ) stage ,group_concat(a.platform) platform ,
         group_concat(a.book) book, group_concat(a.type) type,sum(a.order_count ) order_count ,
         sum(a.order_user ) order_user ,sum(a.order_amount ) order_amount ,
@@ -572,7 +574,7 @@ def get_channel_order_trend(user_id, channel, pitcher, start, end, page, page_si
 
     sql = f"""select row_number() over() as id,
                 stage,pitcher,a.channel,a.dt date,a.book,cost,
-                a.type,
+                a.type,a.reg_num,a.create_user_num,
                 node/100 require_roi,round(100/node,2) require_mult,
                 round(first_order_amount*100/node-cost,2) expect_profit,
                 annual_mult,
@@ -661,6 +663,8 @@ def get_channel_order_trend(user_id, channel, pitcher, start, end, page, page_si
         """
 
     sumsql = f"""select concat(date_format(min(date),'%Y/%m/%d'),'~',date_format(max(date),'%Y/%m/%d')) date,
+               sum(create_user_num) create_user_num,
+               sum(reg_num) reg_num,
                sum(cost) cost,
                sum(reg_amount)  reg_amount,
                sum(first_amount)  first_amount,

+ 3 - 0
data_manage/public_analysis.py

@@ -61,6 +61,7 @@ reg_order_amount-cost profit,
 round(click_count/view_count,4) click_rate,
 round(follow_user/click_count,4) follow_rate,
 round(first_order_user/click_count,4) first_order_rate,
+reg_num,create_user_num,
 view_count,
 click_count,
 follow_user,
@@ -149,6 +150,8 @@ from book_trend where 1=1  {op1} {op2} {op4} {op5}  {op6}
 
     sum_sql = f"""select concat(date_format(min(dt),'%Y/%m/%d'),'~',date_format(max(dt),'%Y/%m/%d')) dt,
 sum(cost) cost,
+sum(reg_num) reg_num,
+sum(create_user_num) create_user_num,
 sum(first_order_amount) first_order_amount,
 sum(reg_order_amount) reg_order_amount,
 round(sum(first_order_amount)/sum(cost),4) first_roi,

+ 1 - 1
urls.py

@@ -72,7 +72,7 @@ urls = [
     # (r'/data/advertisement/database/collects', AdvertisementRank),
 
     # CRUD
-    (r'/operate/channel_group.*', OperateHandler.ChannelGroupHandler),  # 公众号分组设置
+    # (r'/operate/channel_group.*', OperateHandler.ChannelGroupHandler),  # 公众号分组设置
 
     # 自助分析
     (r'/data/analysis.*', AnalysisHandler.ChannelAnalysisHandler),