返回列表

线下交付运营端调用

v1.0.2

Use when an AI/MCP client needs to call deliver-operate APIs (order queries, etc.) on behalf of a user and must first obtain authorization — covers the device-auth flow to get an ait_ token and the order query API.

来源: ./plugins/calling-deliver-operate

安装命令

安装技能
/plugin install calling-deliver-operate@datou-skill
添加市场源首次使用需要 · 已添加过可跳过
直连(GitHub)
/plugin marketplace add https://github.com/Garretqaq/plugins-market
首次使用先「添加市场源」,之后安装本市场的其它技能无需重复添加。国内访问 GitHub 慢时,用「代理加速」地址。

技能说明

deliver-operate AI 调用助手

通过设备授权流程(Device Authorization Flow)获取 ait_ 令牌,安全地代表用户调用 deliver-operate 订单查询接口。

快速开始

# 1. 设备授权(首次 / 令牌失效时)
python3 deliver.py authorize

# 2. 查询订单(自动复用缓存令牌)
python3 deliver.py orders --from '2026-06-11 00:00:00' --to '2026-06-17 23:59:59' --page 1 --size 20

# 3. 验证令牌是否有效
python3 deliver.py whoami

# 4. 通用调用任意接口
python3 deliver.py call /api/deliver-order/pageOrderStats --body '{"pageNum":1,"pageSize":20}'

项目结构

.
├── deliver.py              # 主脚本:授权 + 查询 + 通用调用
├── config.json             # 本地配置(baseUrl + aiToken),已加入 .gitignore
├── interfaces/
│   ├── _index.md           # 接口清单索引
│   └── order-page.md       # 订单分页查询接口文档
├── SKILL.md                # Skill 元数据(Claude Code 用)
└── README.md               # 本文件

核心流程

  1. 设备授权 → 获取 deviceCode + verificationUrl
  2. 用户确认 → 浏览器打开链接,登录并点「确认授权」
  3. 轮询换令牌 → 获取 ait_<hex> 令牌,写入 config.json
  4. 带令牌调用 → 所有业务请求带 Authorization: ait_<hex>

安全提示

  • config.json 中的 aiToken用户级敏感令牌,已加入 .gitignore切勿提交到 git
  • 令牌 7 天有效,HTTP 401 即失效,需重新 authorize
  • 查询订单必须带时间范围createTimeLeft + createTimeRight),脚本已强制校验

环境要求

  • Python 3.6+(零第三方依赖,仅标准库)

接口文档

详见 interfaces/_index.md

文件结构

plugin.json
.gitignore
README.md
SKILL.md
config.json.example
deliver.py
_index.md
number-query-create.md
order-page.md