1ad775be63
- Added comments to various fields in the database models for better clarity and understanding. - Implemented TableComment methods for several models to provide descriptive information about their purpose. - Updated the AutoMigrate function to support setting table comments in the database. - Improved overall documentation within the code to facilitate future maintenance and development.
53 lines
2.3 KiB
Go
53 lines
2.3 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type VideoParseLog struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
|
|
|
MiniProgramID uint `gorm:"index:idx_video_parse_user_date,priority:1;comment:小程序ID" json:"mini_program_id"`
|
|
UserID uint `gorm:"index:idx_video_parse_user_date,priority:2;comment:用户ID" json:"user_id"`
|
|
RequestContent string `gorm:"type:text;comment:用户提交原文" json:"request_content"`
|
|
ParsedURL string `gorm:"size:500;comment:解析得到的链接" json:"parsed_url"`
|
|
ThirdPartyStatus int `gorm:"comment:第三方HTTP状态或业务码" json:"third_party_status"`
|
|
ThirdPartyPayload []byte `gorm:"type:json;comment:第三方响应原文" json:"third_party_payload"`
|
|
FreeQuotaUsed bool `gorm:"default:1;comment:是否计入免费次数" json:"free_quota_used"`
|
|
DurationMs int `gorm:"comment:耗时毫秒" json:"duration_ms"`
|
|
ErrorMessage string `gorm:"size:500;comment:错误信息" json:"error_message"`
|
|
}
|
|
|
|
func (VideoParseLog) TableName() string {
|
|
return "video_parse_logs"
|
|
}
|
|
|
|
func (VideoParseLog) TableComment() string {
|
|
return "短视频去水印调用日志"
|
|
}
|
|
|
|
type VideoParseUnlock struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
|
|
|
MiniProgramID uint `gorm:"index:idx_video_unlock_user_date,priority:1;comment:小程序ID" json:"mini_program_id"`
|
|
UserID uint `gorm:"index:idx_video_unlock_user_date,priority:2;comment:用户ID" json:"user_id"`
|
|
UnlockDate time.Time `gorm:"type:date;index:idx_video_unlock_user_date,priority:3;comment:解锁日期" json:"unlock_date"`
|
|
AdWatchedAt time.Time `gorm:"comment:广告完成时间" json:"ad_watched_at"`
|
|
}
|
|
|
|
func (VideoParseUnlock) TableName() string {
|
|
return "video_parse_unlocks"
|
|
}
|
|
|
|
func (VideoParseUnlock) TableComment() string {
|
|
return "短视频去水印-每日广告解锁"
|
|
}
|