diff --git a/lib/crawler.py b/lib/crawler.py index 16c000d..0eb3d91 100644 --- a/lib/crawler.py +++ b/lib/crawler.py @@ -235,7 +235,9 @@ def getSchedule(Ip, S): temp_lesson['color'] = lesson_set[l['Content'][0]['Name']] else: color = random.randint(0, 8) - while color_set[color] and color_used: + while color_set[color]: + if color_used <= 0: + break; color = random.randint(0, 8) temp_lesson['color'] = color lesson_set[l['Content'][0]['Name']] = color @@ -272,4 +274,10 @@ def getSchedule(Ip, S): temp_lesson['Time_split'] = Time 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} \ No newline at end of file + return {'errcode': 200, 'errmsg': 'ok', 'data': data_cache} + +data = connection('2018002129','cust5313.','') +print(data) +print(getGrade(data['ip'],data['s'])) + +print(getSchedule(data['ip'],data['s'])) \ No newline at end of file