- 八字页:未绑定生辰时展示虚构示例排盘(1990-08-08 10:30男)与15条字段说明, 附传统文化声明文案;已绑定时支持多档案切换,排盘增强(十神/藏干/纳音/五行配色/命盘概览) - 个人中心:新增生辰管理卡片,每用户免费绑定3个出生年月;登录改为真实微信登录 - 服务端:新增 BirthProfile 模型与 /api/user/birth-profiles 增删查接口,AutoMigrate 建表 - 前端:新增 birth-profile.js 本地存储优先+登录后云端双向同步 - 修复:个人中心 tabBar 页面入口误用 navigateTo 改为 switchTab
50 lines
2.0 KiB
Go
50 lines
2.0 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// User 用户模型
|
|
type User struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
OpenID string `gorm:"uniqueIndex;size:64" json:"openId"`
|
|
UnionID string `gorm:"size:64" json:"unionId"`
|
|
Nickname string `gorm:"size:64" json:"nickname"`
|
|
Avatar string `gorm:"size:255" json:"avatar"`
|
|
Gender int `gorm:"default:0" json:"gender"` // 0:未知 1:男 2:女
|
|
Phone string `gorm:"size:20" json:"phone"`
|
|
Email string `gorm:"size:100" json:"email"`
|
|
Status int `gorm:"default:1" json:"status"` // 1:正常 0:禁用
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// UserProfile 用户资料扩展
|
|
type UserProfile struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
UserID uint `gorm:"index" json:"userId"`
|
|
RealName string `gorm:"size:32" json:"realName"`
|
|
Birthday string `gorm:"size:10" json:"birthday"` // YYYY-MM-DD
|
|
BirthTime string `gorm:"size:8" json:"birthTime"` // HH:mm:ss
|
|
Gender int `gorm:"default:0" json:"gender"`
|
|
Zodiac string `gorm:"size:10" json:"zodiac"` // 生肖
|
|
Constellation string `gorm:"size:20" json:"constellation"` // 星座
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// MaxFreeBirthProfiles 每个用户可免费绑定的生辰数量上限
|
|
const MaxFreeBirthProfiles = 3
|
|
|
|
// BirthProfile 用户生辰档案(八字绑定),每个用户最多免费绑定 MaxFreeBirthProfiles 个
|
|
type BirthProfile struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
UserID uint `gorm:"index" json:"userId"`
|
|
Name string `gorm:"size:32" json:"name"` // 备注名(如本人、家人等)
|
|
Gender int `gorm:"default:1" json:"gender"` // 1:男 2:女
|
|
Birthday string `gorm:"size:10" json:"birthday"` // YYYY-MM-DD
|
|
BirthTime string `gorm:"size:8" json:"birthTime"` // HH:mm
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|