feat: add ads/sponsor/captcha modules and polish home & chat UI

This commit is contained in:
2026-09-23 04:39:58 +08:00
parent 96314893bb
commit c1f6a6636b
27 changed files with 4278 additions and 121 deletions

44
backend/model/ad.go Normal file
View File

@@ -0,0 +1,44 @@
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:"-"`
}