v2.1.0 流程改造 + 农历准确性修复 + 双向同步 + 闰月支持
部署到群晖 / deploy (push) Successful in 44s

- Phase 1: 添加纪念日合并人物创建流程(方案 B)
- Phase 2: 农历提醒按 lunarMonth/Day 计算每年公历
- Phase 3: 人员数据同步到后端(新增 /api/person)
- Phase 4: 新设备启动从云端恢复数据
- Phase 5: 工具函数收敛 utils/format.js
- Phase 6: 同步失败入队 + 启动重试
- Phase 7: 闰月生日完整支持(含 isLeapMonth + UI 警示)
- 修复 lunarInfo 数据表错位(替换为权威源 jjonline/calendar.js)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yuming
2026-06-02 05:51:17 +08:00
parent 06d22884b9
commit ddcfe3334e
16 changed files with 1001 additions and 167 deletions
+21 -13
View File
@@ -1,4 +1,6 @@
const api = require('./utils/api')
const storage = require('./utils/storage')
const sync = require('./utils/sync')
App({
onLaunch() {
@@ -20,20 +22,26 @@ App({
// 获取 openid:调自建后端 /api/login
async getUserOpenId() {
// 已缓存就直接复用,避免每次启动都登录
const cached = wx.getStorageSync('openid')
if (cached) {
this.globalData.openid = cached
return
}
try {
const res = await api.login()
this.globalData.openid = res.openid
wx.setStorageSync('openid', res.openid)
console.log('获取openid成功:', res.openid)
} catch (err) {
console.error('获取openid失败:', err)
let openid = wx.getStorageSync('openid')
if (!openid) {
try {
const res = await api.login()
openid = res.openid
wx.setStorageSync('openid', openid)
console.log('获取openid成功:', openid)
} catch (err) {
console.error('获取openid失败:', err)
return
}
}
this.globalData.openid = openid
// 拿到 openid 后,本地无数据时从云端拉一次(新设备/重装恢复场景)
const pulled = await storage.pullFromCloudIfEmpty()
if (pulled) console.log('已从云端恢复数据')
// flush 之前同步失败的待重试队列
sync.flush()
},
globalData: {