接入自建后端 + Gitea CI/CD
部署到群晖 / deploy (push) Failing after 6m22s

- 新增 server/:Node + Express + SQLite + node-cron 实现登录、纪念日 CRUD 和定时订阅消息推送
- 新增 .gitea/workflows/deploy.yml:推送即触发群晖 Docker 部署,监听 15002
- utils/api.js:自动按 envVersion 切换本地/线上 BASE_URL
- app.js 与 add-anniversary.js 移除 wx.cloud 调用,改走自建后端
- cloudfunctions/ 暂保留以便回滚
- 一并提交此前未入库的首页 / 设置页 / 日历 / 万年历等改造

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-06-01 15:44:09 +08:00
parent 6747ade9c4
commit 3965e542fc
49 changed files with 5616 additions and 670 deletions
+51
View File
@@ -0,0 +1,51 @@
const Database = require('better-sqlite3')
const path = require('path')
const fs = require('fs')
const dbPath = process.env.DB_PATH || path.join(__dirname, '..', 'data', 'birthday.db')
// 确保数据目录存在
const dir = path.dirname(dbPath)
if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true })
const db = new Database(dbPath)
db.pragma('journal_mode = WAL')
// 纪念日表:兼容原云数据库 anniversaries 集合字段
db.exec(`
CREATE TABLE IF NOT EXISTS anniversaries (
id TEXT PRIMARY KEY,
openid TEXT NOT NULL,
personId TEXT,
personName TEXT,
type TEXT,
customTypeName TEXT,
isLunar INTEGER DEFAULT 0,
solarYear INTEGER,
solarMonth INTEGER,
solarDay INTEGER,
importance TEXT,
remindEnabled INTEGER DEFAULT 0,
remindDays INTEGER DEFAULT 0,
remark TEXT,
createTime INTEGER,
updateTime INTEGER
);
CREATE INDEX IF NOT EXISTS idx_anniv_openid ON anniversaries(openid);
CREATE INDEX IF NOT EXISTS idx_anniv_remind ON anniversaries(remindEnabled);
CREATE TABLE IF NOT EXISTS remind_logs (
id INTEGER PRIMARY KEY AUTOINCREMENT,
anniversaryId TEXT,
personName TEXT,
typeName TEXT,
daysUntil INTEGER,
sendDate INTEGER,
status TEXT,
error TEXT
);
CREATE INDEX IF NOT EXISTS idx_log_anniv ON remind_logs(anniversaryId);
CREATE INDEX IF NOT EXISTS idx_log_date ON remind_logs(sendDate);
`)
module.exports = db