fix bug
This commit is contained in:
parent
125570b1a1
commit
2bfda5aeb4
@ -31,9 +31,15 @@ class InitFirstAD():
|
|||||||
self.hide = 0.8
|
self.hide = 0.8
|
||||||
self.tga.init_tga_write(self.tgaid)
|
self.tga.init_tga_write(self.tgaid)
|
||||||
|
|
||||||
|
def get_ad_channel(self):
|
||||||
|
sql =f"""select distinct ad_c"""
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
begin = self.get_last_times()
|
ad_channels = self.get_ad_channel()
|
||||||
users = self.get_new_user(begin)
|
for ad_channel in ad_channels:
|
||||||
|
|
||||||
|
begin = self.get_last_times(ad_channel)
|
||||||
|
users = self.get_new_user(begin,ad_channel)
|
||||||
mark_users = self.hide_user(users)
|
mark_users = self.hide_user(users)
|
||||||
|
|
||||||
log.info(f"get users {len(users)},write {len(mark_users)} to mysql!")
|
log.info(f"get users {len(users)},write {len(mark_users)} to mysql!")
|
||||||
@ -49,8 +55,13 @@ class InitFirstAD():
|
|||||||
except Exception:
|
except Exception:
|
||||||
log.error(f"insert {line} to mysql Failed !", exc_info=True)
|
log.error(f"insert {line} to mysql Failed !", exc_info=True)
|
||||||
|
|
||||||
def get_last_times(self):
|
def get_last_times(self, ad_channel):
|
||||||
sql = f"""SELECT create_time FROM newuser ORDER BY create_time DESC LIMIT 1;"""
|
sql = f"""SELECT register_time FROM newuser where ad_channel={ad_channel} AND gameid={self.gameid} AND
|
||||||
|
channelid={self.channelid}
|
||||||
|
ORDER BY
|
||||||
|
register_time
|
||||||
|
DESC
|
||||||
|
LIMIT 1;"""
|
||||||
data = self.mysql.query(sql)
|
data = self.mysql.query(sql)
|
||||||
try:
|
try:
|
||||||
last_time = data[0][0]
|
last_time = data[0][0]
|
||||||
@ -70,7 +81,7 @@ class InitFirstAD():
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def get_new_user(self, begin):
|
def get_new_user(self, begin,ad_channel):
|
||||||
rdata = []
|
rdata = []
|
||||||
sql = f"""SELECT
|
sql = f"""SELECT
|
||||||
"#account_id",
|
"#account_id",
|
||||||
@ -80,6 +91,7 @@ class InitFirstAD():
|
|||||||
v_user_{self.suffix}
|
v_user_{self.suffix}
|
||||||
where
|
where
|
||||||
gameid='{self.gameid}'
|
gameid='{self.gameid}'
|
||||||
|
AND first_ad_channel='{ad_channel}'
|
||||||
AND "account_register_time" BETWEEN timestamp'{begin}' AND timestamp'{self.now}' """
|
AND "account_register_time" BETWEEN timestamp'{begin}' AND timestamp'{self.now}' """
|
||||||
data = self.tga.get_data(sql)
|
data = self.tga.get_data(sql)
|
||||||
if data:
|
if data:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user