@clawhub-luoyalab-d8497491aa
Query the X2C personal dashboard to get real-time KPI data, earnings trends, platform views, recent transactions, and earning projects. Use this skill whenev...
---
name: x2c-real-dashboard
description: Query the X2C personal dashboard to get real-time KPI data, earnings trends, platform views, recent transactions, and earning projects. Use this skill whenever the user asks about their X2C income, revenue, ROI, mining status, today's/yesterday's/monthly earnings, platform performance, recent activity, or project list.
metadata: {"openclaw":{"emoji":"📊","requires":{"env":["X2C_API_KEY"]},"primaryEnv":"X2C_API_KEY"}}
---
# x2c-real-dashboard
Real-time X2C personal dashboard data via Open API.
All scripts are in `{baseDir}/scripts/`. They read `X2C_API_KEY` from the environment.
---
## Actions & Scripts
### 总览 KPI — overview
Use when the user asks: "今天赚了多少", "收益概况", "ROI", "挖矿状态", "项目总数", "播放量"
```bash
bash {baseDir}/scripts/overview.sh
```
Returns: today/yesterday/monthly/historical revenue (USD + X2C), ROI, mining status, project counts, total views, X2C price.
---
### 收益趋势 — trend
Use when the user asks: "最近 N 天趋势", "收益走势", "历史收入图"
```bash
bash {baseDir}/scripts/trend.sh [DAYS]
# DAYS: 1–90, default 7
```
Returns: daily `{ date, x2c, usd }` array sorted ascending.
---
### 各平台播放量 — platform-breakdown
Use when the user asks: "哪个平台表现最好", "各平台播放量", "TikTok / YouTube 数据"
```bash
bash {baseDir}/scripts/platform-breakdown.sh
```
Returns: total views + per-platform breakdown sorted descending.
---
### 最近动态 — recent-activity
Use when the user asks: "最近的交易", "收入记录", "挖矿记录", "最近动态"
```bash
bash {baseDir}/scripts/recent-activity.sh [LIMIT]
# LIMIT: 1–50, default 5
```
Returns: recent transactions with `tx_type`, `amount`, `currency`, `title`, `transaction_at`.
tx_type values: `mining_income` | `x2c_release` | `commission` | `referral` | `royalty` | `production` | `production_refund`
---
### 赚钱作品列表 — earning-projects
Use when the user asks: "我的作品", "哪个作品赚最多", "作品收益排名", "项目列表"
```bash
bash {baseDir}/scripts/earning-projects.sh [PAGE] [PAGE_SIZE]
# PAGE default 1, PAGE_SIZE default 10, max 50
```
Returns: paginated project list with `today_usd`, `total_usd`, `total_views`, `trend7d`, `platform_views`.
---
## Formulas (for context)
```
today_usd = today_x2c × x2c_price + today_commission
roi_percent = historical_usd / net_expense_usd × 100
net_expense = max(0, spending_credits - refund_credits) / 100
vs_yesterday % = (today - yesterday) / yesterday × 100
```
All date boundaries are **UTC**. Daily payouts run at ~00:10 UTC.
## Error Handling
All scripts exit non-zero on failure and print `{"success":false,"error":"..."}`.
Always check `success: true` before presenting results.
FILE:README.md
# x2c-real-dashboard — X2C 个人数据看板
X2C 平台个人中心「总览」页的实时数据查询工具,与前端 `useDashboardData` Hook 数据口径 100% 一致。
## 功能
- 📈 **总览 KPI** — 历史/月/今/昨收入、ROI、挖矿状态、项目数、播放量
- 📊 **收益趋势** — 近 1–90 日按日聚合的 X2C + 法币收入
- 🌍 **平台播放量** — TikTok / YouTube / Instagram / Twitter / Facebook 分平台数据
- 💰 **最近动态** — 财务交易记录(X2C 释放、挖矿、佣金等)
- 🎬 **赚钱作品** — 分页列表,含每项 7 日趋势与各平台播放量
## 安装
```bash
# 安装到共享 skills 目录(所有 agent 可用)
unzip x2c-real-dashboard.skill -d ~/.openclaw/skills/
# 或安装到当前 workspace(仅当前 agent)
unzip x2c-real-dashboard.skill -d ./skills/
```
## 配置 API Key
在 `~/.openclaw/openclaw.json` 中添加:
```json
{
"skills": {
"entries": {
"x2c-real-dashboard": {
"enabled": true,
"apiKey": "x2c_sk_YOUR_KEY_HERE"
}
}
}
}
```
或通过环境变量:
```bash
export X2C_API_KEY=x2c_sk_YOUR_KEY_HERE
```
## 示例对话
- "今天赚了多少?"
- "最近 14 天的收益趋势"
- "哪个平台播放量最高?"
- "显示最近 10 条交易记录"
- "我有哪些作品在赚钱?"
## Scripts
| 脚本 | 功能 | 参数 |
|---|---|---|
| `scripts/overview.sh` | 总览 KPI | 无 |
| `scripts/trend.sh` | 收益趋势 | `[DAYS]` 1–90,默认 7 |
| `scripts/platform-breakdown.sh` | 平台播放量 | 无 |
| `scripts/recent-activity.sh` | 最近动态 | `[LIMIT]` 1–50,默认 5 |
| `scripts/earning-projects.sh` | 赚钱作品 | `[PAGE] [PAGE_SIZE]` 默认 1 10 |
## 数据说明
- 所有日期边界为 **UTC**,每日 00:10 UTC 出账
- 轮询建议间隔 ≥ 30 秒
- `trend7d` 第一个元素为 6 天前,最后一个为今天
FILE:config.json
{
"api_url": "https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api",
"default_trend_days": 7,
"default_activity_limit": 5,
"default_page_size": 10
}
FILE:scripts/overview.sh
#!/bin/bash
# dashboard/overview — 总览 KPI
# Usage: bash overview.sh
# Requires: X2C_API_KEY env var
set -euo pipefail
API_URL="https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api"
API_KEY="-"
if [ -z "$API_KEY" ]; then
echo '{"success":false,"error":"X2C_API_KEY is not set"}' >&2
exit 1
fi
curl -sS -X POST "$API_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"action":"dashboard/overview"}'
FILE:scripts/recent-activity.sh
#!/bin/bash
# dashboard/recent-activity — 最近动态
# Usage: bash recent-activity.sh [LIMIT]
# LIMIT: 1–50, default 5
# Requires: X2C_API_KEY env var
set -euo pipefail
API_URL="https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api"
API_KEY="-"
LIMIT="-5"
if [ -z "$API_KEY" ]; then
echo '{"success":false,"error":"X2C_API_KEY is not set"}' >&2
exit 1
fi
if ! [[ "$LIMIT" =~ ^[0-9]+$ ]] || [ "$LIMIT" -lt 1 ] || [ "$LIMIT" -gt 50 ]; then
echo '{"success":false,"error":"LIMIT must be between 1 and 50"}' >&2
exit 1
fi
curl -sS -X POST "$API_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"action\":\"dashboard/recent-activity\",\"limit\":$LIMIT}"
FILE:scripts/trend.sh
#!/bin/bash
# dashboard/trend — 收益趋势
# Usage: bash trend.sh [DAYS]
# DAYS: 1–90, default 7
# Requires: X2C_API_KEY env var
set -euo pipefail
API_URL="https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api"
API_KEY="-"
DAYS="-7"
if [ -z "$API_KEY" ]; then
echo '{"success":false,"error":"X2C_API_KEY is not set"}' >&2
exit 1
fi
if ! [[ "$DAYS" =~ ^[0-9]+$ ]] || [ "$DAYS" -lt 1 ] || [ "$DAYS" -gt 90 ]; then
echo '{"success":false,"error":"DAYS must be between 1 and 90"}' >&2
exit 1
fi
curl -sS -X POST "$API_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"action\":\"dashboard/trend\",\"days\":$DAYS}"
FILE:scripts/earning-projects.sh
#!/bin/bash
# dashboard/earning-projects — 赚钱作品列表
# Usage: bash earning-projects.sh [PAGE] [PAGE_SIZE]
# PAGE default 1, PAGE_SIZE default 10 (max 50)
# Requires: X2C_API_KEY env var
set -euo pipefail
API_URL="https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api"
API_KEY="-"
PAGE="-1"
PAGE_SIZE="-10"
if [ -z "$API_KEY" ]; then
echo '{"success":false,"error":"X2C_API_KEY is not set"}' >&2
exit 1
fi
if ! [[ "$PAGE" =~ ^[0-9]+$ ]] || [ "$PAGE" -lt 1 ]; then
echo '{"success":false,"error":"PAGE must be >= 1"}' >&2
exit 1
fi
if ! [[ "$PAGE_SIZE" =~ ^[0-9]+$ ]] || [ "$PAGE_SIZE" -lt 1 ] || [ "$PAGE_SIZE" -gt 50 ]; then
echo '{"success":false,"error":"PAGE_SIZE must be between 1 and 50"}' >&2
exit 1
fi
curl -sS -X POST "$API_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"action\":\"dashboard/earning-projects\",\"page\":$PAGE,\"page_size\":$PAGE_SIZE}"
FILE:scripts/platform-breakdown.sh
#!/bin/bash
# dashboard/platform-breakdown — 各平台播放量
# Usage: bash platform-breakdown.sh
# Requires: X2C_API_KEY env var
set -euo pipefail
API_URL="https://eumfmgwxwjyagsvqloac.supabase.co/functions/v1/open-api"
API_KEY="-"
if [ -z "$API_KEY" ]; then
echo '{"success":false,"error":"X2C_API_KEY is not set"}' >&2
exit 1
fi
curl -sS -X POST "$API_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"action":"dashboard/platform-breakdown"}'