- 新增许愿树页面(Canvas绘制、许愿条展示) - 新增许愿详情页面 - 新增许愿创建弹窗(免费/付费两种模式) - 新增网络请求封装 utils/request.js - 新增Go后端项目结构(Gin + Inertia.js) - 新增用户、订单、许愿数据模型 - 新增数据库迁移脚本 - 更新.gitignore补全忽略规则 - 更新.env.local配置(robot=2, 版本1.0.1) - 添加secrets目录说明文档
42 lines
1.7 KiB
Go
42 lines
1.7 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"`
|
|
MaxWishes int `gorm:"default:100" json:"maxWishes"` // 最大许愿条数
|
|
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"`
|
|
}
|