preface

Since I went to college, I wanted to double the rain in the school's educational administration system, but the result was uncomfortable - the Internet was not available... So I had to download the public timetable information on the school's educational administration website to do a little action.
 Timetable data

Freshman year - shotgun

In my freshman year, I joined the Network Technology Department of the Student Union when I was young and ignorant. Although the busy work in the Department occupied most of my spare time, it was good to harvest a girlfriend. Of course, it doesn't matter. What I want to say is that at that time, a deputy department wanted to push a picture of sorting out empty classrooms on the public account every day for students to view. A few days later, they came to me to discuss whether they could write a query system for empty classrooms, which would be more convenient. But then Knowledge level and cognitive scope Not enough. Faced with the hundreds of classrooms in the school, I was at a loss. Finally, I pulled other ministries and commissions of our department to sort them out manually. After summarizing them to me, I manually entered the data into the database. I won't tell you that I recorded the data for a week: (Of course, I used the time at night to enter it every day. My freshman year is too busy. However, no pains, no gains, and the final result is very satisfactory.
 Empty classroom team

Sophomore - cannon

When I was a sophomore, I had to choose whether to stay in the student union. I had a foolish opinion that the student union could exercise organizational ability and so on. But I personally liked to study technology, so I quit the student union and learned from the front end. Later, PHPExcel happened to be used in the "sign up" development, and I found that Excel was a good way to deal with it. So I started to study it when I was free, and finally realized the batch processing of class, teacher and classroom schedules in the whole school.

The process of processing the timetable

When dealing with class and teacher timetables, I found that the 19th and 36th rows in the Excel table were empty, which may be added to distinguish between early afternoon and evening, but in this case, one for loop cannot be used to the end. Finally, I can only compromise to write three for loops to deal with morning, afternoon and evening courses respectively. If you have better suggestions than me in this regard, please contact me and thank you!

The above small problems are good to say, but when dealing with empty classrooms, the problem comes again. At first, I wanted to cycle odd numbers in one week and even numbers in two weeks. After this process, I went online to the applet, and received feedback that most classrooms had classes. Then I reflected that I had sorted "empty classrooms" into "classrooms with classes"! So I immediately went to the applet platform to return the version to the version without empty classroom query function, thought it was "wrong", and used array_diff Change the data with classes into the data without classes. See the code for processing details: /freeroom.php#L16-L36 ,ok! Processing completed.

Thanks to the php cli mode, the data can be cycled to the end without setting set_time_limit I have to say that PHP is good 2333: p

epilogue

I think the processing method is not efficient enough, so friends who are interested in this can visit Website of Academic Affairs Department Download the curriculum data for processing, or Github The above is for guidance!
 import-URP-timetable

Last modification: December 21, 2017
If you think my article is useful to you, please feel free to appreciate it