Files
SingBox-Gopanel/internal/model/traffic_reset_log.go
CN-JS-HuiBai 981ee4f406
All checks were successful
build / build (api, amd64, linux) (push) Successful in -47s
build / build (api, arm64, linux) (push) Successful in -47s
build / build (api.exe, amd64, windows) (push) Successful in -48s
基本功能复刻完成
2026-04-17 12:24:00 +08:00

26 lines
1.5 KiB
Go

package model
// TrafficResetLog records every instance where a user's traffic usage was reset.
type TrafficResetLog struct {
ID int `gorm:"primaryKey;autoIncrement" json:"id"`
UserID int `gorm:"not null;index" json:"user_id"`
ResetType string `gorm:"size:50;not null" json:"reset_type"` // monthly, yearly, manual, purchase
ResetTime int64 `gorm:"not null;index" json:"reset_time"` // The actual time it was reset
OldUpload int64 `gorm:"not null;default:0" json:"old_upload"` // pre-reset
OldDownload int64 `gorm:"not null;default:0" json:"old_download"` // pre-reset
OldTotal int64 `gorm:"not null;default:0" json:"old_total"` // pre-reset
NewUpload int64 `gorm:"not null;default:0" json:"new_upload"` // post-reset
NewDownload int64 `gorm:"not null;default:0" json:"new_download"` // post-reset
NewTotal int64 `gorm:"not null;default:0" json:"new_total"` // post-reset
TriggerSource string `gorm:"size:50;not null;default:'auto'" json:"trigger_source"` // auto, manual, cron, order, gift_card
Metadata string `gorm:"type:text" json:"metadata"` // JSON extra data
CreatedAt int64 `gorm:"autoCreateTime" json:"created_at"`
UpdatedAt int64 `gorm:"autoUpdateTime" json:"updated_at"`
User *User `gorm:"foreignKey:UserID" json:"user,omitempty"`
}
func (TrafficResetLog) TableName() string {
return "v2_traffic_reset_logs"
}