新增自定义数据库映射类型 LocalDateTime,完善套餐查询接口

This commit is contained in:
2025-04-10 17:49:11 +08:00
parent 02897db890
commit c1b4f8d605
52 changed files with 532 additions and 447 deletions

View File

@@ -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",

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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

1
web/handlers/bill.go Normal file
View File

@@ -0,0 +1 @@
package handlers

View File

@@ -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 {

View File

@@ -5,29 +5,28 @@
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameAdmin = "admin"
// Admin mapped from table <admin>
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

View File

@@ -4,24 +4,20 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameAdminRole = "admin_role"
// AdminRole mapped from table <admin_role>
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

View File

@@ -4,22 +4,18 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameAdminRoleLink = "admin_role_link"
// AdminRoleLink mapped from table <admin_role_link>
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

View File

@@ -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 <admin_role_permission_link>
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

View File

@@ -4,28 +4,24 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameBill = "bill"
// Bill mapped from table <bill>
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

View File

@@ -4,30 +4,26 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameClient = "client"
// Client mapped from table <client>
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-web1-native2-browser" json:"spec"` // 安全规范0-web1-native2-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-web1-native2-browser" json:"spec"` // 安全规范0-web1-native2-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

View File

@@ -4,22 +4,18 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameClientPermissionLink = "client_permission_link"
// ClientPermissionLink mapped from table <client_permission_link>
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

View File

@@ -4,31 +4,27 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameNode = "node"
// Node mapped from table <node>
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

View File

@@ -4,23 +4,19 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNamePermission = "permission"
// Permission mapped from table <permission>
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

View File

@@ -4,25 +4,21 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameProduct = "product"
// Product mapped from table <product>
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

View File

@@ -4,25 +4,21 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameProxy = "proxy"
// Proxy mapped from table <proxy>
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

View File

@@ -4,23 +4,19 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameRefund = "refund"
// Refund mapped from table <refund>
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

View File

@@ -4,22 +4,18 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
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 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

View File

@@ -4,21 +4,17 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameResourcePps = "resource_pps"
// ResourcePps mapped from table <resource_pps>
type ResourcePps struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
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

View File

@@ -5,24 +5,23 @@
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameResourcePsr = "resource_psr"
// ResourcePsr mapped from table <resource_psr>
type ResourcePsr struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:ID" json:"id"` // ID
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Live int32 `gorm:"column:live;comment:轮换周期(秒)" json:"live"` // 轮换周期(秒)
Conn int32 `gorm:"column:conn;comment:最大连接数" json:"conn"` // 最大连接数
Expire 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

View File

@@ -5,28 +5,27 @@
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameResourcePss = "resource_pss"
// ResourcePss mapped from table <resource_pss>
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

View File

@@ -5,31 +5,30 @@
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameTrade = "trade"
// Trade mapped from table <trade>
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

View File

@@ -5,36 +5,35 @@
package models
import (
"platform/web/common"
"time"
"gorm.io/gorm"
)
const TableNameUser = "user"
// User mapped from table <user>
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

View File

@@ -4,24 +4,20 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameUserRole = "user_role"
// UserRole mapped from table <user_role>
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

View File

@@ -4,22 +4,18 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameUserRoleLink = "user_role_link"
// UserRoleLink mapped from table <user_role_link>
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

View File

@@ -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 <user_role_permission_link>
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

View File

@@ -4,23 +4,19 @@
package models
import (
"time"
"gorm.io/gorm"
)
import "platform/web/common"
const TableNameWhitelist = "whitelist"
// Whitelist mapped from table <whitelist>
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

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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")

View File

@@ -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")

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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")

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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")

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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")

View File

@@ -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)
// 用户