|
@@ -98,35 +98,48 @@ class OrderInfoNobody(BaseHandler):
|
|
|
game_str = "'" + "','".join(game) + "'"
|
|
|
op2 = f" and name in ({game_str}) "
|
|
|
|
|
|
+ limit_start = (page - 1) * page_size
|
|
|
sql = f'''
|
|
|
- select DATE_FORMAT(dt,"%Y-%m-%d") dt,name game,
|
|
|
- sum(if(agent='自然流量',sum_amount,0)) as 'nobody_order',
|
|
|
- sum(if(agent='买量流量',sum_amount,0)) as 'body_order',
|
|
|
- sum(if(agent='当日总量',sum_amount,0)) as 'all_order'
|
|
|
+ select dt,name game,
|
|
|
+ sum(if(agent='自然流量',sum_amount,0)) as nobody_order,
|
|
|
+ sum(if(agent='买量流量',sum_amount,0)) as body_order,
|
|
|
+ sum(if(agent='当日总量',sum_amount,0)) as all_order
|
|
|
from
|
|
|
- (select sum(amount) sum_amount,date(FROM_UNIXTIME(a.create_time)) dt,
|
|
|
- b.name ,if(a.agent_id=0,'自然流量','买量流量') as agent
|
|
|
- from db_mp.h_pay a
|
|
|
- left join db_mp.h_game b on a.app_id = b.id
|
|
|
+ (select sum(amount) sum_amount,toDate(FROM_UNIXTIME(a.create_time)) dt,
|
|
|
+ b.name ,if(a.agent_id in ('sdk_one_0','sdk_two_0'),'自然流量','买量流量') as agent
|
|
|
+ from GameDataSum.h_pay_sum a
|
|
|
+ left join GameDataSum.h_game_sum b on a.app_id = b.id
|
|
|
where a.status = 2 {op}
|
|
|
- group by date(FROM_UNIXTIME(a.create_time)) ,b.name,
|
|
|
- if(a.agent_id=0,'自然流量','买量流量')
|
|
|
- union
|
|
|
- select sum(amount) sum_amount,date(FROM_UNIXTIME(a.create_time)) dt,
|
|
|
+ group by toDate(FROM_UNIXTIME(a.create_time)) ,b.name,
|
|
|
+ if(a.agent_id in ('sdk_one_0','sdk_two_0') ,'自然流量','买量流量')
|
|
|
+ union all
|
|
|
+ select sum(amount) sum_amount,toDate(FROM_UNIXTIME(a.create_time)) dt,
|
|
|
b.name ,'当日总量' as agent
|
|
|
- from db_mp.h_pay a
|
|
|
- left join db_mp.h_game b on a.app_id = b.id
|
|
|
+ from GameDataSum.h_pay_sum a
|
|
|
+ left join GameDataSum.h_game_sum b on a.app_id = b.id
|
|
|
where a.status = 2 {op}
|
|
|
- group by b.name ,date(FROM_UNIXTIME(a.create_time))) a
|
|
|
+ group by b.name ,toDate(FROM_UNIXTIME(a.create_time))) a
|
|
|
where 1=1 {op1} {op2}
|
|
|
group by dt,name
|
|
|
order by dt desc
|
|
|
+ limit {limit_start},{page_size}
|
|
|
+
|
|
|
'''
|
|
|
print(sql)
|
|
|
- sumsql = '''select 1;
|
|
|
- '''
|
|
|
- data, total, total_data = getLimitSumData(db.dm, sql, sumsql, page, page_size)
|
|
|
-
|
|
|
+ ck = CkUtils()
|
|
|
+
|
|
|
+ data_res = ck.execute(sql)
|
|
|
+ data_res_dict = []
|
|
|
+
|
|
|
+ for _ in data_res:
|
|
|
+ tmp_dict = {'dt': _[0].strftime('%Y-%m-%d'),
|
|
|
+ 'game': _[1],
|
|
|
+ 'nobody_order': float(_[2]),
|
|
|
+ 'body_order': float(_[3]),
|
|
|
+ 'all_order': float(_[4])
|
|
|
+ }
|
|
|
+ data_res_dict.append(tmp_dict)
|
|
|
+ data = data_res_dict
|
|
|
if args.get("download"):
|
|
|
self.write_download(str(int(time.time())), data)
|
|
|
else:
|