cola 2 سال پیش
والد
کامیت
e685ceddec
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      data_manage/pitcher_panel.py

+ 8 - 6
data_manage/pitcher_panel.py

@@ -116,7 +116,7 @@ def get_agent_list(pitcher):
     return db.dm.getData_json(sql)
 
 
-def get_channel_overview(user_id, channel, pitcher, stage, book,agent_id, start, end, page, page_size, order_by, order):
+def get_channel_overview(user_id, channel, pitcher, type , stage, book,agent_id, start, end, page, page_size, order_by, order):
     db = MysqlUtils()
     if user_id in super_auth():
         op = ''
@@ -136,6 +136,7 @@ def get_channel_overview(user_id, channel, pitcher, stage, book,agent_id, start,
     op6 = f" and stage='{stage}'" if stage else ''
     op7 = f" and book='{book}'" if book else ''
     op8 = f" and agent_id = '{agent_id}'" if agent_id else ''
+    op9 = f" and type = '{type}' " if type else ''
 
     sql = f"""select a.channel,a.dt date,agent_name,reg_num,
            round(if(reg_num=0,0,cost/reg_num),2) reg_per_cost,
@@ -183,7 +184,7 @@ def get_channel_overview(user_id, channel, pitcher, stage, book,agent_id, start,
         round(reg_order_user/follow_user,4) follow_order_rate 
 from dw_channel a
 left join dw_channel_amount_daily b on a.dt=b.dt and a.channel=b.channel
- where 1=1 {op}  {op1} {op2} {op3} {op4} {op6} {op7} {op8} {op5} """
+ where 1=1 {op}  {op1} {op2} {op3} {op4} {op6} {op7} {op8} {op9} {op5} """
 
     sumsql = f"""select '总计' date,
     sum(reg_num) reg_num,
@@ -493,7 +494,7 @@ left join dw_channel_user_daily b using(dt,channel) {op5}
     return data, total
 
 
-def get_channel_order_trend(user_id, channel, pitcher,agent_id, start, end, page, page_size, order_by, order):
+def get_channel_order_trend(user_id, channel, game, pitcher,agent_id, start, end, page, page_size, order_by, order):
     db = MysqlUtils()
     if user_id in super_auth():
         op = ''
@@ -518,7 +519,8 @@ def get_channel_order_trend(user_id, channel, pitcher,agent_id, start, end, page
     op3 = f" and dt>='{start}' " if start else ''
     op4 = f" and dt<='{end}' " if end else ''
     op5 = f" order by {order_by} {order}" if order_by and order else ''
-    op6 = f" and agent_id = '{agent_id}' " if agent_id else ""
+    op6 = f" and agent_id = '{agent_id}' " if agent_id else ''
+    op7 = f" and book = '{game}' " if game else ''
 
     base_sql_multi_channel = f'''
             (select a.dt,a.agent_name agent_name,a.create_user_num,sum(a.reg_num) reg_num ,group_concat(a.channel) channel ,group_concat(a.pitcher ) pitcher ,
@@ -610,7 +612,7 @@ def get_channel_order_trend(user_id, channel, pitcher,agent_id, start, end, page
         group_concat(annual_mult) as annual_mult
         from 
          ( select * from  dw_channel where cost+reg_order_amount>0
-         {op} {op1} {op2} {op3} {op4}  {op6} ) a
+         {op} {op1} {op2} {op3} {op4}  {op6} {op7}) a
             left join  dw_channel_amount_daily b on a.channel=b.channel 
             and a.dt=b.dt 
             left join src_book_info c on a.dt=c.dt and a.book=c.book
@@ -619,7 +621,7 @@ def get_channel_order_trend(user_id, channel, pitcher,agent_id, start, end, page
         '''
 
     base_sql_singel_channel = f'''
-        ( select * from  dw_channel where cost+reg_order_amount>0  {op} {op1} {op2} {op3} {op4} {op6} ) a
+        ( select * from  dw_channel where cost+reg_order_amount>0  {op} {op1} {op2} {op3} {op4} {op6} {op7}) a
         left join  dw_channel_amount_daily b on a.channel=b.channel and a.dt=b.dt 
         left join src_book_info c on a.dt=c.dt and a.book=c.book  and a.type=c.type and a.platform=c.platform
         '''