modify the struct of schedule

This commit is contained in:
lijingwei 2020-01-22 12:20:12 +08:00
parent a16952b1ce
commit bac05cb9df

View File

@ -71,10 +71,29 @@ def getSchedule(Ip, S):
if( data[i][time[j]][k]['Dtos'] ):
data_cache[j*2+k][i] = []
for l in data[i][time[j]][k]['Dtos']:
temp = []
temp_lesson = {}
for m in l['Content']:
temp.append(m['Name'])
data_cache[j*2+k][i].append(temp)
if temp_lesson.get(m['Key']):
temp_lesson[m['Key']] += ','+m['Name']
else:
temp_lesson[m['Key']] = m['Name']
temp_Time = temp_lesson['Time']
if '单周' in temp_Time:
temp_lesson['mod'] = 'single'
temp_Time = temp_Time[0:len(temp_Time)-5]
elif '双周' in temp_Time:
temp_lesson['mod'] = 'double'
temp_Time = temp_Time[0:len(temp_Time)-5]
else:
temp_lesson['mod'] = 'all'
temp_Time = temp_Time[0:-1]
temp_Time = temp_Time.split(',')
index = 0
for n in temp_Time:
temp_Time[index] = n.split('-')
index += 1
temp_lesson['Time']=temp_Time
data_cache[j*2+k][i].append(temp_lesson)
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}
def getCurrentTime(Ip, S):
@ -86,4 +105,4 @@ def getCurrentTime(Ip, S):
)
data = json.loads(r.content.decode('utf-8'))
data_cache = data['data'].pop('DateList')
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}
return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache}