|
@@ -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,
|