|
@@ -417,17 +417,19 @@ def image_rank(start, end, type,book, page, page_size, order_by, order):
|
|
|
|
|
|
|
|
|
|
"""广告排行榜"""
|
|
"""广告排行榜"""
|
|
-def advertisement_rank(start,end,type,page,page_size,order,order_by,book):
|
|
|
|
-
|
|
|
|
|
|
+def advertisement_rank(user_id,start,end,type,page,page_size,order,order_by,book,channel,pitcher):
|
|
|
|
+ op1 = f" and pitcher in {str(tuple([i['nick_name'] for i in get_pitcher({'user_id': user_id})] + [get_user_name_by_id(user_id)]))}"
|
|
op2=f" and dt>='{start}' " if start else ''
|
|
op2=f" and dt>='{start}' " if start else ''
|
|
op3=f" and dt<='{end}' " if end 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 ''
|
|
op8=f" and type='{type}'" if type else ''
|
|
op8=f" and type='{type}'" if type else ''
|
|
op9=f" order by {order_by} {order}" if order_by and order else ''
|
|
op9=f" order by {order_by} {order}" if order_by and order else ''
|
|
op10=f" and book='{book}'" if book else ''
|
|
op10=f" and book='{book}'" if book else ''
|
|
db =MysqlUtils().dm
|
|
db =MysqlUtils().dm
|
|
|
|
|
|
sql=f"""select
|
|
sql=f"""select
|
|
- dt,stage,platform,book,`type`, cost,
|
|
|
|
|
|
+ dt,stage,platform,book,`type`, cost,channel,pitcher,
|
|
view_count,
|
|
view_count,
|
|
click_count,
|
|
click_count,
|
|
follow_count,
|
|
follow_count,
|
|
@@ -445,7 +447,7 @@ def advertisement_rank(start,end,type,page,page_size,order,order_by,book):
|
|
image_id,
|
|
image_id,
|
|
preview_url
|
|
preview_url
|
|
from dw_image_cost_day
|
|
from dw_image_cost_day
|
|
- where preview_url!='' {op2} {op3} {op8} {op10} {op9}
|
|
|
|
|
|
+ where preview_url!='' {op1} {op2} {op3} {op4} {op5} {op8} {op10} {op9}
|
|
"""
|
|
"""
|
|
sum_sql = f"""select '总计' as pitcher,
|
|
sum_sql = f"""select '总计' as pitcher,
|
|
sum(cost) cost,
|
|
sum(cost) cost,
|