diff --git a/cmd/gen/main.go b/cmd/gen/main.go index 049d95e..28227d8 100644 --- a/cmd/gen/main.go +++ b/cmd/gen/main.go @@ -27,7 +27,11 @@ func main() { }) g.UseDB(db) - models := g.GenerateAllTable() + models := g.GenerateAllTable( + gen.FieldType("created_at", "common.LocalDateTime"), + gen.FieldType("updated_at", "common.LocalDateTime"), + gen.FieldType("deleted_at", "common.LocalDateTime"), + ) g.ApplyBasic(models...) modelChannel := g.GenerateModel("channel", diff --git a/cmd/playground/main.go b/cmd/playground/main.go index 0766a8c..8ab8dcb 100644 --- a/cmd/playground/main.go +++ b/cmd/playground/main.go @@ -1,7 +1,14 @@ package main +import ( + "fmt" + "time" +) + func main() { - for i := range 3 { - println(i) + parse, err := time.Parse(time.RFC3339, "2025-04-16T16:00:00.000Z") + if err != nil { + return } + fmt.Printf("%x\n", parse) } diff --git a/pkg/orm/orm.go b/pkg/orm/orm.go index 16ef29f..305c8cb 100644 --- a/pkg/orm/orm.go +++ b/pkg/orm/orm.go @@ -6,12 +6,12 @@ import ( "platform/pkg/env" "platform/web/queries" + "gorm.io/driver/postgres" "gorm.io/gen" "gorm.io/gen/field" "gorm.io/gorm" "gorm.io/gorm/schema" ) -import "gorm.io/driver/postgres" var DB *gorm.DB diff --git a/web/common/types.go b/web/common/types.go index 3e6348c..6bbdfda 100644 --- a/web/common/types.go +++ b/web/common/types.go @@ -1,7 +1,74 @@ package common +import ( + "database/sql" + "database/sql/driver" + "time" +) + // ErrResp 定义通用错误响应格式 type ErrResp struct { Message string `json:"message"` Error bool `json:"error"` } + +type PageReq struct { + Page int `json:"page"` + Size int `json:"size"` +} + +type PageResp struct { + Total int `json:"total"` + Page int `json:"page"` + Size int `json:"size"` + List any `json:"list"` +} + +// region LocalDateTime + +type LocalDateTime time.Time + +func (ldt *LocalDateTime) Scan(value interface{}) (err error) { + + nullTime := &sql.NullTime{} + err = nullTime.Scan(value) + if err != nil { + return err + } + if nullTime == nil { + return nil + } + + t := nullTime.Time + *ldt = LocalDateTime(time.Date( + t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), t.Nanosecond(), time.Local, + )) + return +} + +func (ldt LocalDateTime) Value() (driver.Value, error) { + return time.Time(ldt).In(time.Local), nil +} + +// GormDataType gorm common data type +func (ldt LocalDateTime) GormDataType() string { + return "ldt" +} + +func (ldt LocalDateTime) GobEncode() ([]byte, error) { + return time.Time(ldt).GobEncode() +} + +func (ldt *LocalDateTime) GobDecode(b []byte) error { + return (*time.Time)(ldt).GobDecode(b) +} + +func (ldt LocalDateTime) MarshalJSON() ([]byte, error) { + return time.Time(ldt).MarshalJSON() +} + +func (ldt *LocalDateTime) UnmarshalJSON(b []byte) error { + return (*time.Time)(ldt).UnmarshalJSON(b) +} + +// endregion diff --git a/web/handlers/bill.go b/web/handlers/bill.go new file mode 100644 index 0000000..5ac8282 --- /dev/null +++ b/web/handlers/bill.go @@ -0,0 +1 @@ +package handlers diff --git a/web/handlers/resource.go b/web/handlers/resource.go index c1cbfbd..01f343b 100644 --- a/web/handlers/resource.go +++ b/web/handlers/resource.go @@ -3,6 +3,7 @@ package handlers import ( "errors" "platform/web/auth" + "platform/web/common" m "platform/web/models" q "platform/web/queries" "platform/web/services" @@ -11,6 +12,83 @@ import ( "github.com/gofiber/fiber/v2" ) +// region ListResourcePss + +type ListResourcePssReq struct { + Page int `json:"page" validate:"required"` + Size int `json:"size" validate:"required"` + Active *bool `json:"active"` + Type *int `json:"type"` + CreateAfter *time.Time `json:"create_after"` + CreateBefore *time.Time `json:"create_before"` + ExpireAfter *time.Time `json:"expire_after"` + ExpireBefore *time.Time `json:"expire_before"` +} + +// ListResourcePss 获取资源列表 +func ListResourcePss(c *fiber.Ctx) error { + // 检查权限 + authContext, err := auth.Protect(c, []services.PayloadType{services.PayloadUser}, []string{}) + if err != nil { + return err + } + + // 解析请求参数 + req := new(ListResourcePssReq) + if err := c.BodyParser(req); err != nil { + return err + } + + // 查询资源列表 + do := q.Resource. + Join(q.ResourcePss, q.ResourcePss.ResourceID.EqCol(q.Resource.ID)). + Where(q.Resource.UserID.Eq(authContext.Payload.Id)) + if req.Active != nil { + do = do.Where(q.Resource.Active.Is(*req.Active)) + } + if req.Type != nil { + do = do.Where(q.ResourcePss.Type.Eq(int32(*req.Type))) + } + if req.CreateAfter != nil { + do = do.Where(q.Resource.CreatedAt.Gte(common.LocalDateTime(*req.CreateAfter))) + } + if req.CreateBefore != nil { + do = do.Where(q.Resource.CreatedAt.Lte(common.LocalDateTime(*req.CreateBefore))) + } + if req.ExpireAfter != nil { + do = do.Where(q.ResourcePss.Expire.Gte(*req.ExpireAfter)) + } + if req.ExpireBefore != nil { + do = do.Where(q.ResourcePss.Expire.Lte(*req.ExpireBefore)) + } + + total, err := do.Debug(). + Count() + if err != nil { + return err + } + + var resourcePss []*m.ResourcePss + err = do.Debug(). + Select(q.ResourcePss.ALL). + Order(q.ResourcePss.CreatedAt.Desc()). + Offset((req.Page - 1) * req.Size). + Limit(req.Size). + Scan(&resourcePss) + if err != nil { + return err + } + + return c.JSON(common.PageResp{ + Total: int(total), + Page: req.Page, + Size: req.Size, + List: resourcePss, + }) +} + +// endregion + // region CreateResourceByBalance type CreateResourceByBalanceReq struct { diff --git a/web/models/admin.gen.go b/web/models/admin.gen.go index aee901a..7f48ec0 100644 --- a/web/models/admin.gen.go +++ b/web/models/admin.gen.go @@ -5,29 +5,28 @@ package models import ( + "platform/web/common" "time" - - "gorm.io/gorm" ) const TableNameAdmin = "admin" // Admin mapped from table type Admin struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员ID" json:"id"` // 管理员ID - Username string `gorm:"column:username;not null;comment:用户名" json:"username"` // 用户名 - Password string `gorm:"column:password;not null;comment:密码" json:"password"` // 密码 - Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名 - Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL - Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码 - Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱 - Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用 - LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间 - LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址 - LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员ID" json:"id"` // 管理员ID + Username string `gorm:"column:username;not null;comment:用户名" json:"username"` // 用户名 + Password string `gorm:"column:password;not null;comment:密码" json:"password"` // 密码 + Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名 + Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL + Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码 + Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱 + Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用 + LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间 + LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址 + 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"` // 删除时间 } // TableName Admin's table name diff --git a/web/models/admin_role.gen.go b/web/models/admin_role.gen.go index a2cb5d1..3b8a4e4 100644 --- a/web/models/admin_role.gen.go +++ b/web/models/admin_role.gen.go @@ -4,24 +4,20 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameAdminRole = "admin_role" // AdminRole mapped from table type AdminRole struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员角色ID" json:"id"` // 管理员角色ID - Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称 - Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述 - Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活 - Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:管理员角色ID" json:"id"` // 管理员角色ID + Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称 + Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述 + Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活 + 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"` // 删除时间 } // TableName AdminRole's table name diff --git a/web/models/admin_role_link.gen.go b/web/models/admin_role_link.gen.go index cb0b51c..feed505 100644 --- a/web/models/admin_role_link.gen.go +++ b/web/models/admin_role_link.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameAdminRoleLink = "admin_role_link" // AdminRoleLink mapped from table type AdminRoleLink struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID - AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID - RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID + AdminID int32 `gorm:"column:admin_id;not null;comment:管理员ID" json:"admin_id"` // 管理员ID + 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"` // 删除时间 } // TableName AdminRoleLink's table name diff --git a/web/models/admin_role_permission_link.gen.go b/web/models/admin_role_permission_link.gen.go index b64d4d1..6f43eb9 100644 --- a/web/models/admin_role_permission_link.gen.go +++ b/web/models/admin_role_permission_link.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameAdminRolePermissionLink = "admin_role_permission_link" // AdminRolePermissionLink mapped from table type AdminRolePermissionLink struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID - RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID - PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID + RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID + 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"` // 删除时间 } // TableName AdminRolePermissionLink's table name diff --git a/web/models/bill.gen.go b/web/models/bill.gen.go index fe24302..58a634c 100644 --- a/web/models/bill.gen.go +++ b/web/models/bill.gen.go @@ -4,28 +4,24 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameBill = "bill" // Bill mapped from table type Bill 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 - Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息 - 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"` // 删除时间 - 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"` + 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 + 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"` // 删除时间 + 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"` } // TableName Bill's table name diff --git a/web/models/client.gen.go b/web/models/client.gen.go index 0e22df1..45be2f2 100644 --- a/web/models/client.gen.go +++ b/web/models/client.gen.go @@ -4,30 +4,26 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameClient = "client" // Client mapped from table type Client struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:客户端ID" json:"id"` // 客户端ID - ClientID string `gorm:"column:client_id;not null;comment:OAuth2客户端标识符" json:"client_id"` // OAuth2客户端标识符 - ClientSecret string `gorm:"column:client_secret;not null;comment:OAuth2客户端密钥" json:"client_secret"` // OAuth2客户端密钥 - RedirectURI string `gorm:"column:redirect_uri;comment:OAuth2 重定向URI" json:"redirect_uri"` // OAuth2 重定向URI - GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予 - GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予 - GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予 - Spec int32 `gorm:"column:spec;not null;comment:安全规范:0-web,1-native,2-browser" json:"spec"` // 安全规范:0-web,1-native,2-browser - Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称 - Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL - Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:客户端ID" json:"id"` // 客户端ID + ClientID string `gorm:"column:client_id;not null;comment:OAuth2客户端标识符" json:"client_id"` // OAuth2客户端标识符 + ClientSecret string `gorm:"column:client_secret;not null;comment:OAuth2客户端密钥" json:"client_secret"` // OAuth2客户端密钥 + RedirectURI string `gorm:"column:redirect_uri;comment:OAuth2 重定向URI" json:"redirect_uri"` // OAuth2 重定向URI + GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予 + GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予 + GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予 + Spec int32 `gorm:"column:spec;not null;comment:安全规范:0-web,1-native,2-browser" json:"spec"` // 安全规范:0-web,1-native,2-browser + Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称 + Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL + 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"` // 删除时间 } // TableName Client's table name diff --git a/web/models/client_permission_link.gen.go b/web/models/client_permission_link.gen.go index 9fd5f28..30a7207 100644 --- a/web/models/client_permission_link.gen.go +++ b/web/models/client_permission_link.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameClientPermissionLink = "client_permission_link" // ClientPermissionLink mapped from table type ClientPermissionLink struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID - ClientID int32 `gorm:"column:client_id;not null;comment:客户端ID" json:"client_id"` // 客户端ID - PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID + ClientID int32 `gorm:"column:client_id;not null;comment:客户端ID" json:"client_id"` // 客户端ID + 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"` // 删除时间 } // TableName ClientPermissionLink's table name diff --git a/web/models/node.gen.go b/web/models/node.gen.go index 3b073bc..68362be 100644 --- a/web/models/node.gen.go +++ b/web/models/node.gen.go @@ -4,31 +4,27 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameNode = "node" // Node mapped from table type Node struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID - Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本 - Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称 - Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址 - Isp string `gorm:"column:isp;not null;comment:运营商" json:"isp"` // 运营商 - Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份 - City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市 - ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID - ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口 - Status int32 `gorm:"column:status;not null;comment:节点状态:1-正常,0-离线" json:"status"` // 节点状态:1-正常,0-离线 - Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟 - Loss int32 `gorm:"column:loss;comment:丢包率" json:"loss"` // 丢包率 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID + Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本 + Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称 + Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址 + Isp string `gorm:"column:isp;not null;comment:运营商" json:"isp"` // 运营商 + Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份 + City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市 + ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID + ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口 + Status int32 `gorm:"column:status;not null;comment:节点状态:1-正常,0-离线" json:"status"` // 节点状态:1-正常,0-离线 + Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟 + 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"` // 删除时间 } // TableName Node's table name diff --git a/web/models/permission.gen.go b/web/models/permission.gen.go index 860b5c0..50392ea 100644 --- a/web/models/permission.gen.go +++ b/web/models/permission.gen.go @@ -4,23 +4,19 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNamePermission = "permission" // Permission mapped from table type Permission struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:权限ID" json:"id"` // 权限ID - ParentID int32 `gorm:"column:parent_id;comment:父权限ID" json:"parent_id"` // 父权限ID - Name string `gorm:"column:name;not null;comment:权限名称" json:"name"` // 权限名称 - Description string `gorm:"column:description;comment:权限描述" json:"description"` // 权限描述 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:权限ID" json:"id"` // 权限ID + ParentID int32 `gorm:"column:parent_id;comment:父权限ID" json:"parent_id"` // 父权限ID + Name string `gorm:"column:name;not null;comment:权限名称" json:"name"` // 权限名称 + 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"` // 删除时间 } // TableName Permission's table name diff --git a/web/models/product.gen.go b/web/models/product.gen.go index 7964cf4..f4f06ca 100644 --- a/web/models/product.gen.go +++ b/web/models/product.gen.go @@ -4,25 +4,21 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameProduct = "product" // Product mapped from table type Product struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:产品ID" json:"id"` // 产品ID - Code string `gorm:"column:code;not null;comment:产品代码" json:"code"` // 产品代码 - Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称 - Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述 - Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序 - Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:1-正常,0-禁用" json:"status"` // 产品状态:1-正常,0-禁用 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:产品ID" json:"id"` // 产品ID + Code string `gorm:"column:code;not null;comment:产品代码" json:"code"` // 产品代码 + Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称 + Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述 + Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序 + 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"` // 删除时间 } // TableName Product's table name diff --git a/web/models/proxy.gen.go b/web/models/proxy.gen.go index 7447378..8a1be6f 100644 --- a/web/models/proxy.gen.go +++ b/web/models/proxy.gen.go @@ -4,25 +4,21 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameProxy = "proxy" // Proxy mapped from table type Proxy struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:代理服务ID" json:"id"` // 代理服务ID - Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本 - Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称 - Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址 - Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方 - Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:代理服务ID" json:"id"` // 代理服务ID + Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本 + Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称 + Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址 + Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方 + 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"` // 删除时间 } // TableName Proxy's table name diff --git a/web/models/refund.gen.go b/web/models/refund.gen.go index bf3dfd5..7eb30e8 100644 --- a/web/models/refund.gen.go +++ b/web/models/refund.gen.go @@ -4,23 +4,19 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameRefund = "refund" // Refund mapped from table type Refund struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID - ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID - Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额 - 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"` // 删除时间 - TradeID int32 `gorm:"column:trade_id;not null" json:"trade_id"` + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID + ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID + 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"` // 删除时间 + TradeID int32 `gorm:"column:trade_id;not null" json:"trade_id"` } // TableName Refund's table name diff --git a/web/models/resource.gen.go b/web/models/resource.gen.go index 28337fa..6cf97da 100644 --- a/web/models/resource.gen.go +++ b/web/models/resource.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameResource = "resource" // Resource mapped from table 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 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"` // 删除时间 + 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"` // 删除时间 } // TableName Resource's table name diff --git a/web/models/resource_pps.gen.go b/web/models/resource_pps.gen.go index b8dee0d..0adb32c 100644 --- a/web/models/resource_pps.gen.go +++ b/web/models/resource_pps.gen.go @@ -4,21 +4,17 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameResourcePps = "resource_pps" // ResourcePps mapped from table 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 - 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"` // 删除时间 + 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 + 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"` // 删除时间 } // TableName ResourcePps's table name diff --git a/web/models/resource_psr.gen.go b/web/models/resource_psr.gen.go index 5e75609..bd1e28d 100644 --- a/web/models/resource_psr.gen.go +++ b/web/models/resource_psr.gen.go @@ -5,24 +5,23 @@ package models import ( + "platform/web/common" "time" - - "gorm.io/gorm" ) const TableNameResourcePsr = "resource_psr" // ResourcePsr mapped from table 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 time.Time `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间 - Used bool `gorm:"column:used;comment:是否已使用" json:"used"` // 是否已使用 - 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"` // 删除时间 + 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 time.Time `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间 + 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"` // 删除时间 } // TableName ResourcePsr's table name diff --git a/web/models/resource_pss.gen.go b/web/models/resource_pss.gen.go index d3c3fa2..a735a3c 100644 --- a/web/models/resource_pss.gen.go +++ b/web/models/resource_pss.gen.go @@ -5,28 +5,27 @@ package models import ( + "platform/web/common" "time" - - "gorm.io/gorm" ) const TableNameResourcePss = "resource_pss" // ResourcePss mapped from table type ResourcePss 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"` // 可用时长(秒) - Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量 - Expire time.Time `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"` // 今日最后使用时间 - 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"` // 删除时间 + 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"` // 可用时长(秒) + Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量 + Expire time.Time `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"` // 今日最后使用时间 + 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"` // 删除时间 } // TableName ResourcePss's table name diff --git a/web/models/trade.gen.go b/web/models/trade.gen.go index 35ee95a..19132e9 100644 --- a/web/models/trade.gen.go +++ b/web/models/trade.gen.go @@ -5,31 +5,30 @@ package models import ( + "platform/web/common" "time" - - "gorm.io/gorm" ) const TableNameTrade = "trade" // Trade mapped from table type Trade 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 - InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号 - OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号 - Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题 - Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注 - Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额 - Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额 - Method int32 `gorm:"column:method;not null;comment:支付方式:1-支付宝,2-微信" json:"method"` // 支付方式:1-支付宝,2-微信 - Status int32 `gorm:"column:status;not null;comment:订单状态:0-待支付,1-已支付,2-已取消,3-已退款" json:"status"` // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款 - 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"` // 删除时间 - 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"` + 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 + InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号 + OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号 + Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题 + Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注 + Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额 + Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额 + Method int32 `gorm:"column:method;not null;comment:支付方式:1-支付宝,2-微信" json:"method"` // 支付方式:1-支付宝,2-微信 + 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"` // 删除时间 + 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"` } // TableName Trade's table name diff --git a/web/models/user.gen.go b/web/models/user.gen.go index 8fb5752..f2afb9b 100644 --- a/web/models/user.gen.go +++ b/web/models/user.gen.go @@ -5,36 +5,35 @@ package models import ( + "platform/web/common" "time" - - "gorm.io/gorm" ) const TableNameUser = "user" // User mapped from table type User struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:用户ID" json:"id"` // 用户ID - AdminID int32 `gorm:"column:admin_id;comment:管理员ID" json:"admin_id"` // 管理员ID - Phone string `gorm:"column:phone;not null;comment:手机号码" json:"phone"` // 手机号码 - Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名 - Email string `gorm:"column:email" json:"email"` - Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码 - Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名 - Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL - Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:1-正常,0-禁用" json:"status"` // 用户状态:1-正常,0-禁用 - Balance float64 `gorm:"column:balance;not null;comment:账户余额" json:"balance"` // 账户余额 - IDType int32 `gorm:"column:id_type;not null;comment:认证类型:0-未认证,1-个人认证,2-企业认证" json:"id_type"` // 认证类型:0-未认证,1-个人认证,2-企业认证 - IDNo string `gorm:"column:id_no;comment:身份证号或营业执照号" json:"id_no"` // 身份证号或营业执照号 - IDToken string `gorm:"column:id_token;comment:身份验证标识" json:"id_token"` // 身份验证标识 - ContactQq string `gorm:"column:contact_qq;comment:QQ联系方式" json:"contact_qq"` // QQ联系方式 - ContactWechat string `gorm:"column:contact_wechat;comment:微信联系方式" json:"contact_wechat"` // 微信联系方式 - LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间 - LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址 - LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:用户ID" json:"id"` // 用户ID + AdminID int32 `gorm:"column:admin_id;comment:管理员ID" json:"admin_id"` // 管理员ID + Phone string `gorm:"column:phone;not null;comment:手机号码" json:"phone"` // 手机号码 + Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名 + Email string `gorm:"column:email" json:"email"` + Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码 + Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名 + Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL + Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:1-正常,0-禁用" json:"status"` // 用户状态:1-正常,0-禁用 + Balance float64 `gorm:"column:balance;not null;comment:账户余额" json:"balance"` // 账户余额 + IDType int32 `gorm:"column:id_type;not null;comment:认证类型:0-未认证,1-个人认证,2-企业认证" json:"id_type"` // 认证类型:0-未认证,1-个人认证,2-企业认证 + IDNo string `gorm:"column:id_no;comment:身份证号或营业执照号" json:"id_no"` // 身份证号或营业执照号 + IDToken string `gorm:"column:id_token;comment:身份验证标识" json:"id_token"` // 身份验证标识 + ContactQq string `gorm:"column:contact_qq;comment:QQ联系方式" json:"contact_qq"` // QQ联系方式 + ContactWechat string `gorm:"column:contact_wechat;comment:微信联系方式" json:"contact_wechat"` // 微信联系方式 + LastLogin time.Time `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间 + LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址 + 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"` // 删除时间 } // TableName User's table name diff --git a/web/models/user_role.gen.go b/web/models/user_role.gen.go index 67ca5f1..95be401 100644 --- a/web/models/user_role.gen.go +++ b/web/models/user_role.gen.go @@ -4,24 +4,20 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameUserRole = "user_role" // UserRole mapped from table type UserRole struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:角色ID" json:"id"` // 角色ID - Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称 - Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述 - Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活 - Sort int32 `gorm:"column:sort;comment:排序" json:"sort"` // 排序 - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:角色ID" json:"id"` // 角色ID + Name string `gorm:"column:name;not null;comment:角色名称" json:"name"` // 角色名称 + Description string `gorm:"column:description;comment:角色描述" json:"description"` // 角色描述 + Active bool `gorm:"column:active;default:true;comment:是否激活" json:"active"` // 是否激活 + 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"` // 删除时间 } // TableName UserRole's table name diff --git a/web/models/user_role_link.gen.go b/web/models/user_role_link.gen.go index 1a8b5eb..953cb37 100644 --- a/web/models/user_role_link.gen.go +++ b/web/models/user_role_link.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameUserRoleLink = "user_role_link" // UserRoleLink mapped from table type UserRoleLink 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 - RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID - 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"` // 删除时间 + 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 + 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"` // 删除时间 } // TableName UserRoleLink's table name diff --git a/web/models/user_role_permission_link.gen.go b/web/models/user_role_permission_link.gen.go index e0ee27d..30a58ef 100644 --- a/web/models/user_role_permission_link.gen.go +++ b/web/models/user_role_permission_link.gen.go @@ -4,22 +4,18 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameUserRolePermissionLink = "user_role_permission_link" // UserRolePermissionLink mapped from table type UserRolePermissionLink struct { - ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID - RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID - PermissionID int32 `gorm:"column:permission_id;not null;comment:权限ID" json:"permission_id"` // 权限ID - 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"` // 删除时间 + ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:关联ID" json:"id"` // 关联ID + RoleID int32 `gorm:"column:role_id;not null;comment:角色ID" json:"role_id"` // 角色ID + 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"` // 删除时间 } // TableName UserRolePermissionLink's table name diff --git a/web/models/whitelist.gen.go b/web/models/whitelist.gen.go index 7ae8d3b..f3b2ac8 100644 --- a/web/models/whitelist.gen.go +++ b/web/models/whitelist.gen.go @@ -4,23 +4,19 @@ package models -import ( - "time" - - "gorm.io/gorm" -) +import "platform/web/common" const TableNameWhitelist = "whitelist" // Whitelist mapped from table type Whitelist 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 - Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址 - 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"` // 删除时间 - Remark string `gorm:"column:remark" json:"remark"` + 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 + 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"` // 删除时间 + Remark string `gorm:"column:remark" json:"remark"` } // TableName Whitelist's table name diff --git a/web/queries/admin.gen.go b/web/queries/admin.gen.go index 417719f..44c4907 100644 --- a/web/queries/admin.gen.go +++ b/web/queries/admin.gen.go @@ -38,8 +38,8 @@ func newAdmin(db *gorm.DB, opts ...gen.DOOption) admin { _admin.LastLogin = field.NewTime(tableName, "last_login") _admin.LastLoginHost = field.NewString(tableName, "last_login_host") _admin.LastLoginAgent = field.NewString(tableName, "last_login_agent") - _admin.CreatedAt = field.NewTime(tableName, "created_at") - _admin.UpdatedAt = field.NewTime(tableName, "updated_at") + _admin.CreatedAt = field.NewField(tableName, "created_at") + _admin.UpdatedAt = field.NewField(tableName, "updated_at") _admin.DeletedAt = field.NewField(tableName, "deleted_at") _admin.fillFieldMap() @@ -62,8 +62,8 @@ type admin struct { LastLogin field.Time // 最后登录时间 LastLoginHost field.String // 最后登录地址 LastLoginAgent field.String // 最后登录代理 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -92,8 +92,8 @@ func (a *admin) updateTableName(table string) *admin { a.LastLogin = field.NewTime(table, "last_login") a.LastLoginHost = field.NewString(table, "last_login_host") a.LastLoginAgent = field.NewString(table, "last_login_agent") - a.CreatedAt = field.NewTime(table, "created_at") - a.UpdatedAt = field.NewTime(table, "updated_at") + a.CreatedAt = field.NewField(table, "created_at") + a.UpdatedAt = field.NewField(table, "updated_at") a.DeletedAt = field.NewField(table, "deleted_at") a.fillFieldMap() diff --git a/web/queries/admin_role.gen.go b/web/queries/admin_role.gen.go index 64e1dbf..f8c5883 100644 --- a/web/queries/admin_role.gen.go +++ b/web/queries/admin_role.gen.go @@ -32,8 +32,8 @@ func newAdminRole(db *gorm.DB, opts ...gen.DOOption) adminRole { _adminRole.Description = field.NewString(tableName, "description") _adminRole.Active = field.NewBool(tableName, "active") _adminRole.Sort = field.NewInt32(tableName, "sort") - _adminRole.CreatedAt = field.NewTime(tableName, "created_at") - _adminRole.UpdatedAt = field.NewTime(tableName, "updated_at") + _adminRole.CreatedAt = field.NewField(tableName, "created_at") + _adminRole.UpdatedAt = field.NewField(tableName, "updated_at") _adminRole.DeletedAt = field.NewField(tableName, "deleted_at") _adminRole.fillFieldMap() @@ -50,8 +50,8 @@ type adminRole struct { Description field.String // 角色描述 Active field.Bool // 是否激活 Sort field.Int32 // 排序 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -74,8 +74,8 @@ func (a *adminRole) updateTableName(table string) *adminRole { a.Description = field.NewString(table, "description") a.Active = field.NewBool(table, "active") a.Sort = field.NewInt32(table, "sort") - a.CreatedAt = field.NewTime(table, "created_at") - a.UpdatedAt = field.NewTime(table, "updated_at") + a.CreatedAt = field.NewField(table, "created_at") + a.UpdatedAt = field.NewField(table, "updated_at") a.DeletedAt = field.NewField(table, "deleted_at") a.fillFieldMap() diff --git a/web/queries/admin_role_link.gen.go b/web/queries/admin_role_link.gen.go index e9942fd..67fd76f 100644 --- a/web/queries/admin_role_link.gen.go +++ b/web/queries/admin_role_link.gen.go @@ -30,8 +30,8 @@ func newAdminRoleLink(db *gorm.DB, opts ...gen.DOOption) adminRoleLink { _adminRoleLink.ID = field.NewInt32(tableName, "id") _adminRoleLink.AdminID = field.NewInt32(tableName, "admin_id") _adminRoleLink.RoleID = field.NewInt32(tableName, "role_id") - _adminRoleLink.CreatedAt = field.NewTime(tableName, "created_at") - _adminRoleLink.UpdatedAt = field.NewTime(tableName, "updated_at") + _adminRoleLink.CreatedAt = field.NewField(tableName, "created_at") + _adminRoleLink.UpdatedAt = field.NewField(tableName, "updated_at") _adminRoleLink.DeletedAt = field.NewField(tableName, "deleted_at") _adminRoleLink.fillFieldMap() @@ -46,8 +46,8 @@ type adminRoleLink struct { ID field.Int32 // 关联ID AdminID field.Int32 // 管理员ID RoleID field.Int32 // 角色ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (a *adminRoleLink) updateTableName(table string) *adminRoleLink { a.ID = field.NewInt32(table, "id") a.AdminID = field.NewInt32(table, "admin_id") a.RoleID = field.NewInt32(table, "role_id") - a.CreatedAt = field.NewTime(table, "created_at") - a.UpdatedAt = field.NewTime(table, "updated_at") + a.CreatedAt = field.NewField(table, "created_at") + a.UpdatedAt = field.NewField(table, "updated_at") a.DeletedAt = field.NewField(table, "deleted_at") a.fillFieldMap() diff --git a/web/queries/admin_role_permission_link.gen.go b/web/queries/admin_role_permission_link.gen.go index 7baea7e..7a04418 100644 --- a/web/queries/admin_role_permission_link.gen.go +++ b/web/queries/admin_role_permission_link.gen.go @@ -30,8 +30,8 @@ func newAdminRolePermissionLink(db *gorm.DB, opts ...gen.DOOption) adminRolePerm _adminRolePermissionLink.ID = field.NewInt32(tableName, "id") _adminRolePermissionLink.RoleID = field.NewInt32(tableName, "role_id") _adminRolePermissionLink.PermissionID = field.NewInt32(tableName, "permission_id") - _adminRolePermissionLink.CreatedAt = field.NewTime(tableName, "created_at") - _adminRolePermissionLink.UpdatedAt = field.NewTime(tableName, "updated_at") + _adminRolePermissionLink.CreatedAt = field.NewField(tableName, "created_at") + _adminRolePermissionLink.UpdatedAt = field.NewField(tableName, "updated_at") _adminRolePermissionLink.DeletedAt = field.NewField(tableName, "deleted_at") _adminRolePermissionLink.fillFieldMap() @@ -46,8 +46,8 @@ type adminRolePermissionLink struct { ID field.Int32 // 关联ID RoleID field.Int32 // 角色ID PermissionID field.Int32 // 权限ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (a *adminRolePermissionLink) updateTableName(table string) *adminRolePermis a.ID = field.NewInt32(table, "id") a.RoleID = field.NewInt32(table, "role_id") a.PermissionID = field.NewInt32(table, "permission_id") - a.CreatedAt = field.NewTime(table, "created_at") - a.UpdatedAt = field.NewTime(table, "updated_at") + a.CreatedAt = field.NewField(table, "created_at") + a.UpdatedAt = field.NewField(table, "updated_at") a.DeletedAt = field.NewField(table, "deleted_at") a.fillFieldMap() diff --git a/web/queries/bill.gen.go b/web/queries/bill.gen.go index 20383a0..2c59438 100644 --- a/web/queries/bill.gen.go +++ b/web/queries/bill.gen.go @@ -30,8 +30,8 @@ func newBill(db *gorm.DB, opts ...gen.DOOption) bill { _bill.ID = field.NewInt32(tableName, "id") _bill.UserID = field.NewInt32(tableName, "user_id") _bill.Info = field.NewString(tableName, "info") - _bill.CreatedAt = field.NewTime(tableName, "created_at") - _bill.UpdatedAt = field.NewTime(tableName, "updated_at") + _bill.CreatedAt = field.NewField(tableName, "created_at") + _bill.UpdatedAt = field.NewField(tableName, "updated_at") _bill.DeletedAt = field.NewField(tableName, "deleted_at") _bill.TradeID = field.NewInt32(tableName, "trade_id") _bill.ResourceID = field.NewInt32(tableName, "resource_id") @@ -52,8 +52,8 @@ type bill struct { ID field.Int32 // 账单ID UserID field.Int32 // 用户ID Info field.String // 产品可读信息 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 TradeID field.Int32 ResourceID field.Int32 @@ -80,8 +80,8 @@ func (b *bill) updateTableName(table string) *bill { b.ID = field.NewInt32(table, "id") b.UserID = field.NewInt32(table, "user_id") b.Info = field.NewString(table, "info") - b.CreatedAt = field.NewTime(table, "created_at") - b.UpdatedAt = field.NewTime(table, "updated_at") + b.CreatedAt = field.NewField(table, "created_at") + b.UpdatedAt = field.NewField(table, "updated_at") b.DeletedAt = field.NewField(table, "deleted_at") b.TradeID = field.NewInt32(table, "trade_id") b.ResourceID = field.NewInt32(table, "resource_id") diff --git a/web/queries/channel.gen.go b/web/queries/channel.gen.go index 341e28f..14487dc 100644 --- a/web/queries/channel.gen.go +++ b/web/queries/channel.gen.go @@ -40,8 +40,8 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel { _channel.Username = field.NewString(tableName, "username") _channel.Password = field.NewString(tableName, "password") _channel.Expiration = field.NewTime(tableName, "expiration") - _channel.CreatedAt = field.NewTime(tableName, "created_at") - _channel.UpdatedAt = field.NewTime(tableName, "updated_at") + _channel.CreatedAt = field.NewField(tableName, "created_at") + _channel.UpdatedAt = field.NewField(tableName, "updated_at") _channel.DeletedAt = field.NewField(tableName, "deleted_at") _channel.ProxyHost = field.NewString(tableName, "proxy_host") @@ -67,8 +67,8 @@ type channel struct { Username field.String // 用户名 Password field.String // 密码 Expiration field.Time // 过期时间 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 ProxyHost field.String @@ -100,8 +100,8 @@ func (c *channel) updateTableName(table string) *channel { c.Username = field.NewString(table, "username") c.Password = field.NewString(table, "password") c.Expiration = field.NewTime(table, "expiration") - c.CreatedAt = field.NewTime(table, "created_at") - c.UpdatedAt = field.NewTime(table, "updated_at") + c.CreatedAt = field.NewField(table, "created_at") + c.UpdatedAt = field.NewField(table, "updated_at") c.DeletedAt = field.NewField(table, "deleted_at") c.ProxyHost = field.NewString(table, "proxy_host") diff --git a/web/queries/client.gen.go b/web/queries/client.gen.go index e311a23..21ba38f 100644 --- a/web/queries/client.gen.go +++ b/web/queries/client.gen.go @@ -38,8 +38,8 @@ func newClient(db *gorm.DB, opts ...gen.DOOption) client { _client.Name = field.NewString(tableName, "name") _client.Icon = field.NewString(tableName, "icon") _client.Status = field.NewInt32(tableName, "status") - _client.CreatedAt = field.NewTime(tableName, "created_at") - _client.UpdatedAt = field.NewTime(tableName, "updated_at") + _client.CreatedAt = field.NewField(tableName, "created_at") + _client.UpdatedAt = field.NewField(tableName, "updated_at") _client.DeletedAt = field.NewField(tableName, "deleted_at") _client.fillFieldMap() @@ -62,8 +62,8 @@ type client struct { Name field.String // 名称 Icon field.String // 图标URL Status field.Int32 // 状态:1-正常,0-禁用 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -92,8 +92,8 @@ func (c *client) updateTableName(table string) *client { c.Name = field.NewString(table, "name") c.Icon = field.NewString(table, "icon") c.Status = field.NewInt32(table, "status") - c.CreatedAt = field.NewTime(table, "created_at") - c.UpdatedAt = field.NewTime(table, "updated_at") + c.CreatedAt = field.NewField(table, "created_at") + c.UpdatedAt = field.NewField(table, "updated_at") c.DeletedAt = field.NewField(table, "deleted_at") c.fillFieldMap() diff --git a/web/queries/client_permission_link.gen.go b/web/queries/client_permission_link.gen.go index 3cea478..02b66f4 100644 --- a/web/queries/client_permission_link.gen.go +++ b/web/queries/client_permission_link.gen.go @@ -30,8 +30,8 @@ func newClientPermissionLink(db *gorm.DB, opts ...gen.DOOption) clientPermission _clientPermissionLink.ID = field.NewInt32(tableName, "id") _clientPermissionLink.ClientID = field.NewInt32(tableName, "client_id") _clientPermissionLink.PermissionID = field.NewInt32(tableName, "permission_id") - _clientPermissionLink.CreatedAt = field.NewTime(tableName, "created_at") - _clientPermissionLink.UpdatedAt = field.NewTime(tableName, "updated_at") + _clientPermissionLink.CreatedAt = field.NewField(tableName, "created_at") + _clientPermissionLink.UpdatedAt = field.NewField(tableName, "updated_at") _clientPermissionLink.DeletedAt = field.NewField(tableName, "deleted_at") _clientPermissionLink.fillFieldMap() @@ -46,8 +46,8 @@ type clientPermissionLink struct { ID field.Int32 // 关联ID ClientID field.Int32 // 客户端ID PermissionID field.Int32 // 权限ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (c *clientPermissionLink) updateTableName(table string) *clientPermissionLi c.ID = field.NewInt32(table, "id") c.ClientID = field.NewInt32(table, "client_id") c.PermissionID = field.NewInt32(table, "permission_id") - c.CreatedAt = field.NewTime(table, "created_at") - c.UpdatedAt = field.NewTime(table, "updated_at") + c.CreatedAt = field.NewField(table, "created_at") + c.UpdatedAt = field.NewField(table, "updated_at") c.DeletedAt = field.NewField(table, "deleted_at") c.fillFieldMap() diff --git a/web/queries/node.gen.go b/web/queries/node.gen.go index 4243751..c34f584 100644 --- a/web/queries/node.gen.go +++ b/web/queries/node.gen.go @@ -39,8 +39,8 @@ func newNode(db *gorm.DB, opts ...gen.DOOption) node { _node.Status = field.NewInt32(tableName, "status") _node.Rtt = field.NewInt32(tableName, "rtt") _node.Loss = field.NewInt32(tableName, "loss") - _node.CreatedAt = field.NewTime(tableName, "created_at") - _node.UpdatedAt = field.NewTime(tableName, "updated_at") + _node.CreatedAt = field.NewField(tableName, "created_at") + _node.UpdatedAt = field.NewField(tableName, "updated_at") _node.DeletedAt = field.NewField(tableName, "deleted_at") _node.fillFieldMap() @@ -64,8 +64,8 @@ type node struct { Status field.Int32 // 节点状态:1-正常,0-离线 Rtt field.Int32 // 延迟 Loss field.Int32 // 丢包率 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -95,8 +95,8 @@ func (n *node) updateTableName(table string) *node { n.Status = field.NewInt32(table, "status") n.Rtt = field.NewInt32(table, "rtt") n.Loss = field.NewInt32(table, "loss") - n.CreatedAt = field.NewTime(table, "created_at") - n.UpdatedAt = field.NewTime(table, "updated_at") + n.CreatedAt = field.NewField(table, "created_at") + n.UpdatedAt = field.NewField(table, "updated_at") n.DeletedAt = field.NewField(table, "deleted_at") n.fillFieldMap() diff --git a/web/queries/permission.gen.go b/web/queries/permission.gen.go index c0cf9a6..4b0f5d5 100644 --- a/web/queries/permission.gen.go +++ b/web/queries/permission.gen.go @@ -31,8 +31,8 @@ func newPermission(db *gorm.DB, opts ...gen.DOOption) permission { _permission.ParentID = field.NewInt32(tableName, "parent_id") _permission.Name = field.NewString(tableName, "name") _permission.Description = field.NewString(tableName, "description") - _permission.CreatedAt = field.NewTime(tableName, "created_at") - _permission.UpdatedAt = field.NewTime(tableName, "updated_at") + _permission.CreatedAt = field.NewField(tableName, "created_at") + _permission.UpdatedAt = field.NewField(tableName, "updated_at") _permission.DeletedAt = field.NewField(tableName, "deleted_at") _permission.fillFieldMap() @@ -48,8 +48,8 @@ type permission struct { ParentID field.Int32 // 父权限ID Name field.String // 权限名称 Description field.String // 权限描述 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -71,8 +71,8 @@ func (p *permission) updateTableName(table string) *permission { p.ParentID = field.NewInt32(table, "parent_id") p.Name = field.NewString(table, "name") p.Description = field.NewString(table, "description") - p.CreatedAt = field.NewTime(table, "created_at") - p.UpdatedAt = field.NewTime(table, "updated_at") + p.CreatedAt = field.NewField(table, "created_at") + p.UpdatedAt = field.NewField(table, "updated_at") p.DeletedAt = field.NewField(table, "deleted_at") p.fillFieldMap() diff --git a/web/queries/product.gen.go b/web/queries/product.gen.go index b9f63cd..6d6fc71 100644 --- a/web/queries/product.gen.go +++ b/web/queries/product.gen.go @@ -33,8 +33,8 @@ func newProduct(db *gorm.DB, opts ...gen.DOOption) product { _product.Description = field.NewString(tableName, "description") _product.Sort = field.NewInt32(tableName, "sort") _product.Status = field.NewInt32(tableName, "status") - _product.CreatedAt = field.NewTime(tableName, "created_at") - _product.UpdatedAt = field.NewTime(tableName, "updated_at") + _product.CreatedAt = field.NewField(tableName, "created_at") + _product.UpdatedAt = field.NewField(tableName, "updated_at") _product.DeletedAt = field.NewField(tableName, "deleted_at") _product.fillFieldMap() @@ -52,8 +52,8 @@ type product struct { Description field.String // 产品描述 Sort field.Int32 // 排序 Status field.Int32 // 产品状态:1-正常,0-禁用 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -77,8 +77,8 @@ func (p *product) updateTableName(table string) *product { p.Description = field.NewString(table, "description") p.Sort = field.NewInt32(table, "sort") p.Status = field.NewInt32(table, "status") - p.CreatedAt = field.NewTime(table, "created_at") - p.UpdatedAt = field.NewTime(table, "updated_at") + p.CreatedAt = field.NewField(table, "created_at") + p.UpdatedAt = field.NewField(table, "updated_at") p.DeletedAt = field.NewField(table, "deleted_at") p.fillFieldMap() diff --git a/web/queries/proxy.gen.go b/web/queries/proxy.gen.go index 9eeab84..bb7cdb8 100644 --- a/web/queries/proxy.gen.go +++ b/web/queries/proxy.gen.go @@ -33,8 +33,8 @@ func newProxy(db *gorm.DB, opts ...gen.DOOption) proxy { _proxy.Host = field.NewString(tableName, "host") _proxy.Type = field.NewInt32(tableName, "type") _proxy.Secret = field.NewString(tableName, "secret") - _proxy.CreatedAt = field.NewTime(tableName, "created_at") - _proxy.UpdatedAt = field.NewTime(tableName, "updated_at") + _proxy.CreatedAt = field.NewField(tableName, "created_at") + _proxy.UpdatedAt = field.NewField(tableName, "updated_at") _proxy.DeletedAt = field.NewField(tableName, "deleted_at") _proxy.fillFieldMap() @@ -52,8 +52,8 @@ type proxy struct { Host field.String // 代理服务地址 Type field.Int32 // 代理服务类型:0-自有,1-三方 Secret field.String // 代理服务密钥 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -77,8 +77,8 @@ func (p *proxy) updateTableName(table string) *proxy { p.Host = field.NewString(table, "host") p.Type = field.NewInt32(table, "type") p.Secret = field.NewString(table, "secret") - p.CreatedAt = field.NewTime(table, "created_at") - p.UpdatedAt = field.NewTime(table, "updated_at") + p.CreatedAt = field.NewField(table, "created_at") + p.UpdatedAt = field.NewField(table, "updated_at") p.DeletedAt = field.NewField(table, "deleted_at") p.fillFieldMap() diff --git a/web/queries/refund.gen.go b/web/queries/refund.gen.go index c372991..e85f5d4 100644 --- a/web/queries/refund.gen.go +++ b/web/queries/refund.gen.go @@ -30,8 +30,8 @@ func newRefund(db *gorm.DB, opts ...gen.DOOption) refund { _refund.ID = field.NewInt32(tableName, "id") _refund.ProductID = field.NewInt32(tableName, "product_id") _refund.Amount = field.NewFloat64(tableName, "amount") - _refund.CreatedAt = field.NewTime(tableName, "created_at") - _refund.UpdatedAt = field.NewTime(tableName, "updated_at") + _refund.CreatedAt = field.NewField(tableName, "created_at") + _refund.UpdatedAt = field.NewField(tableName, "updated_at") _refund.DeletedAt = field.NewField(tableName, "deleted_at") _refund.TradeID = field.NewInt32(tableName, "trade_id") @@ -47,8 +47,8 @@ type refund struct { ID field.Int32 // 退款ID ProductID field.Int32 // 产品ID Amount field.Float64 // 退款金额 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 TradeID field.Int32 @@ -70,8 +70,8 @@ func (r *refund) updateTableName(table string) *refund { r.ID = field.NewInt32(table, "id") r.ProductID = field.NewInt32(table, "product_id") r.Amount = field.NewFloat64(table, "amount") - r.CreatedAt = field.NewTime(table, "created_at") - r.UpdatedAt = field.NewTime(table, "updated_at") + r.CreatedAt = field.NewField(table, "created_at") + r.UpdatedAt = field.NewField(table, "updated_at") r.DeletedAt = field.NewField(table, "deleted_at") r.TradeID = field.NewInt32(table, "trade_id") diff --git a/web/queries/resource.gen.go b/web/queries/resource.gen.go index 7adcd18..492e1d5 100644 --- a/web/queries/resource.gen.go +++ b/web/queries/resource.gen.go @@ -30,8 +30,8 @@ func newResource(db *gorm.DB, opts ...gen.DOOption) resource { _resource.ID = field.NewInt32(tableName, "id") _resource.UserID = field.NewInt32(tableName, "user_id") _resource.Active = field.NewBool(tableName, "active") - _resource.CreatedAt = field.NewTime(tableName, "created_at") - _resource.UpdatedAt = field.NewTime(tableName, "updated_at") + _resource.CreatedAt = field.NewField(tableName, "created_at") + _resource.UpdatedAt = field.NewField(tableName, "updated_at") _resource.DeletedAt = field.NewField(tableName, "deleted_at") _resource.fillFieldMap() @@ -46,8 +46,8 @@ type resource struct { ID field.Int32 // 套餐ID UserID field.Int32 // 用户ID Active field.Bool // 套餐状态 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (r *resource) updateTableName(table string) *resource { r.ID = field.NewInt32(table, "id") r.UserID = field.NewInt32(table, "user_id") r.Active = field.NewBool(table, "active") - r.CreatedAt = field.NewTime(table, "created_at") - r.UpdatedAt = field.NewTime(table, "updated_at") + r.CreatedAt = field.NewField(table, "created_at") + r.UpdatedAt = field.NewField(table, "updated_at") r.DeletedAt = field.NewField(table, "deleted_at") r.fillFieldMap() diff --git a/web/queries/resource_pps.gen.go b/web/queries/resource_pps.gen.go index a1f81ea..d732eb3 100644 --- a/web/queries/resource_pps.gen.go +++ b/web/queries/resource_pps.gen.go @@ -29,8 +29,8 @@ func newResourcePps(db *gorm.DB, opts ...gen.DOOption) resourcePps { _resourcePps.ALL = field.NewAsterisk(tableName) _resourcePps.ID = field.NewInt32(tableName, "id") _resourcePps.ResourceID = field.NewInt32(tableName, "resource_id") - _resourcePps.CreatedAt = field.NewTime(tableName, "created_at") - _resourcePps.UpdatedAt = field.NewTime(tableName, "updated_at") + _resourcePps.CreatedAt = field.NewField(tableName, "created_at") + _resourcePps.UpdatedAt = field.NewField(tableName, "updated_at") _resourcePps.DeletedAt = field.NewField(tableName, "deleted_at") _resourcePps.fillFieldMap() @@ -44,8 +44,8 @@ type resourcePps struct { ALL field.Asterisk ID field.Int32 // ID ResourceID field.Int32 // 套餐ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -65,8 +65,8 @@ func (r *resourcePps) updateTableName(table string) *resourcePps { r.ALL = field.NewAsterisk(table) r.ID = field.NewInt32(table, "id") r.ResourceID = field.NewInt32(table, "resource_id") - r.CreatedAt = field.NewTime(table, "created_at") - r.UpdatedAt = field.NewTime(table, "updated_at") + r.CreatedAt = field.NewField(table, "created_at") + r.UpdatedAt = field.NewField(table, "updated_at") r.DeletedAt = field.NewField(table, "deleted_at") r.fillFieldMap() diff --git a/web/queries/resource_psr.gen.go b/web/queries/resource_psr.gen.go index a1b752c..7d8c6f6 100644 --- a/web/queries/resource_psr.gen.go +++ b/web/queries/resource_psr.gen.go @@ -33,8 +33,8 @@ func newResourcePsr(db *gorm.DB, opts ...gen.DOOption) resourcePsr { _resourcePsr.Conn = field.NewInt32(tableName, "conn") _resourcePsr.Expire = field.NewTime(tableName, "expire") _resourcePsr.Used = field.NewBool(tableName, "used") - _resourcePsr.CreatedAt = field.NewTime(tableName, "created_at") - _resourcePsr.UpdatedAt = field.NewTime(tableName, "updated_at") + _resourcePsr.CreatedAt = field.NewField(tableName, "created_at") + _resourcePsr.UpdatedAt = field.NewField(tableName, "updated_at") _resourcePsr.DeletedAt = field.NewField(tableName, "deleted_at") _resourcePsr.fillFieldMap() @@ -52,8 +52,8 @@ type resourcePsr struct { Conn field.Int32 // 最大连接数 Expire field.Time // 过期时间 Used field.Bool // 是否已使用 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -77,8 +77,8 @@ func (r *resourcePsr) updateTableName(table string) *resourcePsr { r.Conn = field.NewInt32(table, "conn") r.Expire = field.NewTime(table, "expire") r.Used = field.NewBool(table, "used") - r.CreatedAt = field.NewTime(table, "created_at") - r.UpdatedAt = field.NewTime(table, "updated_at") + r.CreatedAt = field.NewField(table, "created_at") + r.UpdatedAt = field.NewField(table, "updated_at") r.DeletedAt = field.NewField(table, "deleted_at") r.fillFieldMap() diff --git a/web/queries/resource_pss.gen.go b/web/queries/resource_pss.gen.go index b61a4a0..8f0adde 100644 --- a/web/queries/resource_pss.gen.go +++ b/web/queries/resource_pss.gen.go @@ -37,8 +37,8 @@ func newResourcePss(db *gorm.DB, opts ...gen.DOOption) resourcePss { _resourcePss.DailyLimit = field.NewInt32(tableName, "daily_limit") _resourcePss.DailyUsed = field.NewInt32(tableName, "daily_used") _resourcePss.DailyLast = field.NewTime(tableName, "daily_last") - _resourcePss.CreatedAt = field.NewTime(tableName, "created_at") - _resourcePss.UpdatedAt = field.NewTime(tableName, "updated_at") + _resourcePss.CreatedAt = field.NewField(tableName, "created_at") + _resourcePss.UpdatedAt = field.NewField(tableName, "updated_at") _resourcePss.DeletedAt = field.NewField(tableName, "deleted_at") _resourcePss.fillFieldMap() @@ -60,8 +60,8 @@ type resourcePss struct { DailyLimit field.Int32 // 每日限制 DailyUsed field.Int32 // 今日已用数量 DailyLast field.Time // 今日最后使用时间 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -89,8 +89,8 @@ func (r *resourcePss) updateTableName(table string) *resourcePss { r.DailyLimit = field.NewInt32(table, "daily_limit") r.DailyUsed = field.NewInt32(table, "daily_used") r.DailyLast = field.NewTime(table, "daily_last") - r.CreatedAt = field.NewTime(table, "created_at") - r.UpdatedAt = field.NewTime(table, "updated_at") + r.CreatedAt = field.NewField(table, "created_at") + r.UpdatedAt = field.NewField(table, "updated_at") r.DeletedAt = field.NewField(table, "deleted_at") r.fillFieldMap() diff --git a/web/queries/trade.gen.go b/web/queries/trade.gen.go index 6d4fc51..33c736f 100644 --- a/web/queries/trade.gen.go +++ b/web/queries/trade.gen.go @@ -37,8 +37,8 @@ func newTrade(db *gorm.DB, opts ...gen.DOOption) trade { _trade.Payment = field.NewFloat64(tableName, "payment") _trade.Method = field.NewInt32(tableName, "method") _trade.Status = field.NewInt32(tableName, "status") - _trade.CreatedAt = field.NewTime(tableName, "created_at") - _trade.UpdatedAt = field.NewTime(tableName, "updated_at") + _trade.CreatedAt = field.NewField(tableName, "created_at") + _trade.UpdatedAt = field.NewField(tableName, "updated_at") _trade.DeletedAt = field.NewField(tableName, "deleted_at") _trade.Type = field.NewInt32(tableName, "type") _trade.CancelAt = field.NewTime(tableName, "cancel_at") @@ -63,8 +63,8 @@ type trade struct { Payment field.Float64 // 支付金额 Method field.Int32 // 支付方式:1-支付宝,2-微信 Status field.Int32 // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 Type field.Int32 CancelAt field.Time @@ -95,8 +95,8 @@ func (t *trade) updateTableName(table string) *trade { t.Payment = field.NewFloat64(table, "payment") t.Method = field.NewInt32(table, "method") t.Status = field.NewInt32(table, "status") - t.CreatedAt = field.NewTime(table, "created_at") - t.UpdatedAt = field.NewTime(table, "updated_at") + t.CreatedAt = field.NewField(table, "created_at") + t.UpdatedAt = field.NewField(table, "updated_at") t.DeletedAt = field.NewField(table, "deleted_at") t.Type = field.NewInt32(table, "type") t.CancelAt = field.NewTime(table, "cancel_at") diff --git a/web/queries/user.gen.go b/web/queries/user.gen.go index 9bd79bf..3100378 100644 --- a/web/queries/user.gen.go +++ b/web/queries/user.gen.go @@ -45,8 +45,8 @@ func newUser(db *gorm.DB, opts ...gen.DOOption) user { _user.LastLogin = field.NewTime(tableName, "last_login") _user.LastLoginHost = field.NewString(tableName, "last_login_host") _user.LastLoginAgent = field.NewString(tableName, "last_login_agent") - _user.CreatedAt = field.NewTime(tableName, "created_at") - _user.UpdatedAt = field.NewTime(tableName, "updated_at") + _user.CreatedAt = field.NewField(tableName, "created_at") + _user.UpdatedAt = field.NewField(tableName, "updated_at") _user.DeletedAt = field.NewField(tableName, "deleted_at") _user.fillFieldMap() @@ -76,8 +76,8 @@ type user struct { LastLogin field.Time // 最后登录时间 LastLoginHost field.String // 最后登录地址 LastLoginAgent field.String // 最后登录代理 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -113,8 +113,8 @@ func (u *user) updateTableName(table string) *user { u.LastLogin = field.NewTime(table, "last_login") u.LastLoginHost = field.NewString(table, "last_login_host") u.LastLoginAgent = field.NewString(table, "last_login_agent") - u.CreatedAt = field.NewTime(table, "created_at") - u.UpdatedAt = field.NewTime(table, "updated_at") + u.CreatedAt = field.NewField(table, "created_at") + u.UpdatedAt = field.NewField(table, "updated_at") u.DeletedAt = field.NewField(table, "deleted_at") u.fillFieldMap() diff --git a/web/queries/user_role.gen.go b/web/queries/user_role.gen.go index 7a6aad6..f0401a6 100644 --- a/web/queries/user_role.gen.go +++ b/web/queries/user_role.gen.go @@ -32,8 +32,8 @@ func newUserRole(db *gorm.DB, opts ...gen.DOOption) userRole { _userRole.Description = field.NewString(tableName, "description") _userRole.Active = field.NewBool(tableName, "active") _userRole.Sort = field.NewInt32(tableName, "sort") - _userRole.CreatedAt = field.NewTime(tableName, "created_at") - _userRole.UpdatedAt = field.NewTime(tableName, "updated_at") + _userRole.CreatedAt = field.NewField(tableName, "created_at") + _userRole.UpdatedAt = field.NewField(tableName, "updated_at") _userRole.DeletedAt = field.NewField(tableName, "deleted_at") _userRole.fillFieldMap() @@ -50,8 +50,8 @@ type userRole struct { Description field.String // 角色描述 Active field.Bool // 是否激活 Sort field.Int32 // 排序 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -74,8 +74,8 @@ func (u *userRole) updateTableName(table string) *userRole { u.Description = field.NewString(table, "description") u.Active = field.NewBool(table, "active") u.Sort = field.NewInt32(table, "sort") - u.CreatedAt = field.NewTime(table, "created_at") - u.UpdatedAt = field.NewTime(table, "updated_at") + u.CreatedAt = field.NewField(table, "created_at") + u.UpdatedAt = field.NewField(table, "updated_at") u.DeletedAt = field.NewField(table, "deleted_at") u.fillFieldMap() diff --git a/web/queries/user_role_link.gen.go b/web/queries/user_role_link.gen.go index 8d7c3b3..25db08f 100644 --- a/web/queries/user_role_link.gen.go +++ b/web/queries/user_role_link.gen.go @@ -30,8 +30,8 @@ func newUserRoleLink(db *gorm.DB, opts ...gen.DOOption) userRoleLink { _userRoleLink.ID = field.NewInt32(tableName, "id") _userRoleLink.UserID = field.NewInt32(tableName, "user_id") _userRoleLink.RoleID = field.NewInt32(tableName, "role_id") - _userRoleLink.CreatedAt = field.NewTime(tableName, "created_at") - _userRoleLink.UpdatedAt = field.NewTime(tableName, "updated_at") + _userRoleLink.CreatedAt = field.NewField(tableName, "created_at") + _userRoleLink.UpdatedAt = field.NewField(tableName, "updated_at") _userRoleLink.DeletedAt = field.NewField(tableName, "deleted_at") _userRoleLink.fillFieldMap() @@ -46,8 +46,8 @@ type userRoleLink struct { ID field.Int32 // 关联ID UserID field.Int32 // 用户ID RoleID field.Int32 // 角色ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (u *userRoleLink) updateTableName(table string) *userRoleLink { u.ID = field.NewInt32(table, "id") u.UserID = field.NewInt32(table, "user_id") u.RoleID = field.NewInt32(table, "role_id") - u.CreatedAt = field.NewTime(table, "created_at") - u.UpdatedAt = field.NewTime(table, "updated_at") + u.CreatedAt = field.NewField(table, "created_at") + u.UpdatedAt = field.NewField(table, "updated_at") u.DeletedAt = field.NewField(table, "deleted_at") u.fillFieldMap() diff --git a/web/queries/user_role_permission_link.gen.go b/web/queries/user_role_permission_link.gen.go index 7e03401..820cbfd 100644 --- a/web/queries/user_role_permission_link.gen.go +++ b/web/queries/user_role_permission_link.gen.go @@ -30,8 +30,8 @@ func newUserRolePermissionLink(db *gorm.DB, opts ...gen.DOOption) userRolePermis _userRolePermissionLink.ID = field.NewInt32(tableName, "id") _userRolePermissionLink.RoleID = field.NewInt32(tableName, "role_id") _userRolePermissionLink.PermissionID = field.NewInt32(tableName, "permission_id") - _userRolePermissionLink.CreatedAt = field.NewTime(tableName, "created_at") - _userRolePermissionLink.UpdatedAt = field.NewTime(tableName, "updated_at") + _userRolePermissionLink.CreatedAt = field.NewField(tableName, "created_at") + _userRolePermissionLink.UpdatedAt = field.NewField(tableName, "updated_at") _userRolePermissionLink.DeletedAt = field.NewField(tableName, "deleted_at") _userRolePermissionLink.fillFieldMap() @@ -46,8 +46,8 @@ type userRolePermissionLink struct { ID field.Int32 // 关联ID RoleID field.Int32 // 角色ID PermissionID field.Int32 // 权限ID - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 fieldMap map[string]field.Expr @@ -68,8 +68,8 @@ func (u *userRolePermissionLink) updateTableName(table string) *userRolePermissi u.ID = field.NewInt32(table, "id") u.RoleID = field.NewInt32(table, "role_id") u.PermissionID = field.NewInt32(table, "permission_id") - u.CreatedAt = field.NewTime(table, "created_at") - u.UpdatedAt = field.NewTime(table, "updated_at") + u.CreatedAt = field.NewField(table, "created_at") + u.UpdatedAt = field.NewField(table, "updated_at") u.DeletedAt = field.NewField(table, "deleted_at") u.fillFieldMap() diff --git a/web/queries/whitelist.gen.go b/web/queries/whitelist.gen.go index bfc7025..4e62ed6 100644 --- a/web/queries/whitelist.gen.go +++ b/web/queries/whitelist.gen.go @@ -30,8 +30,8 @@ func newWhitelist(db *gorm.DB, opts ...gen.DOOption) whitelist { _whitelist.ID = field.NewInt32(tableName, "id") _whitelist.UserID = field.NewInt32(tableName, "user_id") _whitelist.Host = field.NewString(tableName, "host") - _whitelist.CreatedAt = field.NewTime(tableName, "created_at") - _whitelist.UpdatedAt = field.NewTime(tableName, "updated_at") + _whitelist.CreatedAt = field.NewField(tableName, "created_at") + _whitelist.UpdatedAt = field.NewField(tableName, "updated_at") _whitelist.DeletedAt = field.NewField(tableName, "deleted_at") _whitelist.Remark = field.NewString(tableName, "remark") @@ -47,8 +47,8 @@ type whitelist struct { ID field.Int32 // 白名单ID UserID field.Int32 // 用户ID Host field.String // IP地址 - CreatedAt field.Time // 创建时间 - UpdatedAt field.Time // 更新时间 + CreatedAt field.Field // 创建时间 + UpdatedAt field.Field // 更新时间 DeletedAt field.Field // 删除时间 Remark field.String @@ -70,8 +70,8 @@ func (w *whitelist) updateTableName(table string) *whitelist { w.ID = field.NewInt32(table, "id") w.UserID = field.NewInt32(table, "user_id") w.Host = field.NewString(table, "host") - w.CreatedAt = field.NewTime(table, "created_at") - w.UpdatedAt = field.NewTime(table, "updated_at") + w.CreatedAt = field.NewField(table, "created_at") + w.UpdatedAt = field.NewField(table, "updated_at") w.DeletedAt = field.NewField(table, "deleted_at") w.Remark = field.NewString(table, "remark") diff --git a/web/router.go b/web/router.go index 4811b9b..f883263 100644 --- a/web/router.go +++ b/web/router.go @@ -30,6 +30,7 @@ func ApplyRouters(app *fiber.App) { // 资源 resource := api.Group("/resource") + resource.Post("/list/pss", handlers.ListResourcePss) resource.Post("/create/balance", handlers.CreateResourceByBalance) // 用户