This commit is contained in:
root 2019-09-03 11:25:25 +08:00
parent 40025960f1
commit eac65b22ec

View File

@ -3,7 +3,7 @@ from ops.plog import define_logger
import logging
import datetime
from ops.mmysql import MysqlBase
import pdb
define_logger("/data/logs/init_first_ad_channel.log")
log = logging.getLogger(__name__)
@ -30,7 +30,7 @@ def get_last_time(gameid, channelid, ad_channel):
last_time = data[0][0]
except Exception:
log.info("get last time form db failed!", exc_info=True)
last_time = "2019-08-30 00:00:00"
last_time = "2019-09-02 11:00:00"
return last_time
@ -43,8 +43,8 @@ def comp_datetime(x, y):
return False
def gather_data(times):
print(f"start via {times}")
def gather_data(last_time, gameid, channelid, ad_channel):
print(f"start via {last_time}")
def run(gameid, channelid, ad_channel):
@ -53,7 +53,7 @@ def run(gameid, channelid, ad_channel):
while comp_datetime(now, last_time):
print(f"lasttime={last_time}")
gather_data(last_time, gameid, channelid, ad_channel)
last_time = (last_time - datetime.timedelta(minutes=TimeDelay)).strftime("%Y-%m-%d %H:%M:%S")
last_time = (datetime.datetime.strptime(last_time, "%Y-%m-%d %H:%M:%S") + datetime.timedelta(minutes=TimeDelay)).strftime("%Y-%m-%d %H:%M:%S")
def main():