返回顶部
1

12306-train-assistant12306火车助手

12306 查询与订票辅助技能,支持余票查询、经停站查询、中转换乘、候补查询与提交/取消、登录状态检查、密码登录与二维码登录、下单与支付链接获取;当用户提到火车票、高铁票、经停站、中转、候补或 12306 查票时触发。

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 0.1.7
安全检测
已通过
899
下载量
免费
免费
7
收藏
概述
安装方式
版本历史

12306-train-assistant

12306 CLI 技能 🚄

目标

使用本仓库的 client.py 完成 12306 相关查询与下单辅助,优先覆盖:

  • - 余票查询:left-ticket
  • 中转换乘:transfer-ticket
  • 中转下单:transfer-book
  • 经停站:route(支持 --train-code 自动解析)
  • 登录态检查:status
  • 二维码登录:qr-login-create
  • 候补管理:candidate-queue / candidate-orders / candidate-submit / candidate-cancel / candidate-pay
  • 支付信息:order-pay
  • 需要登录的操作:passengers / orders / order-no-complete / book / transfer-book / order-pay / candidate-submit / candidate-cancel / candidate-pay

触发信号

用户提到以下需求时触发本技能:

  • - 查明天北京到上海余票
  • G1033 经停站
  • 深圳到拉萨怎么中转
  • 把第1个中转方案下单
  • 候补排队状态怎么样
  • 12306 登录状态

执行原则

  1. 1. 默认使用 text 输出(便于用户阅读);仅在用户明确要求结构化数据时添加 --json。
  2. 解析相对日期(今天/明天/后天)为 YYYY-MM-DD 后再执行命令。
  3. 站名支持中文/拼音/三字码,直接传给命令即可。
  4. route 优先使用 --train-code,减少用户提供 train_no 的负担。
  5. 失败时先给出可执行的修复建议(缺少参数、日期格式、站名不匹配、风控限制等)。
  6. book/transfer-book 成功后优先告知订单号,并提示下一步执行 order-pay 获取支付参数;若网页支付不可用,建议前往 12306 App 的待支付订单继续支付。
  7. qr-login-create 会自动在后台启动登录检查;扫码确认后统一使用 status 判断是否已登录。

常用示例

示例 1:余票查询

bash
python3 client.py left-ticket --date 2026-03-23 --from 北京南 --to 上海虹桥
python3 client.py left-ticket --date 2026-03-23 --from 北京 --to 上海 --limit 10 --json

示例 2:中转换乘

bash
python3 client.py transfer-ticket --date 2026-03-23 --from 深圳 --to 拉萨 --limit 10
python3 client.py transfer-ticket --date 2026-03-23 --from 深圳 --to 拉萨 --middle 西安 --json

示例 2.1:中转下单

bash

先预检(不最终提交)


python3 client.py transfer-book --date 2026-03-23 --from 成都 --to 广安 --plan-index 1 --seat second_class --passengers 张三 --dry-run

正式提交

python3 client.py transfer-book --date 2026-03-23 --from 成都 --to 广安 --plan-index 1 --seat second_class --passengers 张三

示例 3:经停站

bash

推荐:直接使用车次号,脚本自动解析 train_no


python3 client.py route --train-code C956 --date 2026-03-23 --from 南部 --to 南充北

已知 train_no 时可直接查询

python3 client.py route --train-no 760000C95604 --date 2026-03-23 --from NBE --to NCE

示例 4:登录与状态

bash
python3 client.py status
python3 client.py login --username <账号> --password <密码>
python3 client.py login --username <账号> --id-last4 <证件后4位> --send-sms
python3 client.py login --username <账号> --id-last4 <证件后4位> --sms-code <6位验证码>

二维码登录流程

python3 client.py qr-login-create python3 client.py status

示例 5:乘车人与订单

bash
python3 client.py passengers --limit 50
python3 client.py orders --where G --page-size 20
python3 client.py orders --where H --start-date 2026-02-01 --end-date 2026-03-01
python3 client.py order-no-complete
python3 client.py order-no-complete --any --json

示例 6:订票(预检与提交)

bash

只校验,不最终提交


python3 client.py book --date 2026-03-23 --from 北京南 --to 上海虹桥 --train-code G101 --seat second_class --passengers 张三 --dry-run

正式提交

python3 client.py book --date 2026-03-23 --from 北京南 --to 上海虹桥 --train-code G101 --seat second_class --passengers 张三

单人选座(D 会自动归一化为 1D)

python3 client.py book --date 2026-03-23 --from 北京南 --to 上海虹桥 --train-code G101 --seat second_class --passengers 张三 --choose-seats D

不下单,仅获取订单支付信息(普通/中转通用)

python3 client.py order-pay --pay-channel alipay

示例 7:候补查询

bash

候补排队状态


python3 client.py candidate-queue

候补订单(进行中)

python3 client.py candidate-orders

候补订单(已处理)

python3 client.py candidate-orders --processed --start-date 2026-03-11 --end-date 2026-04-09 --limit 20

提交候补(建议目标席别余票为无时)

python3 client.py candidate-submit --date 2026-03-23 --from 北京南 --to 上海虹桥 --train-code G101 --seat second_class

取消候补

python3 client.py candidate-cancel --reserve-no <候补单号>

候补支付参数(自动读取 reserve_no)

python3 client.py candidate-pay

候补支付参数(指定 reserve_no)

python3 client.py candidate-pay --reserve-no <候补单号>

每个命令参数说明

全局参数(所有命令可用)

参数必填默认值说明
--timeout15请求超时时间(秒)
--json
否 | 关闭 | 以 JSON 格式输出结果 |

left-ticket 余票查询

参数必填默认值说明
--date出发日期,格式 YYYY-MM-DD
--from
是 | 无 | 出发站(中文/拼音/三字码) | | --to | 是 | 无 | 到达站(中文/拼音/三字码) | | --purpose | 否 | ADULT | 乘客类型 | | --endpoint | 否 | queryG | 余票接口类型,queryG 或 queryZ | | --limit | 否 | 20 | 文本输出时最多展示行数 |

transfer-ticket 中转换乘

参数必填默认值说明
--date出发日期,格式 YYYY-MM-DD
--from
是 | 无 | 出发站 | | --to | 是 | 无 | 到达站 | | --middle | 否 | 空 | 指定换乘站,不传则自动推荐 | | --result-index | 否 | 0 | 分页游标 | | --can-query | 否 | Y | 是否继续查询更多方案(Y/N) | | --show-wz | 否 | 关闭 | 显示无座方案 | | --purpose | 否 | 00 | 中转接口乘客类型参数 | | --channel | 否 | E | 中转接口渠道参数 | | --endpoint | 否 | queryG | 中转接口类型,queryG 或 queryZ | | --limit | 否 | 20 | 文本

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 12306-train-assistant-1776154933 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 12306-train-assistant-1776154933 技能

通过命令行安装

skillhub install 12306-train-assistant-1776154933

下载

⬇ 下载 12306-train-assistant v0.1.7(免费)

文件大小: 42.32 KB | 发布时间: 2026-4-15 11:59

v0.1.7 最新 2026-4-15 11:59
- Added the new order-no-complete command to support querying for unfinished orders.
- Updated documentation to include order-no-complete usage examples and parameter descriptions.
- Expanded the description of required login actions for some commands in the overview.
- Bumped version metadata (inferred from overall context).

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部