新增: - 书库导入导出(library_import/library_export)及测试 - 图片变体生成(image_variants)与响应式图片(responsiveImage) - 书籍搜索(bookSearch)+ BookSearch/LibrarySearchGrid 组件 - 小组件运行时(widgetRuntime)与静态检查(widgetLint) - 上传缓存中间件(upload_cache)与字体 CSS 提取脚本 其它: - 后端 handlers/services 全量调整 - 前端页面、组件、库函数与配置更新
45 lines
1.8 KiB
Go
45 lines
1.8 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// 广告类型与状态
|
|
const (
|
|
AdKindImage = "image"
|
|
AdKindText = "text"
|
|
|
|
AdStatusPending = "pending"
|
|
AdStatusActive = "active"
|
|
AdStatusRejected = "rejected"
|
|
AdStatusExpired = "expired"
|
|
)
|
|
|
|
// Ad 赞助广告(游客可申购,管理员审核后展示于首页侧栏)
|
|
type Ad struct {
|
|
ID uint `gorm:"primaryKey" json:"id"`
|
|
Kind string `gorm:"size:16;not null;index" json:"kind"` // image | text
|
|
Status string `gorm:"size:16;not null;index" json:"status"` // pending/active/rejected/expired
|
|
ContactEmail string `gorm:"size:128;not null" json:"contact_email"`
|
|
LinkURL string `gorm:"size:512;not null" json:"link_url"`
|
|
ImageURL string `gorm:"size:512" json:"image_url"` // 图片广告
|
|
Title string `gorm:"size:64" json:"title"` // 文字广告
|
|
TextColor string `gorm:"size:16" json:"text_color"`
|
|
BgColor string `gorm:"size:16" json:"bg_color"`
|
|
DurationDays int `gorm:"not null" json:"duration_days"`
|
|
PaymentID string `gorm:"size:64;not null" json:"payment_id"`
|
|
BuyerNote string `gorm:"size:200" json:"buyer_note"`
|
|
StartsAt *time.Time `json:"starts_at"`
|
|
EndsAt *time.Time `json:"ends_at"`
|
|
RejectReason string `gorm:"size:200" json:"reject_reason"`
|
|
SortOrder int `gorm:"not null;default:0" json:"sort_order"`
|
|
SubmitIP string `gorm:"size:45" json:"-"`
|
|
ReviewedAt *time.Time `json:"reviewed_at"`
|
|
ReviewedBy *uint `json:"reviewed_by"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
}
|