|
@@ -3,7 +3,7 @@ import time
|
|
|
from model.DataBaseUtils import *
|
|
|
from model.CommonUtils import *
|
|
|
from model import UserAuthUtils
|
|
|
-from model.UserAuthUtils import super_auth
|
|
|
+from model.UserAuthUtils import super_auth, get_auth_game_info
|
|
|
from model.DateUtils import DateUtils
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
@@ -130,11 +130,16 @@ class OrderInfo(BaseHandler):
|
|
|
op_game = ''
|
|
|
else:
|
|
|
op_game = ''
|
|
|
- op_base = f' and j.game_name is not null and d.create_time >= j.create_time '
|
|
|
+ op_base = f' and if( h.start_date is not null,d.create_time >= UNIX_TIMESTAMP( h.start_date),1) '
|
|
|
|
|
|
|
|
|
if agent_name and ('自然流量渠道' in agent_name or '客服渠道' in agent_name):
|
|
|
- op_game = '' + op_base
|
|
|
+ game_ids = get_auth_game_info(user_id)
|
|
|
+ print(game_ids)
|
|
|
+ op_game = ''
|
|
|
+ for game_id, 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 = ' and ' + '(' + op_game[2:] + ')' + op_base
|
|
|
|
|
|
|
|
|
if len(UserAuthUtils.get_auth_channel(user_id)) == 0:
|
|
@@ -160,7 +165,7 @@ class OrderInfo(BaseHandler):
|
|
|
op10 = f" and a.status={status} " if status else ''
|
|
|
op11 = f" and e.name='{game}'" if game else ''
|
|
|
|
|
|
-
|
|
|
+
|
|
|
if agent_name and '自然流量渠道' in agent_name and '客服渠道' in agent_name:
|
|
|
op12 = f" and a.agent_id in (12,0) "
|
|
|
elif agent_name and '自然流量渠道' in agent_name:
|
|
@@ -207,16 +212,8 @@ class OrderInfo(BaseHandler):
|
|
|
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 quchen_text.advertiser_vx h on c.wx_name = h.name
|
|
|
left join db_mp.h_user q on a.agent_id =q.id
|
|
|
- left join (
|
|
|
- SELECT a.pitcher as pitcher ,a.name as channel ,
|
|
|
- d.name as game_name, UNIX_TIMESTAMP(a.start_date) as create_time
|
|
|
- FROM quchen_text.advertiser_vx a
|
|
|
- left join db_mp.mp_mp_conf b on a.name =b.wx_name
|
|
|
- left join db_mp.mp_conf_agent c on c.advertiser_conf_id = b.id
|
|
|
- left join db_mp.h_game d on c.app_id = d.id
|
|
|
- ) j on e.name = j.game_name
|
|
|
|
|
|
|
|
|
where 1=1 {op} {op1} {op2} {op3} {op4} {op5}
|
|
@@ -237,3 +234,14 @@ class OrderInfo(BaseHandler):
|
|
|
|
|
|
print(len(data))
|
|
|
return data, total, total_data
|
|
|
+
|
|
|
+ def get_game_pitcher(self, user_id):
|
|
|
+ sql = '''
|
|
|
+ SELECT d.name as game_name,d.id
|
|
|
+ FROM quchen_text.advertiser_vx a
|
|
|
+ left join db_mp.mp_mp_conf b on a.name =b.wx_name
|
|
|
+ left join db_mp.mp_conf_agent c on c.advertiser_conf_id = b.id
|
|
|
+ left join db_mp.h_game d on c.app_id = d.id
|
|
|
+ where pitcher ='金康'
|
|
|
+ group by id
|
|
|
+ '''
|