forked from DefJia/Auto_Reservation_System_BE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
138 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
.config.ini* | ||
data.db | ||
.idea/ | ||
__pycache__/ | ||
|
||
data/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,2 @@ | ||
from Manage import Manage | ||
from Book import Book | ||
import sqlite3 | ||
|
||
|
||
class Crawl: | ||
@staticmethod | ||
def crawl_user(): | ||
a = Manage().login() | ||
conn = sqlite3.connect('data.db') | ||
c = conn.cursor() | ||
for i in range(69, 2047): | ||
info = a.query_info('user', page=i) | ||
for elem in info: | ||
sql = "insert into user(sid, cid, name, type, department) values (" | ||
for field in elem: | ||
sql += "'" + elem[field] + "'," | ||
sql = sql[:-1] + ')' | ||
try: | ||
c.execute(sql) | ||
except sqlite3.IntegrityError: | ||
print(sql) | ||
except sqlite3.OperationalError: | ||
print(sql) | ||
conn.commit() | ||
print("第%d页完成爬取" % i) | ||
conn.close() | ||
|
||
@staticmethod | ||
def crawl_book(): | ||
a = Manage().login() | ||
conn = sqlite3.connect('data.db') | ||
c = conn.cursor() | ||
for i in range(3270, 4550): | ||
info = a.query_info('book', page=i) | ||
for elem in info: | ||
sql = "insert into book(bid, sid, name, room, start, end, status, book_time) values (" | ||
for field in elem: | ||
sql += "'" + elem[field] + "'," | ||
sql = sql[:-1] + ')' | ||
# print(elem) | ||
try: | ||
c.execute(sql) | ||
except sqlite3.IntegrityError: | ||
print(sql) | ||
except sqlite3.OperationalError: | ||
print(sql) | ||
conn.commit() | ||
print("第%d页完成爬取" % i) | ||
conn.close() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,73 @@ | ||
# LIT后花园观景台预约系统后台 | ||
# 图书馆座位预约系统辅助工具 | ||
|
||
本系统由Defjia从2017.11开始开发,经过数次迭代和一次重构,这里是重构后的代码。 | ||
|
||
[TOC] | ||
|
||
## 文件结构 | ||
- Core Codes | ||
- Book.py | ||
- Book (预约相关) | ||
- login(self) | ||
- prepare(self, room, seat, date) | ||
- book(self) | ||
- General.py | ||
- General | ||
通用的方法。 | ||
- Maintain.py | ||
- | ||
- Manage.py (包含后台操作,不对外公开) | ||
- Manage | ||
- login(self) | ||
- query_info(self, action, student_id='', page=1) | ||
- | ||
|
||
## 代码结构 | ||
- Book.py | ||
- Book (预约相关) | ||
|
||
- *index(first, second=-1)* | ||
|
||
定位配置文件中的账号密码 | ||
|
||
- login(self) | ||
|
||
CAS登录 | ||
|
||
- prepare(self, room, seat, date) | ||
|
||
预约准备 | ||
|
||
- book(self) | ||
|
||
预约 | ||
- General.py | ||
- General | ||
|
||
通用的方法。 | ||
- Maintain.py | ||
- detect() | ||
|
||
检测僵尸账号是否正常 | ||
- Manage.py (包含后台操作,不对外公开) | ||
- Manage | ||
- login(self) | ||
- query_info(self, action, student_id='', page=1) | ||
- del_renege(self, student_id) | ||
- del_book(self, sid, date_delta) | ||
- get_book_time(self, href) | ||
|
||
- Crawl | ||
|
||
爬取数据 | ||
|
||
- *crawl_user()* | ||
|
||
爬取用户信息 | ||
|
||
- *crawl_book()* | ||
|
||
爬取预约记录 | ||
|
||
- rm_space(string) | ||
|
||
## 版本记录 | ||
|
||
### 已修改内容 | ||
- 修改文件结构。 | ||
- Manage.del_reneges方法增加参数识别,方便切换删除账号的类别。 | ||
- index方法修改为Book类的静态方法,可以通过拼音码(常用用户)、序号(僵尸账号)指定学号密码。 | ||
|
||
- index方法修改为Book类的静态方法,可以通过拼音码(常用用户)、序号(僵尸账号)指定学号密码。 | ||
### 待修改内容 | ||
|
||
#### 重要 | ||
- 添加自动定时预约功能 | ||
- 添加自动维护未签到座位功能 | ||
|
||
#### 一般 | ||
- 增加关注座位入馆提醒功能 | ||
|
||
#### 不重要 | ||
- 在config.ini中标注僵尸账号的可用性,以及修改相关方法。 | ||
- 增加入馆时自动预约功能。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters