|
@@ -755,10 +755,7 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
round(d7/cost,4) roi7,
|
|
round(d7/cost,4) roi7,
|
|
d30 reg_amount30,
|
|
d30 reg_amount30,
|
|
round(d30/cost,4) roi30,
|
|
round(d30/cost,4) roi30,
|
|
- total_cost cost_total,
|
|
|
|
- total_amount amount_total,
|
|
|
|
- total_amount-total_cost profit_total,
|
|
|
|
- round(total_amount/total_cost,4) roi_total,
|
|
|
|
|
|
+ reg_amount-cost profit,
|
|
CONCAT(d1,",",0,',',round(d1/cost,4)) d1,
|
|
CONCAT(d1,",",0,',',round(d1/cost,4)) d1,
|
|
CONCAT(d2-d1,",",round((d2-d1)/cost,4),',',round(d2/cost,4)) d2,
|
|
CONCAT(d2-d1,",",round((d2-d1)/cost,4),',',round(d2/cost,4)) d2,
|
|
CONCAT(d3-d2,",",round((d3-d2)/cost,4),',',round(d3/cost,4)) d3,
|
|
CONCAT(d3-d2,",",round((d3-d2)/cost,4),',',round(d3/cost,4)) d3,
|
|
@@ -795,6 +792,7 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
sumSql=f"""select '总计' dt,sum(cost) cost,
|
|
sumSql=f"""select '总计' dt,sum(cost) cost,
|
|
sum(reg_amount) reg_amount,
|
|
sum(reg_amount) reg_amount,
|
|
round(sum(reg_amount)/sum(cost),4) roi,
|
|
round(sum(reg_amount)/sum(cost),4) roi,
|
|
|
|
+ sum(profit) profit,
|
|
round(sum(d7)/sum(cost),4) roi7,
|
|
round(sum(d7)/sum(cost),4) roi7,
|
|
sum(reg_amount30) reg_amount30,
|
|
sum(reg_amount30) reg_amount30,
|
|
round(sum(d30)/sum(cost),4) roi30
|
|
round(sum(d30)/sum(cost),4) roi30
|
|
@@ -802,7 +800,7 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
"""
|
|
"""
|
|
|
|
|
|
data,total=getLimitSumData(db.quchen_text,sql,sumSql,page,page_size)
|
|
data,total=getLimitSumData(db.quchen_text,sql,sumSql,page,page_size)
|
|
-
|
|
|
|
|
|
+ print(data)
|
|
def parse(str):
|
|
def parse(str):
|
|
li=str.split(',')
|
|
li=str.split(',')
|
|
li[0]=round(float(li[0]),2)
|
|
li[0]=round(float(li[0]),2)
|
|
@@ -814,7 +812,7 @@ def get_pitcher_trend(pitcher,start=None,end=None,page=None,page_size=None,order
|
|
for k,v in i.items():
|
|
for k,v in i.items():
|
|
if k in ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10',
|
|
if k in ['d1','d2','d3','d4','d5','d6','d7','d8','d9','d10',
|
|
'd11','d12','d13','d14','d15','d16','d17','d18','d19','d20','d21','d22','d23','d24','d25','d26','d27','d28','d29','d30']:
|
|
'd11','d12','d13','d14','d15','d16','d17','d18','d19','d20','d21','d22','d23','d24','d25','d26','d27','d28','d29','d30']:
|
|
- i[k]= parse(v)
|
|
|
|
|
|
+ i[k]= parse(v) if i["cost"]!=0 else {}
|
|
|
|
|
|
return data,total
|
|
return data,total
|
|
|
|
|