1. 背景图 aspectFill 撑满全屏,挂载点坐标按裁剪比例重算,便签不再落在图外 2. 写下心愿按钮单行不换行,缩小尺寸 3. 移除页面内许愿树标题/数量/最近心愿,点击便签弹出便签式详情卡 4. 默认请求100条:最新50条挂树,其余以弹幕形式缓缓飘过 5. MAKE A WISH 下方增加顶级位置轮播(购买后24小时内展示),点击弹出金色便签详情,与普通便签区分 6. 多棵树分屏轮播(swiper),背景图从服务器获取,带指示点 7. 后端:WishTree新增image字段,Wish新增isTop运行时标记,图片用go:embed内嵌随二进制部署,/images路由提供访问
46 lines
2.0 KiB
Go
46 lines
2.0 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"` // 是否机器人发布
|
|
IsTop bool `gorm:"-" json:"isTop"` // 是否顶级位置(运行时计算)
|
|
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:竹子
|
|
Image string `gorm:"size:255" json:"image"` // 背景图地址
|
|
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"`
|
|
}
|