commit
1fea048620
8
coc.py
8
coc.py
@ -1,4 +1,5 @@
|
||||
# 引入文件夹中的文件
|
||||
from flask_cors import CORS #跨域访问
|
||||
import sys
|
||||
sys.path.append('./lib')
|
||||
from allFunction import manageLogin, managePhoto, manageAdd, manageDel, manageGet, manageDetail, manageComment
|
||||
@ -7,6 +8,9 @@ from flask import Flask, request, session
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
#取消跨域访问限制,方便本地测试
|
||||
#CORS(app, resources=r'/*') # 注册CORS, "/*" 允许访问所有api
|
||||
|
||||
# 登录接口,前端提供cid和pwd,包装在data里边然后md5校验也就是data:{cid,pwd,sign}
|
||||
@app.route('/api/login',methods=['POST'])
|
||||
def login():
|
||||
@ -49,6 +53,10 @@ def laf_comment():
|
||||
res = manageComment(request)
|
||||
return res
|
||||
|
||||
# 审核
|
||||
@app.route('/api/shenhe')
|
||||
def laf_shenhe():
|
||||
data = manageGet()
|
||||
if __name__ == '__main__':
|
||||
app.debug = True
|
||||
app.run()
|
Binary file not shown.
@ -181,6 +181,12 @@ def getGrade(Ip, S):
|
||||
|
||||
def getSchedule(Ip, S):
|
||||
headers = {'Content-Type': 'application/json'}
|
||||
r = S.post(
|
||||
url='http://'+Ip[0]+'-'+Ip[1]+'-'+Ip[2]+'-'+Ip[3]+'-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
|
||||
)
|
||||
CurWeek = json.loads(r.content.decode('utf-8'))['data']['CurWeek']
|
||||
r = S.post(
|
||||
url='http://'+Ip[0]+'-'+Ip[1]+'-'+Ip[2]+'-'+Ip[3]+'-8080-p.webvpn.cust.edu.cn:8118/api/ClientStudent/Home/StudentHomeApi/QueryStudentScheduleData?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":"查询"}}),
|
||||
@ -192,12 +198,15 @@ def getSchedule(Ip, S):
|
||||
time = ['AM__TimePieces','PM__TimePieces','EV__TimePieces']
|
||||
data = data['data']['AdjustDays']
|
||||
days_per_week = [0] * 23
|
||||
lesson = [[0] * 7 for _ in range(6)]
|
||||
lesson = [[0] * 6 for _ in range(7)]
|
||||
lesson_set = {}
|
||||
color_set = [0] * 9
|
||||
color_used = 9
|
||||
for i in range(7):
|
||||
for j in range(3):
|
||||
for k in range(2):
|
||||
if( data[i][time[j]][k]['Dtos'] ):
|
||||
lesson[j*2+k][i] = []
|
||||
lesson[i][j*2+k] = []
|
||||
for l in data[i][time[j]][k]['Dtos']:
|
||||
temp_lesson = {}
|
||||
Time = [0] * 23
|
||||
@ -207,6 +216,16 @@ def getSchedule(Ip, S):
|
||||
temp_lesson[m['Key']] += ','+m['Name']
|
||||
else:
|
||||
temp_lesson[m['Key']] = m['Name']
|
||||
if lesson_set.get(l['Content'][0]['Name']):
|
||||
temp_lesson['color'] = lesson_set[l['Content'][0]['Name']]
|
||||
else:
|
||||
color = random.randint(0, 8)
|
||||
while color_set[color] and color_used:
|
||||
color = random.randint(0, 8)
|
||||
temp_lesson['color'] = color
|
||||
lesson_set[l['Content'][0]['Name']] = color
|
||||
color_used -= 1
|
||||
color_set[color] = 1
|
||||
temp_Time = temp_lesson['Time']
|
||||
if '单周' in temp_Time:
|
||||
mod = 'single'
|
||||
@ -236,17 +255,6 @@ def getSchedule(Ip, S):
|
||||
Time[int(n[0])] = 1
|
||||
index += 1
|
||||
temp_lesson['Time_split'] = Time
|
||||
lesson[j*2+k][i].append(temp_lesson)
|
||||
data_cache = {'lesson':lesson,'days_per_week':days_per_week}
|
||||
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')
|
||||
lesson[i][j*2+k].append(temp_lesson)
|
||||
data_cache = {'lesson':lesson,'days_per_week':days_per_week,'cur_week':CurWeek}
|
||||
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}
|
Loading…
x
Reference in New Issue
Block a user