|
@@ -106,7 +106,7 @@ class OrderInfoNobody(BaseHandler):
|
|
|
sum(if(agent='当日总量',sum_amount,0)) as all_order
|
|
|
from
|
|
|
(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
|
|
|
+ b.name ,if(a.agent_id in ('sdk_one_0','sdk_two_0','sdk_three_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}
|
|
@@ -227,12 +227,13 @@ class OrderInfo(BaseHandler):
|
|
|
op_base = f' and if( h.start_date is not null,d.create_time >= toUnixTimestamp(toDateTime(start_date)),1) '
|
|
|
|
|
|
# 限制为自己游戏的1.自然流量,2.客服流量
|
|
|
+
|
|
|
if agent_name and ('自然流量渠道' in agent_name or '客服渠道' in agent_name):
|
|
|
game_ids = get_auth_game_info(user_id)
|
|
|
print(game_ids)
|
|
|
op_game = ''
|
|
|
for game_id, game_name, game_timestamp in game_ids:
|
|
|
- op_game = op_game + f'''or (e.id = {game_id} and a.create_time >UNIX_TIMESTAMP('{game_timestamp}') ) '''
|
|
|
+ op_game = op_game + f'''or (e.id = {game_id} and a.create_time >{game_timestamp} ) '''
|
|
|
op_game = ' and ' + '(' + op_game[2:] + ')' + op_base
|
|
|
# 限制为自己公众号开始时候的数据
|
|
|
|
|
@@ -263,11 +264,11 @@ class OrderInfo(BaseHandler):
|
|
|
op12_user = ''
|
|
|
# 有自然流量和客服渠道时,其他渠道进行规避
|
|
|
if agent_name and '自然流量渠道' in agent_name and '客服渠道' in agent_name:
|
|
|
- op12_pay = f" and agent_id in (12,0) "
|
|
|
+ op12_pay = f" and agent_id in ('sdk_one_12','sdk_two_12','sdk_three_12','sdk_one_0','sdk_two_0','sdk_three_0') "
|
|
|
elif agent_name and '自然流量渠道' in agent_name:
|
|
|
- op12_pay = f" and agent_id=0 "
|
|
|
+ op12_pay = f" and agent_id in ('sdk_one_0','sdk_two_0','sdk_three_0') "
|
|
|
elif agent_name and '客服渠道' in agent_name:
|
|
|
- op12_pay = f" and agent_id=12 "
|
|
|
+ op12_pay = f" and agent_id in ('sdk_one_12','sdk_two_12','sdk_three_12') "
|
|
|
else:
|
|
|
op12_user = f''' where user_nicename in ({"'" + "','".join(agent_name) + "'"}) ''' if agent_name else ''
|
|
|
|
|
@@ -332,6 +333,7 @@ class OrderInfo(BaseHandler):
|
|
|
{op} {op1} {op5}
|
|
|
{op15}
|
|
|
"""
|
|
|
+
|
|
|
limit_start = (page - 1) * page_size
|
|
|
limit_sql = sql + '\n' + f''' limit {limit_start},{page_size} '''
|
|
|
print(limit_sql)
|
|
@@ -453,7 +455,7 @@ class OrderH5Info(BaseHandler):
|
|
|
(select toDate(FROM_UNIXTIME(a.create_time)) dt,a.app_id as app_id ,
|
|
|
min(b.name) as h5_game_name,
|
|
|
min(c.app_id) as c_app_id,d.name as channel_game_name,
|
|
|
- if(min(c.agent_id) in ('sdk_one_0','sdk_two_0'),1,0) as is_natural ,
|
|
|
+ if(min(c.agent_id) in ('sdk_one_0','sdk_two_0','sdk_three_0'),1,0) as is_natural ,
|
|
|
sum(amount) as sum_amount,count(DISTINCT(a.mem_id)) as human_counts
|
|
|
from (select * from GameDataSum.h_pay_sum where 1=1 {op1} {op2} ) a
|
|
|
LEFT join GameDataSum.h_game_sum b on a.app_id = b.id
|
|
@@ -465,7 +467,7 @@ class OrderH5Info(BaseHandler):
|
|
|
and c.id is not null
|
|
|
and a.status = 2
|
|
|
group by toDate(FROM_UNIXTIME(a.create_time)),a.app_id ,
|
|
|
- c.app_id ,d.name,if(c.agent_id in ('sdk_one_0','sdk_two_0'),1,0) ) as a
|
|
|
+ c.app_id ,d.name,if(c.agent_id in ('sdk_one_0','sdk_two_0','sdk_three_0'),1,0) ) as a
|
|
|
left join
|
|
|
(select toDate(FROM_UNIXTIME(a.create_time)) as dt,a.app_id ,
|
|
|
sum(a.amount) sum_amount,
|
|
@@ -573,7 +575,7 @@ class OrderH5Info(BaseHandler):
|
|
|
(select toDate(FROM_UNIXTIME(a.create_time)) dt,a.app_id as app_id ,
|
|
|
min(b.name) as h5_game_name,
|
|
|
min(c.app_id) as c_app_id,d.name as channel_game_name,
|
|
|
- if(min(c.agent_id) in ('sdk_one_0','sdk_two_0'),1,0) as is_natural ,
|
|
|
+ if(min(c.agent_id) in ('sdk_one_0','sdk_two_0','sdk_three_0'),1,0) as is_natural ,
|
|
|
sum(amount) as sum_amount,count(DISTINCT(a.mem_id)) as human_counts
|
|
|
from (select * from GameDataSum.h_pay_sum where 1=1 {op1} {op2} ) a
|
|
|
LEFT join GameDataSum.h_game_sum b on a.app_id = b.id
|
|
@@ -585,7 +587,7 @@ class OrderH5Info(BaseHandler):
|
|
|
and a.app_id != c.app_id
|
|
|
and a.status = 2
|
|
|
group by toDate(FROM_UNIXTIME(a.create_time)),a.app_id ,
|
|
|
- c.app_id ,d.name,if(c.agent_id in ('sdk_one_0','sdk_two_0'),1,0) ) as a
|
|
|
+ c.app_id ,d.name,if(c.agent_id in ('sdk_one_0','sdk_two_0','sdk_three_0'),1,0) ) as a
|
|
|
left join
|
|
|
(select toDate(FROM_UNIXTIME(a.create_time)) as dt,a.app_id ,
|
|
|
sum(a.amount) sum_amount,
|
|
@@ -664,10 +666,10 @@ class OrderH5InfoSpecial(BaseHandler):
|
|
|
|
|
|
sql = f'''
|
|
|
select a.order_id ,h.pitcher,
|
|
|
- if(a.agent_id in ('sdk_one_21','sdk_two_21'),
|
|
|
- '客服渠道',if(a.agent_id in ('sdk_one_0','sdk_two_0'),'自然流量',q.user_nicename)) as agent_name,
|
|
|
- if(a.agent_id in ('sdk_one_21','sdk_two_21'),
|
|
|
- '客服渠道',if(a.agent_id in ('sdk_one_0','sdk_two_0'),'自然流量',c.wx_name)) as channel,
|
|
|
+ if(a.agent_id in ('sdk_one_21','sdk_two_21','sdk_three_21'),
|
|
|
+ '客服渠道',if(a.agent_id in ('sdk_one_0','sdk_two_0','sdk_three_0'),'自然流量',q.user_nicename)) as agent_name,
|
|
|
+ if(a.agent_id in ('sdk_one_21','sdk_two_21','sdk_three_21'),
|
|
|
+ '客服渠道',if(a.agent_id in ('sdk_one_0','sdk_two_0','sdk_three_0'),'自然流量',c.wx_name)) as channel,
|
|
|
formatDateTime(FROM_UNIXTIME(a.create_time),'%Y-%m-%d %H:%M:%S') order_time,
|
|
|
formatDateTime(FROM_UNIXTIME(d.create_time),'%Y-%m-%d %H:%M:%S') user_create_time,
|
|
|
e2.name as source_game,
|
|
@@ -694,10 +696,12 @@ class OrderH5InfoSpecial(BaseHandler):
|
|
|
left join GameDataSum.h_user_sum q on a.agent_id =q.id
|
|
|
where
|
|
|
a.app_id not in('sdk_one_6','sdk_one_13','sdk_one_23',
|
|
|
- 'sdk_two_6','sdk_two_13','sdk_two_23')
|
|
|
- and a.agent_id in( 'sdk_two_0','sdk_one_0')
|
|
|
+ 'sdk_two_6','sdk_two_13','sdk_two_23',
|
|
|
+ 'sdk_three_6','sdk_three_13','sdk_three_23')
|
|
|
+ and a.agent_id in( 'sdk_two_0','sdk_one_0','sdk_three_0')
|
|
|
and d.app_id in('sdk_one_6','sdk_one_13','sdk_one_23',
|
|
|
- 'sdk_two_6','sdk_two_13','sdk_two_23')
|
|
|
+ 'sdk_two_6','sdk_two_13','sdk_two_23',
|
|
|
+ 'sdk_three_6','sdk_three_13','sdk_three_23')
|
|
|
and a.status =2
|
|
|
and d.id is not null and g.role_name is not null
|
|
|
'''
|