Explorar o código

Merge branch 'dev'

ck %!s(int64=4) %!d(string=hai) anos
pai
achega
da7261b063
Modificáronse 2 ficheiros con 7 adicións e 16 borrados
  1. 6 10
      data_manage/public_analysis.py
  2. 1 6
      handlers/PublicAnalysisHandler.py

+ 6 - 10
data_manage/public_analysis.py

@@ -413,25 +413,21 @@ def image_rank(start, end, type,book, page, page_size, order_by, order):
 
 
 """广告排行榜"""
-def advertisement_rank(start,end,ad_id,channel,pitcher,stage,site,type,page,page_size,order,order_by,book):
-    op1=f" and ad_id='{ad_id}' " if ad_id else ''
+def advertisement_rank(start,end,type,page,page_size,order,order_by,book):
+
     op2=f" and dt>='{start}' " if start else ''
     op3=f" and dt<='{end}' " if end else ''
-    op4=f" and channel='{channel}' " if channel else ''
-    op5=f" and pitcher='{pitcher}' " if pitcher else ''
-    op6=f" and stage='{stage}'" if stage else ''
-    op7=f" and site='{site}'" if site else ''
     op8=f" and type='{type}'" if type else ''
     op9=f" order by {order_by} {order}" if order_by and order else ''
     op10=f" and book='{book}'" if book else ''
     db =MysqlUtils().dm
 
     sql=f"""select 
-    dt,channel,pitcher,stage,platform,book,ad_name,ad_id,`type`,site, cost,
+    dt,stage,platform,book,`type`, cost,
     view_count,
     click_count,
     follow_count,
-    round((cost/view_count)*1000,4) cpm, 
+    round((cost/view_count)*1000,2) cpm, 
     round(click_count/view_count,4) ctr,
     round(cost/click_count,2) cpc,
     order_count,
@@ -444,8 +440,8 @@ def advertisement_rank(start,end,ad_id,channel,pitcher,stage,site,type,page,page
     description,
     image_id,
     preview_url
-    from dw_ad_day
-    where 1=1 {op1} {op2} {op3} {op4} {op5} {op6} {op7} {op8} {op10} {op9}  
+    from dw_image_cost_day
+    where preview_url!=''  {op2} {op3} {op8} {op10} {op9}  
     """
     sum_sql = f"""select '总计' as pitcher,
                       sum(cost) cost,

+ 1 - 6
handlers/PublicAnalysisHandler.py

@@ -164,16 +164,11 @@ class AdvertisementRank(BaseHandler):
             arg = self.get_args()
             start = arg.get("start",du.getNow())
             end = arg.get("end")
-            ad_id = arg.get("ad_id")
             page = arg.get("page",1)
             page_size = arg.get("page_size")
             order_by = arg.get("order_by", 'cost')
             order = arg.get("order", 'desc')
-            channel = arg.get("channel")
-            pitcher = arg.get("pitcher")
-            stage = arg.get("stage")
-            site =arg.get("site")
             type =arg.get("type")
             book =arg.get("book")
-            data, total,total_data = advertisement_rank(start, end, ad_id, channel, pitcher, stage,site,type,page,page_size,order,order_by,book)
+            data, total,total_data = advertisement_rank(start, end, type,page,page_size,order,order_by,book)
             self.write_json(data=data, total=total,total_data=total_data)