Sfoglia il codice sorgente

新增agentID 查询

cola 2 anni fa
parent
commit
b1f3d006a5
2 ha cambiato i file con 5 aggiunte e 3 eliminazioni
  1. 3 2
      data_manage/pitcher_panel.py
  2. 2 1
      handlers/PitcherPanelHandler.py

+ 3 - 2
data_manage/pitcher_panel.py

@@ -108,7 +108,7 @@ where 1=1 {op1}
     return db.dm.getData_json(sql)
 
 
-def get_channel_overview(user_id, channel, pitcher, stage, book, start, end, page, page_size, order_by, order):
+def get_channel_overview(user_id, channel, pitcher, stage, book,agentId, start, end, page, page_size, order_by, order):
     db = MysqlUtils()
     if user_id in super_auth():
         op = ''
@@ -127,6 +127,7 @@ def get_channel_overview(user_id, channel, pitcher, stage, book, start, end, pag
     op5 = f" order by {order_by} {order}" if order_by and order else ''
     op6 = f" and stage='{stage}'" if stage else ''
     op7 = f" and book='{book}'" if book else ''
+    op8 = f" and agent_id = '{agentId}'" if agentId else ''
 
     sql = f"""select channel,dt date,reg_num,
            round(if(reg_num=0,0,cost/reg_num),2) reg_per_cost,
@@ -169,7 +170,7 @@ def get_channel_overview(user_id, channel, pitcher, stage, book, start, end, pag
         round(reg_order_amount/reg_order_user,2) user_per_amount, 
         round(follow_user/click_count,4) click_follow_rate, 
         round(reg_order_user/follow_user,4) follow_order_rate 
-from dw_channel where 1=1 {op}  {op1} {op2} {op3} {op4} {op6} {op7} {op5} """
+from dw_channel where 1=1 {op}  {op1} {op2} {op3} {op4} {op6} {op7} {op8} {op5} """
 
     sumsql = f"""select '总计' date,
     sum(reg_num) reg_num,

+ 2 - 1
handlers/PitcherPanelHandler.py

@@ -77,10 +77,11 @@ class ChannelOverview(BaseHandler):
             stage = args.get("stage")
             page = args.get("page")
             book = args.get('book')
+            agentId=args.get('agentId')
             page_size = args.get("page_size")
             order_by = args.get("order_by", 'date')
             order = args.get("order", 'desc')
-            data, total, total_data = get_channel_overview(user_id, channel, pitcher, stage, book, start, end, page,
+            data, total, total_data = get_channel_overview(user_id, channel, pitcher, stage, book,agentId, start, end, page,
                                                            page_size, order_by, order)
             if args.get("download"):
                 self.write_download(str(int(time.time())), data)