Files
wxserver/utils/constants.js
T
yuming 756d57d818
部署到群晖 / deploy (push) Successful in 44s
简化纪念日类型:去掉"农历生日"类型,公历/农历改由 isLunar 字段决定
- typeList 从 5 项简化到 4 项:生日 / 结婚纪念日 / 订婚纪念日 / 其他纪念日
- TYPE_NAMES / TYPE_ICONS 中 lunar_birthday 保留兼容映射(也映射到「生日」+ 🎂),
  让线上历史数据自然回显,无需数据库迁移(方案 A)
- getTypeIndex('lunar_birthday') = 0,老数据编辑时正确回显「生日」
- index.js 列表筛选和 wxml 图标判断本来已含 lunar_birthday 兼容,无需改

老数据自然淘汰:用户重新保存时新数据写 type='birthday',老数据 type 保留
直到下次编辑保存才升级。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-02 07:30:37 +08:00

49 lines
883 B
JavaScript

/**
* 公共常量
*/
const ANNIVERSARY_TYPES = {
BIRTHDAY: 'birthday',
LUNAR_BIRTHDAY: 'lunar_birthday',
WEDDING: 'wedding',
ENGAGEMENT: 'engagement',
OTHER: 'other'
}
const TYPE_NAMES = {
birthday: '生日',
// lunar_birthday 已合并到 birthday(公历/农历由 isLunar 决定),保留映射用于兼容老数据回显
lunar_birthday: '生日',
wedding: '结婚纪念日',
engagement: '订婚纪念日',
other: '其他纪念日'
}
const TYPE_ICONS = {
birthday: '🎂',
lunar_birthday: '🎂',
wedding: '💍',
engagement: '💕',
other: '📅'
}
const IMPORTANCE_TEXTS = {
high: '非常重要',
medium: '重要',
low: '一般'
}
const IMPORTANCE_COLORS = {
high: '#ff5722',
medium: '#ff9800',
low: '#07c160'
}
module.exports = {
ANNIVERSARY_TYPES,
TYPE_NAMES,
TYPE_ICONS,
IMPORTANCE_TEXTS,
IMPORTANCE_COLORS
}