重构 orm 代码生成逻辑,实现 bill 接口,优化请求字段检查与 list total 查询逻辑
This commit is contained in:
@@ -7,6 +7,8 @@ package models
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameAdmin = "admin"
|
||||
@@ -26,7 +28,7 @@ type Admin struct {
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Admin's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameAdminRole = "admin_role"
|
||||
|
||||
@@ -17,7 +21,7 @@ type AdminRole struct {
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRole's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameAdminRoleLink = "admin_role_link"
|
||||
|
||||
@@ -15,7 +19,7 @@ type AdminRoleLink struct {
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRoleLink's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameAdminRolePermissionLink = "admin_role_permission_link"
|
||||
|
||||
@@ -15,7 +19,7 @@ type AdminRolePermissionLink struct {
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName AdminRolePermissionLink's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameBill = "bill"
|
||||
|
||||
@@ -15,13 +19,17 @@ type Bill struct {
|
||||
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id" json:"trade_id"`
|
||||
ResourceID int32 `gorm:"column:resource_id" json:"resource_id"`
|
||||
Type int32 `gorm:"column:type;not null" json:"type"`
|
||||
BillNo string `gorm:"column:bill_no;not null" json:"bill_no"`
|
||||
RefundID int32 `gorm:"column:refund_id" json:"refund_id"`
|
||||
Status int32 `gorm:"column:status;not null" json:"status"`
|
||||
Amount float64 `gorm:"column:amount;not null" json:"amount"`
|
||||
Trade *Trade `gorm:"foreignKey:TradeID" json:"trade"`
|
||||
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
|
||||
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`
|
||||
}
|
||||
|
||||
// TableName Bill's table name
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
@@ -14,26 +15,23 @@ const TableNameChannel = "channel"
|
||||
|
||||
// Channel mapped from table <channel>
|
||||
type Channel struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:通道ID" json:"id"` // 通道ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||
Protocol string `gorm:"column:protocol;comment:协议" json:"protocol"` // 协议
|
||||
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
||||
Expiration time.Time `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
|
||||
CreatedAt time.Time `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt time.Time `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
|
||||
Node *Node `json:"node"`
|
||||
User *User `json:"user"`
|
||||
Proxy *Proxy `json:"proxy"`
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:通道ID" json:"id"` // 通道ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||
Protocol string `gorm:"column:protocol;comment:协议" json:"protocol"` // 协议
|
||||
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
||||
Expiration time.Time `gorm:"column:expiration;not null;comment:过期时间" json:"expiration"` // 过期时间
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
|
||||
}
|
||||
|
||||
// TableName Channel's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameClient = "client"
|
||||
|
||||
@@ -23,7 +27,7 @@ type Client struct {
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Client's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameClientPermissionLink = "client_permission_link"
|
||||
|
||||
@@ -15,7 +19,7 @@ type ClientPermissionLink struct {
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ClientPermissionLink's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameNode = "node"
|
||||
|
||||
@@ -24,7 +28,7 @@ type Node struct {
|
||||
Loss int32 `gorm:"column:loss;comment:丢包率" json:"loss"` // 丢包率
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Node's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNamePermission = "permission"
|
||||
|
||||
@@ -16,7 +20,7 @@ type Permission struct {
|
||||
Description string `gorm:"column:description;comment:权限描述" json:"description"` // 权限描述
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Permission's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameProduct = "product"
|
||||
|
||||
@@ -18,7 +22,7 @@ type Product struct {
|
||||
Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:1-正常,0-禁用" json:"status"` // 产品状态:1-正常,0-禁用
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Product's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameProxy = "proxy"
|
||||
|
||||
@@ -18,7 +22,7 @@ type Proxy struct {
|
||||
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName Proxy's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameRefund = "refund"
|
||||
|
||||
@@ -15,7 +19,7 @@ type Refund struct {
|
||||
Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
TradeID int32 `gorm:"column:trade_id;not null" json:"trade_id"`
|
||||
}
|
||||
|
||||
|
||||
@@ -4,18 +4,24 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameResource = "resource"
|
||||
|
||||
// Resource mapped from table <resource>
|
||||
type Resource struct {
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
|
||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
ResourceNo string `gorm:"column:resource_no" json:"resource_no"`
|
||||
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
|
||||
}
|
||||
|
||||
// TableName Resource's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameResourcePps = "resource_pps"
|
||||
|
||||
@@ -14,7 +18,7 @@ type ResourcePps struct {
|
||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ResourcePps's table name
|
||||
|
||||
@@ -7,6 +7,8 @@ package models
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameResourcePsr = "resource_psr"
|
||||
@@ -21,7 +23,7 @@ type ResourcePsr struct {
|
||||
Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ResourcePsr's table name
|
||||
|
||||
@@ -6,7 +6,8 @@ package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameResourcePss = "resource_pss"
|
||||
@@ -18,14 +19,14 @@ type ResourcePss struct {
|
||||
Type int32 `gorm:"column:type;comment:套餐类型:1-包时,2-包量" json:"type"` // 套餐类型:1-包时,2-包量
|
||||
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
|
||||
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
|
||||
Expire time.Time `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
Expire common.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||
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 time.Time `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
|
||||
DailyLast common.LocalDateTime `gorm:"column:daily_last;comment:今日最后使用时间" json:"daily_last"` // 今日最后使用时间
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName ResourcePss's table name
|
||||
|
||||
@@ -6,7 +6,8 @@ package models
|
||||
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameTrade = "trade"
|
||||
@@ -25,10 +26,10 @@ type Trade struct {
|
||||
Status int32 `gorm:"column:status;not null;comment:订单状态:0-待支付,1-已支付,2-已取消,3-已退款" json:"status"` // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Type int32 `gorm:"column:type;not null" json:"type"`
|
||||
CancelAt time.Time `gorm:"column:cancel_at" json:"cancel_at"`
|
||||
PaidAt time.Time `gorm:"column:paid_at" json:"paid_at"`
|
||||
CancelAt common.LocalDateTime `gorm:"column:cancel_at" json:"cancel_at"`
|
||||
PaidAt common.LocalDateTime `gorm:"column:paid_at" json:"paid_at"`
|
||||
}
|
||||
|
||||
// TableName Trade's table name
|
||||
|
||||
@@ -7,6 +7,8 @@ package models
|
||||
import (
|
||||
"platform/web/common"
|
||||
"time"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameUser = "user"
|
||||
@@ -33,7 +35,7 @@ type User struct {
|
||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName User's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameUserRole = "user_role"
|
||||
|
||||
@@ -17,7 +21,7 @@ type UserRole struct {
|
||||
Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRole's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameUserRoleLink = "user_role_link"
|
||||
|
||||
@@ -15,7 +19,7 @@ type UserRoleLink struct {
|
||||
RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRoleLink's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameUserRolePermissionLink = "user_role_permission_link"
|
||||
|
||||
@@ -15,7 +19,7 @@ type UserRolePermissionLink struct {
|
||||
PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
}
|
||||
|
||||
// TableName UserRolePermissionLink's table name
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
|
||||
package models
|
||||
|
||||
import "platform/web/common"
|
||||
import (
|
||||
"platform/web/common"
|
||||
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
const TableNameWhitelist = "whitelist"
|
||||
|
||||
@@ -15,7 +19,7 @@ type Whitelist struct {
|
||||
Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址
|
||||
CreatedAt common.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||
UpdatedAt common.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||
DeletedAt common.LocalDateTime `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||
Remark string `gorm:"column:remark" json:"remark"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user