1
This commit is contained in:
parent
ee303dbd63
commit
9f8b862b79
@ -39,6 +39,7 @@ def md5Sign(params, secret, timestamp, connstr = '&', secret_connstr = ':'):
|
|||||||
if params_str != '' and connstr != '':
|
if params_str != '' and connstr != '':
|
||||||
params_str = params_str[0:-1]
|
params_str = params_str[0:-1]
|
||||||
str1 = params_str + secret_connstr + str(timestamp) + secret
|
str1 = params_str + secret_connstr + str(timestamp) + secret
|
||||||
|
print(str1)
|
||||||
try:
|
try:
|
||||||
m5 = hashlib.md5()
|
m5 = hashlib.md5()
|
||||||
m5.update(str1.encode('utf-8'))
|
m5.update(str1.encode('utf-8'))
|
||||||
@ -46,6 +47,13 @@ def md5Sign(params, secret, timestamp, connstr = '&', secret_connstr = ':'):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
info('md5Sign error: ' + str(e))
|
info('md5Sign error: ' + str(e))
|
||||||
|
|
||||||
|
def urlencodeParams(params):
|
||||||
|
return urllib.parse.urlencode(params)
|
||||||
|
params_str = ''
|
||||||
|
for key in sorted(params.keys()):
|
||||||
|
params_str = params_str + key + '=' + urllib.urlencode(str(params[key])) + '&'
|
||||||
|
return params_str
|
||||||
|
|
||||||
def getDaySeconds(time_val, incdays):
|
def getDaySeconds(time_val, incdays):
|
||||||
time_zone = 8
|
time_zone = 8
|
||||||
dayseconds = int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
dayseconds = int((time_val + time_zone * 3600)/3600/24 + incdays) * 3600 * 24 - 3600 * time_zone;
|
||||||
@ -110,11 +118,13 @@ def sendOneOrder(conf, idx, orderid):
|
|||||||
'account_id' : row[1],
|
'account_id' : row[1],
|
||||||
'orderid' : row[4],
|
'orderid' : row[4],
|
||||||
'itemid' : row[2],
|
'itemid' : row[2],
|
||||||
|
'itemnum': 1,
|
||||||
'amount' : row[3],
|
'amount' : row[3],
|
||||||
}
|
}
|
||||||
secret = 'fc38349c5d084e920925e614c420be9f'
|
secret = 'fc38349c5d084e920925e614c420be9f'
|
||||||
md5signstr = md5Sign(params, secret, timestamp)
|
md5signstr = md5Sign(params, secret, timestamp)
|
||||||
url = notifyapi_json[str(row[5])]['notify_url'] + '×tamp=' + str(timestamp) + '&sign=' + md5signstr
|
url = notifyapi_json[str(row[5])]['notify_url'] + '×tamp=' + str(timestamp) + '&sign=' + md5signstr + \
|
||||||
|
'&' + urlencodeParams(params)
|
||||||
req = urllib.request.Request(url)
|
req = urllib.request.Request(url)
|
||||||
data = urllib.request.urlopen(req).read()
|
data = urllib.request.urlopen(req).read()
|
||||||
info(str(data))
|
info(str(data))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user