|
@@ -56,24 +56,23 @@ def get_pitcher_panel_channel(pitcher,channel,start,end,page,page_size,order_by,
|
|
|
|
|
|
def get_pitcher_panel_daily(pitcher, start, end, page, page_size, order_by, order):
|
|
|
sql=f"""
|
|
|
- select formatDateTime(dt,'%Y-%m-%d') date,pitcher,cost,first_order_amount,first_roi,
|
|
|
+ select formatDateTime(dt,'%Y-%m-%d') date,'{pitcher}' pitcher,cost,first_order_amount,first_roi,
|
|
|
order_amount,today_roi,total_amount,total_cost,total_amount-total_cost total_profit,
|
|
|
total_amount/total_cost total_roi from
|
|
|
- (select dt,pitcher,
|
|
|
+ (select dt,
|
|
|
round(sum(cost),2) cost,
|
|
|
round(sum(first_order_amount),2) first_order_amount,
|
|
|
round(if(cost=0,0,first_order_amount/cost),4) first_roi ,
|
|
|
round(sum(order_amount),2) order_amount,
|
|
|
- round(if(cost=0,0,sum(reg_order_amount)/cost),4) today_roi,
|
|
|
+ round(if(cost=0,0,sum(reg_order_amount)/cost),4) today_roi
|
|
|
from dw_daily_channel
|
|
|
where dt>='{start}' and dt<='{end}' and pitcher='{pitcher}'
|
|
|
group by dt) a
|
|
|
left outer join (
|
|
|
select dt,total_amount,total_cost from dw_daily_pitcher
|
|
|
-) b on a.dt=b.dt
|
|
|
-
|
|
|
+) b on a.dt=b.dt
|
|
|
"""
|
|
|
-
|
|
|
+ print(sql)
|
|
|
total = ck.execute(f"select count(1) from ({sql}) a")[0][0]
|
|
|
sql += f" order by {order_by} {order} limit {(page-1)*page_size},{page_size} "
|
|
|
print(sql)
|