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
25 lines
1.2 KiB
Go
25 lines
1.2 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
type MarketingTemplate struct {
|
|
ID uint `json:"id" gorm:"primaryKey;comment:主键ID"`
|
|
CategoryID uint `json:"category_id" gorm:"not null;index;comment:所属分类ID"`
|
|
Title string `json:"title" gorm:"size:100;not null;comment:模板名称"`
|
|
ImageURL string `json:"image_url" gorm:"size:500;not null;comment:模板图片URL"`
|
|
ThumbnailURL string `json:"thumbnail_url" gorm:"size:500;comment:缩略图URL"`
|
|
Width int `json:"width" gorm:"default:0;comment:图片宽度px"`
|
|
Height int `json:"height" gorm:"default:0;comment:图片高度px"`
|
|
SortOrder int `json:"sort_order" gorm:"default:0;comment:排序权重(越大越靠前)"`
|
|
Status int `json:"status" gorm:"default:1;index;comment:状态(1=启用,0=禁用)"`
|
|
DownloadCount int `json:"download_count" gorm:"default:0;comment:下载次数"`
|
|
CreatedAt time.Time `json:"created_at" gorm:"comment:创建时间"`
|
|
UpdatedAt time.Time `json:"updated_at" gorm:"comment:更新时间"`
|
|
|
|
Category *MarketingCategory `json:"category,omitempty" gorm:"foreignKey:CategoryID"`
|
|
}
|
|
|
|
func (MarketingTemplate) TableName() string {
|
|
return "marketing_templates"
|
|
}
|