|
@@ -165,26 +165,6 @@ def mysql_insert_daily_qq(data):
|
|
print('insert_daily_qq defeat')
|
|
print('insert_daily_qq defeat')
|
|
|
|
|
|
|
|
|
|
-def send_waring_email():
|
|
|
|
- msg_Sender = '2091961210@qq.cm' # 发送方邮箱
|
|
|
|
- msg_code = 'ylltzynbshmufdeh' # 发送方邮箱的授权码
|
|
|
|
- msg_Receiver = '2091961210@qq.cm' # 收件人邮箱
|
|
|
|
-
|
|
|
|
- subject = "数据库未按时更新" # 主题
|
|
|
|
- content = "数据库未按时更新" # 正文
|
|
|
|
- msg = MIMEText(content, _charset="utf-8")
|
|
|
|
- msg['Subject'] = subject
|
|
|
|
- msg['From'] = msg_Sender
|
|
|
|
- msg['To'] = msg_Receiver
|
|
|
|
- try:
|
|
|
|
- s = smtplib.SMTP_SSL("smtp.qq.com", 465) # 邮件服务器及端口号
|
|
|
|
- s.login(msg_Sender, msg_code)
|
|
|
|
- s.sendmail(msg_Sender, msg_Receiver, msg.as_string())
|
|
|
|
- print("发送成功")
|
|
|
|
- except Exception as e:
|
|
|
|
- print("发送失败", e)
|
|
|
|
- finally:
|
|
|
|
- s.quit()
|
|
|
|
|
|
|
|
|
|
|
|
def start_cost_job():
|
|
def start_cost_job():
|
|
@@ -198,43 +178,17 @@ if __name__ == '__main__':
|
|
my_time = datetime.today().strftime('%Y-%m-%d')
|
|
my_time = datetime.today().strftime('%Y-%m-%d')
|
|
# my_time = '2020-11-24'
|
|
# my_time = '2020-11-24'
|
|
if sys.argv.__len__() == 2:
|
|
if sys.argv.__len__() == 2:
|
|
- if sys.argv[1]=='month':
|
|
|
|
- fday,lday=date_util.getLastMonthDay()
|
|
|
|
- i=0
|
|
|
|
- my_time = fday.strftime("'%Y-%m-%d'")
|
|
|
|
- while True:
|
|
|
|
- my_time=(fday+timedelta(days=i)).strftime("%Y-%m-%d")
|
|
|
|
- print(my_time)
|
|
|
|
- start_cost_job()
|
|
|
|
- if my_time==lday.strftime("%Y-%m-%d"):
|
|
|
|
- exit(0)
|
|
|
|
- else:
|
|
|
|
- i+=1
|
|
|
|
-
|
|
|
|
- else:
|
|
|
|
- i = 1
|
|
|
|
- while True:
|
|
|
|
- my_time = (datetime.today() - timedelta(days=i)).strftime('%Y-%m-%d')
|
|
|
|
- print("run[" + my_time + "]data")
|
|
|
|
- start_cost_job()
|
|
|
|
- i += 1
|
|
|
|
- if i==15:
|
|
|
|
- break
|
|
|
|
-
|
|
|
|
- # yestoday = (datetime.today() - timedelta(days=1)).strftime('%Y-%m-%d')
|
|
|
|
- # my_time = yestoday
|
|
|
|
- # print("跑昨天[" + yestoday + "]数据")
|
|
|
|
|
|
+ a = int(sys.argv[1])
|
|
|
|
+ i=1
|
|
|
|
+ while True:
|
|
|
|
+ my_time=(datetime.today()-timedelta(days=i)).strftime('%Y-%m-%d')
|
|
|
|
+ print("run["+my_time+"]data")
|
|
|
|
+ start_cost_job()
|
|
|
|
+ i+=1
|
|
|
|
+ if i==a:
|
|
|
|
+ break
|
|
|
|
|
|
start_cost_job()
|
|
start_cost_job()
|
|
|
|
|
|
- # run history data
|
|
|
|
- # i=1
|
|
|
|
- # while True:
|
|
|
|
- # my_time=(datetime.today()-timedelta(days=i)).strftime('%Y-%m-%d')
|
|
|
|
- # print("run["+my_time+"]data")
|
|
|
|
- # start_cost_job()
|
|
|
|
- # i+=1
|
|
|
|
- # if my_time=='2020-12-01':
|
|
|
|
- # break
|
|
|
|
|
|
|
|
|
|
|