This commit is contained in:
aozhiwei 2019-08-22 14:16:21 +08:00
parent 8f6f2a0156
commit 5135f15c5d

View File

@ -70,7 +70,8 @@ def fetchConfirmedOrderList():
print(e) print(e)
return return
def sendOneOrder(idx, orderid): def sendOneOrder(conf, idx, orderid):
global notifyapi_json
try: try:
conn = getMysqlConn('') conn = getMysqlConn('')
cursor = conn.cursor() cursor = conn.cursor()
@ -79,8 +80,7 @@ def sendOneOrder(idx, orderid):
row = cursor.fetchone() row = cursor.fetchone()
if (not row) or (row[0] != 1): if (not row) or (row[0] != 1):
return True return True
print(row[3]) if row[6] == 0:
if row[6] == '0':
timestamp = time.time() timestamp = time.time()
params = { params = {
'account_id' : row[1], 'account_id' : row[1],
@ -90,10 +90,10 @@ def sendOneOrder(idx, orderid):
} }
secret = 'fc38349c5d084e920925e614c420be9f' secret = 'fc38349c5d084e920925e614c420be9f'
md5signstr = md5Sign(params, secret, timestamp) md5signstr = md5Sign(params, secret, timestamp)
url = conf['notify_url'] + '&timestamp=' + str(timestamp) + '&sign=' + md5signstr url = notifyapi_json[str(row[5])]['notify_url'] + '&timestamp=' + str(timestamp) + '&sign=' + md5signstr
req = urllib.request.Request(url) req = urllib.request.Request(url)
# data = urllib.request.urlopen(req).read() data = urllib.request.urlopen(req).read()
# jsonobj = json.loads(data) jsonobj = json.loads(data)
info('sendNotify end') info('sendNotify end')
return True return True
except Exception as e: except Exception as e:
@ -107,7 +107,7 @@ def sendNotify(conf, sendtime):
handled_cout = 0 handled_cout = 0
while len(confirmed_order_list) > 0 and handled_cout < 50: while len(confirmed_order_list) > 0 and handled_cout < 50:
confirmed_order = confirmed_order_list[0] confirmed_order = confirmed_order_list[0]
if sendOneOrder(confirmed_order['idx'], confirmed_order['orderid']): if sendOneOrder(conf, confirmed_order['idx'], confirmed_order['orderid']):
confirmed_order_list.pop(0) confirmed_order_list.pop(0)
handled_cout += 1 handled_cout += 1
else: else: