This commit is contained in:
pengtao 2019-09-03 15:42:07 +08:00
parent 945abb54f6
commit ef55a1cc1d

View File

@ -55,20 +55,22 @@ class InitFirstAD():
begin = self.get_last_times(ad_channel)
users = self.get_new_user(begin,ad_channel)
mark_users = self.hide_user(users)
print(f"get {users} with {ad_channel} ")
if users:
mark_users = self.hide_user(users)
log.info(f"get users {len(users)},write {len(mark_users)} to mysql!")
table_name = "newuser"
if mark_users:
for line in mark_users:
try:
temp = {}
temp['gameid'] = self.gameid
temp['channelid'] = self.channelid
temp['accountid'], temp['register_time'], temp['ad_channel'] = line
self.mysql.insert(table_name, temp)
except Exception:
log.error(f"insert {line} to mysql Failed !", exc_info=True)
log.info(f"get users {len(users)},write {len(mark_users)} to mysql!")
table_name = "newuser"
if mark_users:
for line in mark_users:
try:
temp = {}
temp['gameid'] = self.gameid
temp['channelid'] = self.channelid
temp['accountid'], temp['register_time'], temp['ad_channel'] = line
self.mysql.insert(table_name, temp)
except Exception:
log.error(f"insert {line} to mysql Failed !", exc_info=True)
def get_last_times(self, ad_channel):
sql = f"""SELECT register_time FROM newuser where ad_channel={ad_channel} AND gameid={self.gameid} AND