|
@@ -511,3 +511,70 @@ class OrderH5Info(BaseHandler):
|
|
|
'''
|
|
|
data = db.dm.getData_json(sql)
|
|
|
return data
|
|
|
+
|
|
|
+
|
|
|
+class OrderH5InfoSpecial(BaseHandler):
|
|
|
+
|
|
|
+ def post(self):
|
|
|
+ if not self._au:
|
|
|
+ self.write_fail(msg='auth error')
|
|
|
+ else:
|
|
|
+ args = self.get_args()
|
|
|
+ user_id = args.get('user_id')
|
|
|
+
|
|
|
+ # role 表
|
|
|
+ start = args.get("start", self.thisday)
|
|
|
+ end = args.get("end")
|
|
|
+
|
|
|
+ data = []
|
|
|
+ if args.get("download"):
|
|
|
+ data = self.get_order_info_download(user_id, start, end)
|
|
|
+ self.write_download(str(int(time.time())), data)
|
|
|
+ else:
|
|
|
+ self.write_json(data=data)
|
|
|
+
|
|
|
+ def get_order_info_download(self, user_id, start, end):
|
|
|
+ if user_id not in super_auth():
|
|
|
+ return []
|
|
|
+
|
|
|
+ db = MysqlUtils()
|
|
|
+ op1 = f"and CONVERT(from_unixtime(a.create_time),char(10))>='{start}' " if start else ''
|
|
|
+ op2 = f"and CONVERT(from_unixtime(a.create_time),char(10))<='{end}' " if end else ''
|
|
|
+
|
|
|
+ sql = f'''
|
|
|
+ select row_number() over() as id,a.order_id ,h.pitcher,
|
|
|
+ if(a.agent_id =21,'客服渠道',if(a.agent_id=0,'自然流量',q.user_nicename)) as agent_name,
|
|
|
+ if(a.agent_id =21,'客服渠道',if(a.agent_id=0,'自然流量',c.wx_name)) as channel,
|
|
|
+ if(a.create_time is not null ,CONVERT(from_unixtime(a.create_time),char(20)),null) order_time,
|
|
|
+ if(d.create_time is not null,CONVERT(from_unixtime(d.create_time),char(20)),null) user_create_time,
|
|
|
+ e2.name as source_game,
|
|
|
+ d.id as mem_id,e.name as game ,a.amount ,a.real_amount ,g.server_name ,f.os as system_os,
|
|
|
+ CONVERT (g.role_name USING utf8) as role_name,a.payway ,a.status status ,a.mg_mem_id as user_id
|
|
|
+ from db_mp.h_pay a
|
|
|
+ left join
|
|
|
+ (select b.agent_id as agent_id,b.advertiser_conf_id from
|
|
|
+ (select agent_id,max(update_time) as update_time
|
|
|
+ from db_mp.mp_conf_agent mmc
|
|
|
+ group by agent_id ) a
|
|
|
+ left join db_mp.mp_conf_agent b on a.agent_id=b.agent_id
|
|
|
+ and a.update_time = b.update_time) b on a.agent_id =b.agent_id
|
|
|
+ left join db_mp.mp_mp_conf c on b.advertiser_conf_id = c.id
|
|
|
+ left join db_mp.h_member d on a.mem_id = d.id
|
|
|
+ left join db_mp.h_game e on a.app_id =e.id
|
|
|
+ left join db_mp.h_game e2 on d.app_id =e2.id
|
|
|
+ left join db_mp.h_pay_ext f on a.id = f.pay_id
|
|
|
+ left join db_mp.h_mg_role g
|
|
|
+ on g.role_id = f.role_id and g.server_id = f.server_id
|
|
|
+ and g.app_id = a.app_id and g.mg_mem_id =a.mg_mem_id
|
|
|
+ left join quchen_text.advertiser_vx h on c.wx_name = h.name
|
|
|
+ left join db_mp.h_user q on a.agent_id =q.id
|
|
|
+ where
|
|
|
+ a.app_id not in(6,13,23)
|
|
|
+ and a.agent_id =0
|
|
|
+ and d.app_id in(6,13,23)
|
|
|
+ {op1} {op2}
|
|
|
+ and a.status =2
|
|
|
+ '''
|
|
|
+
|
|
|
+ data = db.dm.getData_json(sql)
|
|
|
+ return data
|