ac49e1458c
- 新增 marketing 模块:model/repository/service/handler 四层架构 - 数据模型:marketing_categories、marketing_templates、marketing_user_downloads - 小程序端接口:分类列表、模板列表/详情、下载记录、广告回调 - 管理后台接口:分类/模板 CRUD、下载统计(X-Admin-Token 鉴权) - 路由注册:接入现有 AuthMiddleware,新增 AdminTokenMiddleware - Web 管理后台:单页面 Vue3 + Element Plus(分类管理、模板管理、数据概览) Closes #37, #38, #39, #40 Made-with: Cursor
23 lines
1.0 KiB
Go
23 lines
1.0 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type MarketingDownload struct {
|
|
ID uint `json:"id" gorm:"primaryKey;comment:主键ID"`
|
|
UserID uint `json:"user_id" gorm:"not null;index;comment:用户ID"`
|
|
TemplateID uint `json:"template_id" gorm:"not null;index;comment:模板ID"`
|
|
LogoURL string `json:"logo_url" gorm:"size:500;comment:用户Logo地址"`
|
|
LogoX float64 `json:"logo_x" gorm:"comment:Logo X坐标(相对比例)"`
|
|
LogoY float64 `json:"logo_y" gorm:"comment:Logo Y坐标(相对比例)"`
|
|
LogoW float64 `json:"logo_w" gorm:"comment:Logo 宽度(相对比例)"`
|
|
LogoH float64 `json:"logo_h" gorm:"comment:Logo 高度(相对比例)"`
|
|
AdCompleted bool `json:"ad_completed" gorm:"default:false;comment:是否已观看广告"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"comment:创建时间"`
|
|
|
|
Template *MarketingTemplate `json:"template,omitempty" gorm:"foreignKey:TemplateID"`
|
|
}
|
|
|
|
func (MarketingDownload) TableName() string {
|
|
return "marketing_user_downloads"
|
|
}
|