97cadb033e
- Updated .env.example to include SHORT_VIDEO_API_KEY, SHORT_VIDEO_FREE_QUOTA, and SHORT_VIDEO_TIMEOUT_SECONDS. - Enhanced main.go to auto-migrate new VideoParseLog and VideoParseUnlock models. - Introduced VideoService and VideoHandler for handling video-related operations. - Added protected API routes for removing watermarks and unlocking video features. - Updated config.go to support short video configuration settings. - Expanded documentation to reflect new features and configuration options.
45 lines
1.6 KiB
Go
45 lines
1.6 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type VideoParseLog struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
MiniProgramID uint `gorm:"index:idx_video_parse_user_date,priority:1" json:"mini_program_id"`
|
|
UserID uint `gorm:"index:idx_video_parse_user_date,priority:2" json:"user_id"`
|
|
RequestContent string `gorm:"type:text" json:"request_content"`
|
|
ParsedURL string `gorm:"size:500" json:"parsed_url"`
|
|
ThirdPartyStatus int `json:"third_party_status"`
|
|
ThirdPartyPayload []byte `gorm:"type:json" json:"third_party_payload"`
|
|
FreeQuotaUsed bool `gorm:"default:1" json:"free_quota_used"`
|
|
DurationMs int `json:"duration_ms"`
|
|
ErrorMessage string `gorm:"size:500" json:"error_message"`
|
|
}
|
|
|
|
func (VideoParseLog) TableName() string {
|
|
return "video_parse_logs"
|
|
}
|
|
|
|
type VideoParseUnlock struct {
|
|
ID uint `gorm:"primarykey" json:"id"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
|
|
|
MiniProgramID uint `gorm:"index:idx_video_unlock_user_date,priority:1" json:"mini_program_id"`
|
|
UserID uint `gorm:"index:idx_video_unlock_user_date,priority:2" json:"user_id"`
|
|
UnlockDate time.Time `gorm:"type:date;index:idx_video_unlock_user_date,priority:3" json:"unlock_date"`
|
|
AdWatchedAt time.Time `json:"ad_watched_at"`
|
|
}
|
|
|
|
func (VideoParseUnlock) TableName() string {
|
|
return "video_parse_unlocks"
|
|
}
|