Files
ewoooc/n8n-workflows/09-weekly-sales-summary.json
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

34 lines
2.2 KiB
JSON

{
"name": "每週業績摘要",
"nodes": [
{
"parameters": { "rule": { "interval": [{ "field": "cronExpression", "expression": "0 9 * * 1" }] } },
"id": "schedule", "name": "每週一 9:00", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1.1, "position": [0, 0]
},
{
"parameters": { "url": "http://192.168.0.110:5001/api/weekly_summary", "options": { "timeout": 30000 } },
"id": "http-sales", "name": "取得週業績", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [220, 0]
},
{
"parameters": {
"jsCode": "const data = $input.first().json;\nconst summary = data.summary || data;\n\nconst weekStart = summary.week_start || 'N/A';\nconst weekEnd = summary.week_end || 'N/A';\nconst totalSales = summary.total_sales || 0;\nconst orderCount = summary.order_count || 0;\nconst growthRate = summary.growth_rate || 0;\n\n// 格式化金額\nconst formattedSales = totalSales.toLocaleString('zh-TW');\n\nconst text = '📊 *每週業績摘要*\\n\\n' +\n '📅 週期: ' + weekStart + ' ~ ' + weekEnd + '\\n' +\n '💰 總業績: $' + formattedSales + '\\n' +\n '📦 訂單數: ' + orderCount + '\\n' +\n '📈 成長率: ' + growthRate + '%\\n\\n' +\n '詳細報表請登入系統查看';\n\nreturn [{ json: { telegramBody: { chat_id: '5619078117', text: text, parse_mode: 'Markdown' } } }];"
},
"id": "code", "name": "整理資料", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [440, 0]
},
{
"parameters": {
"method": "POST", "url": "https://api.telegram.org/bot8075645931:AAH-EGKMo8ZC4QJs-Nc1_0s92xHrGdQvdpg/sendMessage",
"sendBody": true, "specifyBody": "json",
"jsonBody": "={{ JSON.stringify($json.telegramBody) }}"
},
"id": "telegram", "name": "發送摘要", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, "position": [660, 0]
}
],
"connections": {
"每週一 9:00": { "main": [[{ "node": "取得週業績", "type": "main", "index": 0 }]] },
"取得週業績": { "main": [[{ "node": "整理資料", "type": "main", "index": 0 }]] },
"整理資料": { "main": [[{ "node": "發送摘要", "type": "main", "index": 0 }]] }
},
"settings": { "executionOrder": "v1" }
}