This commit is contained in:
aozhiwei 2020-04-30 11:57:24 +08:00
parent 2843a2b477
commit 00818ecfea

View File

@ -48,6 +48,25 @@ def sendNotify(conf, sendtime):
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + sendtime,
lambda : sendNotify(conf, sendtime))
def sendOrderNotify(conf, sendtime):
try:
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%s"), flush=True)
print('sendOrderNotify start', flush=True)
params = {'key' : 'kingsome'}
secret = 'fc38349c5d084e920925e614c420be9f'
timestamp = time.time()
md5signstr = md5Sign(params, secret, timestamp)
url = conf['subscribe_notify_url'] + '&timestamp=' + str(timestamp) + '&sign=' + md5signstr
req = urllib.request.Request(url)
data = urllib.request.urlopen(req).read()
print('sendOrderNotify end', flush=True)
except Exception as e:
print('sendOrderNotify error: ' + str(e), flush=True)
#进入下一次循环
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + sendtime,
lambda : sendOrderNotify(conf, sendtime))
class SelfCheckingHandler(tornado.web.RequestHandler):
def get(self):
@ -76,4 +95,17 @@ if __name__ == "__main__":
lambda : sendNotify(conf, conf['sendtime2']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['sendtime3'],
lambda : sendNotify(conf, conf['sendtime3']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['signtime'],
lambda : sendOrderNotify(conf, conf['signtime']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['boxtime'],
lambda : sendOrderNotify(conf, conf['boxtime']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['diamondtime1'],
lambda : sendOrderNotify(conf, conf['diamondtime1']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['diamondtime2'],
lambda : sendOrderNotify(conf, conf['diamondtime2']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['diamondtime3'],
lambda : sendOrderNotify(conf, conf['diamondtime3']))
tornado.ioloop.IOLoop.current().call_at(getDaySeconds(time.time(), 1) + conf['seasontime'],
lambda : sendOrderNotify(conf, conf['seasontime']))
tornado.ioloop.IOLoop.current().start()