Build and Deploy Server / build (push) Failing after 2s
- 前端:全屏Canvas场景,夜空/云朵/草地/大树 - 前端:丝带系统,支持陀螺仪和麦克风交互 - 前端:弹幕许愿展示 - 前端:多棵树切换(祈福树/姻缘树/事业树) - 后端:新增GET /api/wish/trees获取树列表 - 后端:新增GET /api/wish/tree/:id/wishes获取树许愿 - 后端:WishTree模型新增Type、Sort字段 - 后端:AutoMigrate自动处理表结构变更 - 后端:seedDefaultData自动初始化默认数据 - 数据库:wish_trees表新增type、sort字段
44 lines
1.9 KiB
Go
44 lines
1.9 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Wish 许愿模型
|
|
type Wish struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
UserID uint `gorm:"index" json:"userId"`
|
|
TreeID uint `gorm:"index" json:"treeId"` // 许愿树ID
|
|
Content string `gorm:"size:500" json:"content"` // 许愿内容
|
|
Type string `gorm:"size:20;default:'free'" json:"type"` // free:免费 paid:付费
|
|
Position int `gorm:"default:0" json:"position"` // 位置(用于排序/覆盖)
|
|
Status int `gorm:"default:1" json:"status"` // 1:正常 0:隐藏/删除
|
|
IsRobot bool `gorm:"default:false" json:"isRobot"` // 是否机器人发布
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// WishTree 许愿树模型
|
|
type WishTree struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"size:50" json:"name"`
|
|
Description string `gorm:"size:255" json:"description"`
|
|
Type string `gorm:"size:20;default:'pine'" json:"type"` // pine:松树 sakura:樱花 bamboo:竹子
|
|
MaxWishes int `gorm:"default:100" json:"maxWishes"` // 最大许愿条数
|
|
Sort int `gorm:"default:0" json:"sort"` // 排序
|
|
Status int `gorm:"default:1" json:"status"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// WishProduct 许愿商品(付费许愿)
|
|
type WishProduct struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Name string `gorm:"size:50" json:"name"` // 商品名称
|
|
Description string `gorm:"size:255" json:"description"`
|
|
Price int `json:"price"` // 价格(分)
|
|
Duration int `json:"duration"` // 展示时长(天)
|
|
Position int `json:"position"` // 优先位置
|
|
Status int `gorm:"default:1" json:"status"`
|
|
}
|