A CLI client for PKU's campus info portal — 空闲教室、校历、网费 in one command.
crates/portal/pkuinfo_common::credential(多数学生上网密码与 IAAA 相同)GET /publicQuery/classroomQuery/retrClassRoomFree.do?buildingName=<中文>&time=<中文>,返回 {success, rows:[{room, cap, c1..c12}]}js/ccSchoolCalendar..js bundle 里。真正的 _v("...") 文本节点都在 webpack render 函数里,不在 {name:"Calendar…" 元数据块里。simso 开发者经常原地复用老 .vue 文件改内容、不更新内部 name:,所以按内部命名匹配会拿错学年。正确做法:tab pane label → Home Calendar: → =.exports → =Object(o["a"])(,,…) → 在 函数体内按 "第一学期"===t.xq?[ / "第二学期"===t.xq?[ 切分上/下学期POST /cas/webLogin → /netportal/itsUtil?operation=info(HTML 表含余额)→ POST /cas/ITSweb cmd=select → GET /myConn.jsp(在线 IP 会话)pkuConfirm → pkuSendOrder → cwsf.pku.edu.cn 收银台 AJAX /PayPreService/pay/cashier/gotToPay 返回 {data:{urlCode}}pkuinfo_common::captcha(manual / utool 免费 / ttshitu / yunma)src/main.rs — tokio::main 调用 pku_portal::run()src/lib.rs — Clap CLI + dispatchsrc/client.rs — reqwest client (simple 和 with cookies 两档)src/freeclassroom.rs — 空闲教室 API + 渲染src/calendar.rs — simso Vue bundle 解析src/netfee.rs — ITS 登录 / 余额 / 会话 / 3 步充值 / 付款码 QR 渲染| Command | 用途 | ||
|---|---|---|---|
| --------- | ----- | ||
| `free-classroom | tomorrow\ | day-after] / fc` | 查询空闲教室。building: 一教/二教/三教/四教/理教/文史/哲学/地学/国关/政管 |
| `calendar [-y 2025-2026] [-s first\ | second\ | all] / cal` | 显示校历。--semester 可选 first/second/all(也接受 1/2/上/下) |
netfee status | 余额 + 在线会话 | ||
| `netfee recharge | alipay] [--captcha utool]` | 充值,终端打印微信/支付宝付款二维码 | |
netfee watch --threshold 10 | 低余额监测,余额 < 阈值返回退出码 2 |
info-auth check
portal free-classroom 一教 # 无需登录
portal calendar --year 2025-2026 --semester first # 无需登录
portal netfee status # 需要 keyring 凭据
portal netfee recharge 10 -m wechat # 微信扫码付款,二维码直接打终端
portal netfee watch -t 5 || notify "PKU netfee low"
anyhow::Result + .context("...")/paybank/user.PayBankOrderPKU 响应页内嵌的 alert("验证码不能为空!") 是 JS 函数体里的 literal,不是真正的错误。只匹配独立 才是真错误paytype="" 即可;真正的 payType=02(微信)/01(支付宝)是 step3 收银台 AJAX 的字段cwsf.pku.edu.cn 域,step3 要用那个域的 origin 而不是 its.pku.edu.cnqrcode crate 的 Dense1x2 在终端渲染;兜底打印原始 urlCode 字符串~/.config/info/portal/共 2 个版本