ef172f4e4a
- Pet 增 personality/allergy/notes;建档表单加「性格标签(多选)/过敏/备注」 - IDCard 增 color/personality/owner/phone(脱敏)/allergy/notes/疫苗驱虫状态/发证机构 - 微信取手机号:POST /api/user/phone 用 getPhoneNumber 的 code 换手机号存库 (BindPhoneByCode 走 getuserphonenumber,复用 access_token) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
36 lines
1.9 KiB
Go
36 lines
1.9 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/datatypes"
|
|
)
|
|
|
|
// Pet 宠物,属于 User,支持多宠
|
|
type Pet struct {
|
|
Base
|
|
UserID string `gorm:"size:24;index" json:"user_id"`
|
|
Name string `gorm:"size:64" json:"name"`
|
|
Emoji string `gorm:"size:16" json:"emoji"`
|
|
AvatarFileID string `gorm:"size:24" json:"avatar_file_id"` // 关联 files 表:宠物照片
|
|
AvatarURL string `gorm:"-" json:"avatar_url"` // 计算字段:由 AvatarFileID 解析
|
|
Type string `gorm:"size:16" json:"type"` // 猫猫 / 狗狗
|
|
Gender string `gorm:"size:16" json:"gender"` // 男孩 / 女孩 / 不确定
|
|
Birthday *time.Time `json:"birthday"`
|
|
ArrivedAt *time.Time `json:"arrived_at"` // 到家日期。30 天内会额外叠加一套安置期任务
|
|
Weight string `gorm:"size:16" json:"weight"` // 如 "2.8kg"
|
|
Stage string `gorm:"size:32" json:"stage"` // 年龄阶段:幼年期 / 成年期 / 老年期(由生日推断,可手改)
|
|
// Age 计算字段,不入库。原来是建档时算好存下来的字符串,
|
|
// 养半年后首页还显示「2个月」—— 存一个会过期的展示值本身就是 bug
|
|
Age string `gorm:"-" json:"age"`
|
|
Color string `gorm:"size:32" json:"color"` // 毛色,如 橘白 / 奶牛
|
|
Breed string `gorm:"size:64" json:"breed"` // 品种
|
|
HealthStatus string `gorm:"size:16;default:正常" json:"health_status"`
|
|
Goals datatypes.JSON `json:"goals"` // onboarding 目标多选
|
|
|
|
// —— 身份卡用的补充信息 ——
|
|
Personality string `gorm:"size:64" json:"personality"` // 性格标签,逗号分隔,如 "活泼,亲人,贪吃"
|
|
Allergy string `gorm:"size:128" json:"allergy"` // 过敏情况,没有就填「无」
|
|
Notes string `gorm:"size:255" json:"notes"` // 备注信息(照护提醒)
|
|
}
|