modify md5 check and getCurrentTime

This commit is contained in:
lijingwei 2020-01-19 20:35:20 +08:00
parent 83ba475597
commit 458d91e992
2 changed files with 23 additions and 3 deletions

View File

@ -27,7 +27,17 @@ def manageLogin(request):
# MD5 校验
def checkData(data):
return True
temp = data.copy()
try:
temp.drop('sign')
except KeyError:
pass
p = sorted([x for x in d.items() if (x[1] or x[1] == 0)], key=lambda x: x[0])
p = unquote_plus(urlencode(p))
h = md5()
h.update(p.encode())
r = h.hexdigest().upper()
return r == data['sign']
# 创建会话
def connect(data):
@ -43,4 +53,3 @@ def connect(data):
except:
# 这了就是教务挂了
return {'errcode': 102, 'errmsg':'教务挂了'}

View File

@ -75,4 +75,15 @@ def getSchedule(Ip, S):
for m in l['Content']:
temp.append(m['Name'])
data_cache[j*2+k][i].append(temp)
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}
def getCurrentTime(Ip, S):
headers = {'Content-Type': 'application/json'}
r = S.post(
url='http://192-168-223-71-8080-p.webvpn.cust.edu.cn:8118/api/ClientStudent/Home/StudentHomeApi/GetHomeCurWeekTime?sf_request_type=ajax',
data=json.dumps({"param":"JTdCJTdE","__permission":{"MenuID":"F71C97D5-D3E2-4FDA-9209-D7FA8626390E","Operation":0},"__log":{"MenuID":"F71C97D5-D3E2-4FDA-9209-D7FA8626390E","Logtype":6,"Context":"查询"}}),
headers=headers
)
data = json.loads(r.content.decode('utf-8'))
data_cache = data['data'].pop('DateList')
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}