Files
sundynix-pets/pets-be/internal/model/plan.go
T
Blizzard 609f7d06cf init: 毛孩子计划 小程序 + Go 后端 + 内嵌后台
- pets-fe: 微信原生小程序(首页/计划/记录/报告/社区/引导),
  服务端驱动、无假数据;弹层改用 scroll-view,打开时隐藏自定义 tabBar
- pets-be: Gin + GORM(MySQL, sundynix_ 前缀) + MinIO,统一响应/分页,
  微信 code2session 登录,provider-neutral AI(DeepSeek),go:embed React 后台
- 修复:分段选择类型不匹配(字符串 vs 数字)导致选不中

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-03 15:36:55 +08:00

42 lines
1.3 KiB
Go

package model
import (
"time"
"gorm.io/datatypes"
)
// 计划类型
const (
PlanThirtyDay = "thirty_day"
PlanAI = "ai"
)
// Plan 养宠计划(30 天路线图 / AI 计划)
type Plan struct {
Base
PetID uint `gorm:"index" json:"pet_id"`
UserID uint `gorm:"index" json:"user_id"`
Kind string `gorm:"size:16;index" json:"kind"` // thirty_day / ai
Stage string `gorm:"size:32" json:"stage"`
StartDate *time.Time `json:"start_date"`
EndDate *time.Time `json:"end_date"`
UserInput string `gorm:"size:512" json:"user_input"`
Extracted datatypes.JSON `json:"extracted"` // AI 提取信息
CompletionPct int `json:"completion_pct"`
Status string `gorm:"size:16;default:active" json:"status"` // active / completed / archived
Tasks []PlanTask `gorm:"foreignKey:PlanID" json:"tasks"`
}
// PlanTask 计划明细项
type PlanTask struct {
Base
PlanID uint `gorm:"index" json:"plan_id"`
Day int `json:"day"`
DayLabel string `gorm:"size:32" json:"day_label"`
Title string `gorm:"size:128" json:"title"`
Description string `gorm:"size:512" json:"description"`
SheetType string `gorm:"size:32" json:"sheet_type"`
Done bool `json:"done"`
}