|
@@ -726,31 +726,11 @@ def get_channel_summary(channel,pitcher,page,page_size,order_by,order,state,loca
|
|
|
|
|
|
op3=f" and channel='{channel}'" if channel else ''
|
|
op3=f" and channel='{channel}'" if channel else ''
|
|
op4=f" and location='{location}' " if location else ''
|
|
op4=f" and location='{location}' " if location else ''
|
|
- op5=f" having state='{state}'" if state else ''
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- sql = f"""SELECT channel,
|
|
|
|
- if(end>date_sub(now(),interval 10 day),'在投','停投') state,
|
|
|
|
- location,start,end,total_cost,total_amount,
|
|
|
|
- total_amount-total_cost profit,
|
|
|
|
- total_amount/total_cost roi,
|
|
|
|
- follow_user,
|
|
|
|
- total_cost/follow_user follow_per_cost,
|
|
|
|
- order_user,
|
|
|
|
- order_user/follow_user order_tran_rate,
|
|
|
|
- total_cost/order_user order_tran_cost,
|
|
|
|
- pitcher,stage
|
|
|
|
- FROM
|
|
|
|
- (select
|
|
|
|
- channel,pitcher,stage,
|
|
|
|
- case when type ='vx' then 'MP' when type ='qq' then 'GDT' end location,
|
|
|
|
- min(if(cost>0,dt,null)) start,
|
|
|
|
- max(if(cost>0,dt,null)) end,
|
|
|
|
- sum(cost) total_cost,
|
|
|
|
- sum(order_amount) total_amount,
|
|
|
|
- sum(follow_user) follow_user,
|
|
|
|
- sum(reg_order_user) order_user
|
|
|
|
- from dw_channel_daily where 1=1 {op1} {op2} {op3} {op4} GROUP BY channel,type,pitcher,stage) a {op5} ORDER BY {order_by} {order}
|
|
|
|
|
|
+ op5=f" and state='{state}'" if state else ''
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ sql = f"""SELECT *
|
|
|
|
+ from dm_channel_summary where 1=1 {op1} {op2} {op3} {op4} {op5} ORDER BY {order_by} {order}
|
|
"""
|
|
"""
|
|
print(sql)
|
|
print(sql)
|
|
return getLimitData(db.quchen_text,sql,page,page_size)
|
|
return getLimitData(db.quchen_text,sql,page,page_size)
|