Install
openclaw skills install dxm-sp-weather用户询问天气(今天天气怎么样、天气怎么样、某城市/某日期天气)、或查询天气服务订单/额度/调用明细时触发
openclaw skills install dxm-sp-weather⚠️ 安装前须知
- 服务后端:所有 API 调用(天气查询、用户注册、短链生成)均通过
https://www.dxmpay.com。如果您不信任该域名,请勿安装。- 域名范围说明:本 Skill 的所有网络请求均限定在
www.dxmpay.com域名下,包括天气查询、支付、短链生成接口。短链服务仅对https://www.dxmpay.com/开头的 URL 生成短链,其他域名的 URL 会被拒绝,不存在将任意外部链接发送至短链服务的风险。- 密钥对存储:本 Skill 会在首次运行时生成 EC 密钥对,加密后保存至
${CLAUDE_SKILL_DIR}/sp-weather-config.json。密码通过对话获取,不写入任何文件。- 二维码文件写入:生成的 PNG 文件默认写入当前工作目录,请注意文件残留,必要时手动清理。
本 Skill 通过天气服务 (https://www.dxmpay.com) 查询天气,并支持用户认证初始化、订单查询、额度查询等功能。
脚本路径: scripts/sp-weather-cli.js(相对于 skill 目录)
运行方式: node scripts/sp-weather-cli.js <command> [options]
以下任意情况触发本 Skill:
每次执行前必须先通过对话询问用户密码:
"执行天气查询需要您的私钥保护密码,请告知(密码不会被记录到任何文件):"
获取到密码后,后续所有 node scripts/sp-weather-cli.js 调用均需在命令前拼接环境变量:
export SP_WEATHER_PASSWORD=<用户输入的密码> && node scripts/sp-weather-cli.js <command>
注意:密码仅在命令行内联使用,不写入任何文件,不输出到日志。
每次执行前必须先运行:
node scripts/sp-weather-cli.js userConfig
"action": "exists" → 配置已存在,直接进入第三步"action": "created" → 已自动生成 EC/secp256r1 密钥并保存到 ${SKILL_DIR}/sp-weather-config.json,继续第三步queryWeather触发:用户询问任何天气相关问题
参数提取:
new Date().toISOString().split('T')[0] 获取)执行:
node scripts/sp-weather-cli.js queryWeather --city <城市> --date <日期>
示例:
node scripts/sp-weather-cli.js queryWeather --city 北京 --date 2026-03-20
node scripts/sp-weather-cli.js queryWeather --city 上海
处理结果:
success: true → 将 data 中的天气信息整理后展示给用户error: "FORBIDDEN" 或 detail 包含"未购买"时:
node scripts/sp-weather-cli.js queryPurchaseDetail
data 中提取字段,构造结构化 JSON:
{
"productName": "<data.productName>",
"productDesc": "<data.productDesc>",
"price": "<data.price>",
"payUrl": "<data.payUrl(必须为 https://www.dxmpay.com/ 开头)>",
"pay_channels": "<data.pay_channels>",
}
dxm-claw-pay Skill,传入上述 JSON
→ 后续二维码生成(含 --short-url 短链)、话术引导均由 dxm-claw-pay 完成needCity: true → 询问用户城市名后重新执行queryOrders触发:用户查询充值记录、订单列表
node scripts/sp-weather-cli.js queryOrders
# 分页(可选)
node scripts/sp-weather-cli.js queryOrders --page 1 --page-size 20
接口:GET /api/skill/orders?uid=<userId>&page=1&page_size=20
queryOrder触发:用户提供了具体订单号
node scripts/sp-weather-cli.js queryOrder --orderId SP202603192029449B6A4893
接口:GET /api/skill/orders/<orderId>?uid=<userId>
queryQuota触发:用户询问余额、额度、还能用多少次
node scripts/sp-weather-cli.js queryQuota
接口:GET /api/skill/quota?uid=<userId>&skill_id=skill_001
queryCallLogs触发:用户查询调用记录、用量明细
node scripts/sp-weather-cli.js queryCallLogs
# 分页(可选)
node scripts/sp-weather-cli.js queryCallLogs --page 1 --page-size 20
接口:GET /api/skill/call-logs?uid=<userId>&skill_id=skill_001&page=1&page_size=20
queryPurchaseDetail触发:余额不足时自动调用;或用户询问充值套餐、商品价格
node scripts/sp-weather-cli.js queryPurchaseDetail
接口:GET /api/skill/purchase/detail?uid=<userId>&skill_id=skill_001
处理结果:从返回的 data 中提取商品字段,构造结构化 JSON,调用 dxm-claw-pay Skill 完成二维码生成(dxm-claw-pay 内部使用 --short-url 生成短链)
脚本自动将用户配置保存在 ${CLAUDE_SKILL_DIR}/sp-weather-config.json,内容包括:
{
"userId": "userid",
"publicKey": "-----BEGIN PUBLIC KEY-----\n...",
"privateKey": "加密格式..."
}
密钥算法:EC / secp256r1(prime256v1),签名算法:SHA256withECDSA。
| 变量 | 说明 | 默认值 |
|---|---|---|
SP_WEATHER_BASE | 天气服务 base URL | https://www.dxmpay.com(天气查询与支付均通过此域名) |
SP_WEATHER_PASSWORD | 私钥保护密码,未设置时 Skill 会通过对话向用户询问 | 无 |
| 现象 | 处理 |
|---|---|
连接天气服务失败 | 确认服务 https://www.dxmpay.com 是否可达 |
余额不足 / payRequired: true | 扫码充值后重试 |
| 二维码不显示 | 手动打开 payUrl 完成支付;可安装 brew install qrencode 改善体验 |
用户配置不存在 | 先执行 userConfig 命令初始化 |
未知命令 | 检查命令名拼写,可用命令:userConfig / queryWeather / queryOrders / queryOrder / queryQuota / queryPurchaseDetail / queryCallLogs |