重命名资源套餐相关结构体和数据库表,新增长效套餐类型

This commit is contained in:
2025-05-17 15:54:42 +08:00
parent 9043dd779b
commit d9613a19fb
22 changed files with 859 additions and 1196 deletions

View File

@@ -22,7 +22,7 @@ type Resource struct {
CreatedAt orm.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
UpdatedAt orm.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
Short *ResourceShort `gorm:"foreignKey:ResourceID;references:ID" json:"short"`
}
// TableName Resource's table name

View File

@@ -6,10 +6,10 @@ package models
import "platform/web/globals/orm"
const TableNameResourcePss = "resource_pss"
const TableNameResourceLong = "resource_long"
// ResourcePss mapped from table <resource_pss>
type ResourcePss struct {
// ResourceLong mapped from table <resource_long>
type ResourceLong struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Type int32 `gorm:"column:type;comment:套餐类型1-包时2-包量" json:"type"` // 套餐类型1-包时2-包量
@@ -22,7 +22,7 @@ type ResourcePss struct {
DailyLast orm.LocalDateTime `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
}
// TableName ResourcePss's table name
func (*ResourcePss) TableName() string {
return TableNameResourcePss
// TableName ResourceLong's table name
func (*ResourceLong) TableName() string {
return TableNameResourceLong
}

View File

@@ -1,18 +0,0 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package models
const TableNameResourcePps = "resource_pps"
// ResourcePps mapped from table <resource_pps>
type ResourcePps struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
}
// TableName ResourcePps's table name
func (*ResourcePps) TableName() string {
return TableNameResourcePps
}

View File

@@ -1,24 +0,0 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package models
import "platform/web/globals/orm"
const TableNameResourcePsr = "resource_psr"
// ResourcePsr mapped from table <resource_psr>
type ResourcePsr struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
Expire orm.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
}
// TableName ResourcePsr's table name
func (*ResourcePsr) TableName() string {
return TableNameResourcePsr
}

View File

@@ -0,0 +1,28 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package models
import "platform/web/globals/orm"
const TableNameResourceShort = "resource_short"
// ResourceShort mapped from table <resource_short>
type ResourceShort struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Type int32 `gorm:"column:type;comment:套餐类型1-包时2-包量" json:"type"` // 套餐类型1-包时2-包量
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
Expire orm.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
Used int32 `gorm:"column:used;not null;comment:已用数量" json:"used"` // 已用数量
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量
DailyLast orm.LocalDateTime `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
}
// TableName ResourceShort's table name
func (*ResourceShort) TableName() string {
return TableNameResourceShort
}