首页龙虾技能列表 › Store Order Query — 店铺订单查询

Store Order Query — 店铺订单查询

v1.0.0

店铺订单查询工具。

0· 234·0 当前·0 累计
by @bondli·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/24
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's code, instructions, and requirements are coherent with its stated purpose (querying a MySQL store's orders and generating reports); no unexplained network endpoints or unrelated credentials are requested — but it will collect and store database credentials locally in plain JSON and requires installing the mysql2 dependency.
评估建议
This skill appears to do exactly what it says: connect to a MySQL database, query orders, and produce an analysis report. Before installing/using it, consider the following: (1) You will be asked to provide database credentials; avoid using root or high-privilege accounts — create a dedicated read-only account limited to the Order and OrderItems tables. (2) The credentials and query results are stored as plain JSON under ~/openclaw-skill-data/store-order-query/ (unencrypted). If that is sensitiv...
详细分析 ▾
用途与能力
The name/description (query store orders) matches the included code and runtime instructions: the skill reads a local config, connects to MySQL, queries Order and OrderItems tables, saves results, and generates a Markdown report. There are no unrelated environment variables, binaries, or external services requested.
指令范围
SKILL.md stays within scope: it tells the agent to check for ~/openclaw-skill-data/store-order-query/config.json, prompt the user for DB connection details if missing, run node scripts to query and analyze, and present the generated report. Note: it explicitly requires the agent to collect sensitive DB credentials from the user and to write them to a local config.json — this is necessary for the stated function but is sensitive and should be done with caution.
安装机制
There is no automated install spec (instruction-only), but package.json declares a dependency on mysql2 and README/SKILL.md instructs running pnpm install. Installing npm packages from the public registry is expected for Node skills but does carry the usual supply-chain/network risk; no unusual download URLs or extract-from-remote artifacts are present.
凭证需求
The skill requests no platform env vars, which is proportional. It does require the user to provide DB credentials (host, port, database, user, password) and stores them in ~/openclaw-skill-data/store-order-query/config.json in plaintext — functional but sensitive. A safer deployment would use a read-only DB account or secrets management rather than storing root/high-privilege credentials in plain JSON.
持久化与权限
The skill does not request always:true and does not modify other skills or global agent config. It writes files under the user's home directory (creates ~/openclaw-skill-data/store-order-query/), which is expected for its purpose but means persistent local storage of queried data and credentials.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/3/24

Initial release of store-order-query skill. - Allows querying store order information from a MySQL database. - Supports flexible queries by time range and analysis dimension (order count, revenue, items, payment methods). - Includes setup workflow for database configuration. - Generates analytical reports in Markdown format based on order data. - Handles error cases for missing configuration, database errors, and empty results.

● 无害

安装命令 点击复制

官方npx clawhub@latest install store-order-query
镜像加速npx clawhub@latest install store-order-query --registry https://cn.clawhub-mirror.com

技能文档

技能描述

这是一个通过连接MySQL数据库查询店铺订单的 Skill。当用户询问店铺订单情况时(如"查询今天店铺订单"、"今天的订单怎么样"、"店铺经营情况"),使用此 Skill 连接数据库查询订单数据,并生成分析报告。

使用场景

  • 用户想查询特定时间段的订单数据
  • 用户想了解店铺经营状况
  • 用户想分析订单中的商品销售情况
  • 用户想查看支付方式分布

工作流程

step1. 检查配置文件

首先检查是否存在数据库配置文件 ~/openclaw-skill-data/store-order-query/config.json

如果配置文件不存在,需要询问用户以下信息:

  • MySQL数据库主机地址
  • 数据库端口(默认3306)
  • 数据库名称
  • 数据库用户名
  • 数据库密码

然后基于 config.example.json 创建 config.json 文件。

step2. 解析用户查询意图

从用户的查询中提取:

  • 时间范围: 今天、昨天、最近7天、最近30天等
  • 查询维度: 订单量、金额、商品、支付方式等

如果用户说"今天",则查询当天的订单数据。

step3. 执行查询脚本

调用以下命令查询订单数据,传递参数:

  • --日期-range: 时间范围 (today/yesterday/last7days/last30days 或 custom)
  • --开始-日期: 开始日期 (YYYY-MM-DD 格式,可选)
  • --end-日期: 结束日期 (YYYY-MM-DD 格式,可选)
node dist/index.js --date-range today

脚本会:

  • 读取配置文件连接MySQL数据库
  • 查询Order表获取订单数据
  • 根据订单号查询OrderItems表获取商品信息
  • 将数据保存到 ~/openclaw-skill-data/store-order-查询/orders_data.json

step4. 分析数据并生成报告

调用以下命令分析订单数据并生成报告:

node dist/analyze-orders.js

脚本会:

  • 读取 ~/openclaw-skill-data/store-order-查询/orders_data.json
  • 进行数据分析(订单量、总金额、支付方式分布、商品分析等)
  • 生成 Markdown 格式的报告保存到 ~/openclaw-skill-data/store-order-查询/order_report.md

5. 呈现报告

读取生成的报告文件,向用户展示分析结果。

配置文件格式

~/openclaw-skill-data/store-order-query/config.json 示例:

{
  "database": {
    "type": "mysql",
    "host": "localhost",
    "port": 3306,
    "database": "shop_db",
    "user": "root",
    "password": "your_password"
  },
  "tables": {
    "orders": "Order",
    "order_items": "OrderItems"
  },
  "fields": {
    "orders": {
      "id": "orderSn",
      "created_at": "createdAt",
      "total_amount": "orderActualAmount",
      "payment_method": "payType",
      "status": "orderStatus"
    },
    "order_items": {
      "order_id": "orderSn",
      "product_name": "name",
      "sku": "sku",
      "quantity": "counts",
      "price": "actualPrice"
    }
  }
}

数据库表结构

Order 表(订单表)

字段类型说明
orderSnVARCHAR(50)订单号(主键)
createdAtDATETIME创建时间
orderActualAmountDECIMAL(10,2)订单实际金额
payTypeVARCHAR(50)支付方式
orderStatusVARCHAR(20)订单状态

OrderItems 表(订单商品表)

字段类型说明
idINT主键ID
orderSnVARCHAR(50)订单号(外键)
nameVARCHAR(200)商品名称
skuVARCHAR(100)SKU
countsINT数量
actualPriceDECIMAL(10,2)实际价格

注意事项

  • 确保已在根目录安装依赖:pnpm install
  • 配置文件包含敏感信息,不要将其提交到公共仓库
  • 首次使用时需要配置数据库信息
  • 确保MySQL数据库用户有读取Order和OrderItems表的权限
  • 生成的报告会保存在 输出 目录中,可以重复查看

错误处理

  • 如果数据库连接失败,提示用户检查配置信息
  • 如果查询结果为空,提示用户该时间段没有订单数据
  • 如果表或字段不存在,提示用户检查配置文件中的字段映射
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务