-
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
7 changed files
with
7,451 additions
and
4,511 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
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import DocCardList from '@theme/DocCardList'; | ||
|
||
# 简介 | ||
|
||
本部分是服务器相关日常维护的文档。 |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# 更新蛋壳课程列表 | ||
|
||
本部分介绍如何在每学期人工维护蛋壳中的课程列表。 | ||
|
||
## 获取学期课程列表 | ||
将使用 [ppolariss/FDUCourseData](https://github.com/ppolariss/FDUCourseData) 仓库爬取课程数据。 | ||
|
||
::::info 工具限制 | ||
|
||
目前,该项目只支持爬取复旦大学本科课程的数据。你还需要一个本科生账号(为完整抓取体育课程,可能需要男生和女生账号各一个)。 | ||
|
||
该工具有两种爬取方法:`xk`(选课系统)和 `jwfw`(教务服务系统)。 | ||
|
||
前者只能在选课开放时爬取,信息更全;后者可以全年爬取,但信息不全。建议使用 `xk` 方法爬取。但我们的脚本也支持 `jwfw` 的数据格式,并且实际上蛋壳目前也只需要利用 `jwfw` 所包含的数据。 | ||
:::: | ||
|
||
::::warning 注意 | ||
复旦的“学期”包括:秋冬、寒假、春夏、暑假。每个学期的课程列表都是独立的。**目前蛋壳也需要寒暑假学期的课程信息,请不要忘记爬取这两个学期的数据。** | ||
|
||
总之,你每个学期的例行更新时,一般都是需要更新两个学期的数据。每年总共需要更新四个学期的数据。 | ||
:::: | ||
|
||
该项目描述文件的介绍非常详细,按照步骤操作即可,这里不再赘述。总之,你会得到一个当前学期信息的 JSON 文件。 | ||
|
||
## 上传课程列表 | ||
|
||
上传课程的脚本在 [OpenTreeHole/curriculum_board_backend_next](https://github.com/OpenTreeHole/curriculum_board_backend_next) 仓库的 `cli` 目录下。该脚本使用 Rust 编写,因此请先安装 Rust 环境。 | ||
|
||
Clone 仓库后,进入 `cli` 目录,运行: | ||
|
||
```bash | ||
cargo run -- --help | ||
``` | ||
|
||
即可查看帮助信息。你也可以查看 `cli/src/main.rs` 文件了解更多信息。下面是对几个复杂参数的解释: | ||
|
||
- `--db_url`:不是数据库的 URL,而是后端上传课程的 URL,例如 `https://danke.fduhole.com/api/courses`。请向后端同学了解该 URL。 | ||
- `--auth_token`:具有管理员权限的 token,用于上传课程。应当从 Auth 前端(一般为 <https://auth.fduhole.com>)登录获得 access token。 | ||
|
||
运行脚本,上传 JSON 文件即可。 | ||
|
||
::::tip 错误恢复 | ||
**不小心写错了学期/写错了学年/选错了 JSON 文件,已经上传了一半,怎么办?** 目前唯一的办法是后端同学利用 SQL 删除错误的课程。如果不巧和现有学期混合,则无法恢复了。 | ||
|
||
**上传到一半不小心中止/断网了,怎么办?** 取决于后端同学的实现,目前的实现下,重复上传课程会报 400 错误,这会导致脚本中止。你需要修改脚本中对状态码的判断,使其忽略该错误码,然后重新运行脚本即可。 | ||
:::: |
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
Oops, something went wrong.