Files
hunli/hunliji-api/models/models.go
2026-08-03 16:00:13 +08:00

136 lines
7.9 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "time"
type TemplateConfig struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
// 旧版 MySQL 的 JSON 列不能带 DEFAULT空值由业务层回落为 {}
ConfigData string `gorm:"type:json;column:config_data;not null;comment:请柬配置JSON" json:"config_data"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (TemplateConfig) TableName() string { return "template_configs" }
type PosterConfig struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
ConfigData string `gorm:"type:json;column:config_data;not null;comment:海报配置JSON" json:"config_data"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (PosterConfig) TableName() string { return "poster_configs" }
type UploadConfig struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
Provider string `gorm:"column:provider;size:20;not null;default:local;comment:上传方式 local|oss" json:"provider"`
AccessKeyID string `gorm:"column:access_key_id;size:255;not null;default:'';comment:OSS AccessKeyId" json:"accessKeyId"`
AccessKeySecret string `gorm:"column:access_key_secret;type:text;comment:OSS AccessKeySecret" json:"-"`
Bucket string `gorm:"column:bucket;size:255;not null;default:'';comment:OSS Bucket" json:"bucket"`
Folder string `gorm:"column:folder;size:255;not null;default:'';comment:上传目录前缀" json:"folder"`
Domain string `gorm:"column:domain;size:255;not null;default:'';comment:访问域名" json:"domain"`
Region string `gorm:"column:region;size:100;not null;default:'';comment:OSS Region" json:"region"`
Endpoint string `gorm:"column:endpoint;size:255;not null;default:'';comment:OSS Endpoint" json:"endpoint"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (UploadConfig) TableName() string { return "upload_configs" }
// MediaAsset 已上传图片资源(图库选图)
type MediaAsset struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
// url 索引长度受 InnoDB utf8mb4 限制≤768 字符),过长会导致建表失败
URL string `gorm:"column:url;size:768;not null;index;comment:访问地址" json:"url"`
Name string `gorm:"column:name;size:255;not null;default:'';comment:原始文件名" json:"name"`
Provider string `gorm:"column:provider;size:20;not null;default:local;comment:来源 local|oss" json:"provider"`
CreatedAt time.Time `gorm:"column:created_at;not null;index;comment:上传时间" json:"created_at"`
}
func (MediaAsset) TableName() string { return "media_assets" }
type Rsvp struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
Name string `gorm:"column:name;size:50;not null;default:'';comment:宾客姓名" json:"name"`
GuestCount string `gorm:"column:guest_count;size:20;not null;default:1;comment:出席人数标识" json:"guest_count"`
Wishes string `gorm:"column:wishes;type:text;comment:祝福语" json:"wishes"`
CreatedAt time.Time `gorm:"column:created_at;not null;comment:提交时间" json:"created_at"`
}
func (Rsvp) TableName() string { return "rsvps" }
type Danmaku struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
Name string `gorm:"column:name;size:50;not null;default:'';comment:发送者姓名" json:"name"`
Content string `gorm:"column:content;type:text;not null;comment:祝福内容" json:"content"`
Color string `gorm:"column:color;size:32;not null;default:champagne;comment:弹幕颜色key" json:"color"`
Source string `gorm:"column:source;size:20;not null;default:danmaku;comment:来源 danmaku|rsvp" json:"source"`
RsvpID *uint `gorm:"column:rsvp_id;comment:关联回执ID" json:"rsvp_id"`
Status string `gorm:"column:status;size:20;not null;default:pending;index;comment:审核状态 pending|approved|rejected" json:"status"`
CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"`
}
func (Danmaku) TableName() string { return "danmakus" }
type SiteLike struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
ClientID string `gorm:"column:client_id;size:64;not null;default:'';index;comment:客户端标识" json:"client_id"`
CreatedAt time.Time `gorm:"column:created_at;not null;comment:点赞时间" json:"created_at"`
}
func (SiteLike) TableName() string { return "site_likes" }
// SiteGift 站点礼物记录
type SiteGift struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
GiftType string `gorm:"column:gift_type;size:32;not null;index;comment:礼物类型" json:"gift_type"`
Name string `gorm:"column:name;size:50;not null;default:'';comment:送礼人姓名" json:"name"`
ClientID string `gorm:"column:client_id;size:64;not null;default:'';index;comment:客户端标识" json:"client_id"`
Cost int64 `gorm:"column:cost;not null;default:0;comment:兑换消耗的点赞数" json:"cost"`
CreatedAt time.Time `gorm:"column:created_at;not null;comment:送礼时间" json:"created_at"`
}
func (SiteGift) TableName() string { return "site_gifts" }
// GiftConfig 礼物兑换配置(各礼物所需点赞数)
type GiftConfig struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
CostsData string `gorm:"type:json;column:costs_data;not null;comment:礼物代价JSON map" json:"costs_data"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (GiftConfig) TableName() string { return "gift_configs" }
// AiModerationCache 缓存 AI 审核通过/失败结果
type AiModerationCache struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
Content string `gorm:"column:content;type:text;not null;comment:姓名+祝福原文" json:"content"`
ContentHash string `gorm:"column:content_hash;size:64;not null;index:idx_ai_mod_type_hash,priority:2;comment:content的SHA256" json:"content_hash"`
Type string `gorm:"column:type;size:20;not null;index:idx_ai_mod_type_hash,priority:1;comment:类型 danmaku|rsvp" json:"type"`
Status string `gorm:"column:status;size:20;not null;default:rejected;comment:审核状态 approved|rejected" json:"status"`
Reason string `gorm:"column:reason;size:255;not null;default:'';comment:拒绝原因" json:"reason"`
CreatedAt time.Time `gorm:"column:created_at;not null;comment:创建时间" json:"created_at"`
}
func (AiModerationCache) TableName() string { return "ai_moderation_caches" }
// CashGift 礼金记录
type CashGift struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
Name string `gorm:"column:name;size:50;not null;default:'';index;comment:宾客姓名" json:"name"`
Amount int `gorm:"column:amount;not null;default:0;comment:礼金金额(元)" json:"amount"`
Note string `gorm:"column:note;size:255;not null;default:'';comment:备注" json:"note"`
CreatedAt time.Time `gorm:"column:created_at;not null;index;comment:登记时间" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (CashGift) TableName() string { return "cash_gifts" }
// CashGiftConfig 礼金备注快捷选项等配置
type CashGiftConfig struct {
ID uint `gorm:"primaryKey;comment:主键ID" json:"id"`
NotesData string `gorm:"type:json;column:notes_data;not null;comment:备注快捷选项JSON数组" json:"notes_data"`
ViewPass string `gorm:"column:view_pass;size:64;not null;default:'';comment:前台查看全部口令" json:"view_pass"`
EntryPass string `gorm:"column:entry_pass;size:64;not null;default:'';comment:前台记账登记口令" json:"entry_pass"`
UpdatedAt time.Time `gorm:"column:updated_at;comment:更新时间" json:"updated_at"`
}
func (CashGiftConfig) TableName() string { return "cash_gift_configs" }