2025-02-26 22:28:19 +08:00
|
|
|
package database
|
2025-02-24 16:48:20 +08:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type Subscribe struct {
|
2025-02-27 01:14:16 +08:00
|
|
|
ID string `gorm:"primaryKey" json:"id"`
|
|
|
|
|
SubscribePlanID string `gorm:"not null" json:"subscribe_plan_id"`
|
2025-02-24 16:48:20 +08:00
|
|
|
StartDate time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
|
|
|
EndDate time.Time `gorm:"default:null"`
|
2025-03-10 11:48:20 +08:00
|
|
|
Status int8 `gorm:"default:0"`
|
2025-02-24 16:48:20 +08:00
|
|
|
AutoRenew bool `gorm:"default:true"`
|
|
|
|
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
|
|
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
2025-03-05 21:21:44 +08:00
|
|
|
DeletedAt time.Time `gorm:"default:null" json:"deleted_at"`
|
2025-02-24 16:48:20 +08:00
|
|
|
|
2025-03-05 21:21:44 +08:00
|
|
|
SubscribePlan SubscribePlan `gorm:"foreignKey:SubscribePlanID;constraint:OnDelete:CASCADE" json:"subscribe_plan"`
|
2025-02-24 16:48:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type SubscribePlan struct {
|
2025-02-27 01:14:16 +08:00
|
|
|
ID string `gorm:"primaryKey" json:"id"`
|
2025-03-01 21:27:28 +08:00
|
|
|
Code string `gorm:"not null;unique" json:"code"`
|
2025-02-24 20:18:09 +08:00
|
|
|
Name string `gorm:"not null" json:"name"`
|
2025-03-10 11:48:20 +08:00
|
|
|
Length int `gorm:"default:0" json:"length"`
|
|
|
|
|
Price float32 `gorm:"default:0" json:"price"`
|
|
|
|
|
Status int8 `gorm:"default:1" json:"status"`
|
2025-02-24 16:48:20 +08:00
|
|
|
CreatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
|
|
|
UpdatedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
|
|
|
|
|
}
|