添加访问日志表及相关字段,更新模型字段注释
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
- 页面 账户总览
|
- 页面 账户总览
|
||||||
- 页面 提取记录
|
- 页面 提取记录
|
||||||
- 页面 使用记录
|
- 页面 使用记录
|
||||||
|
- 代理数据表的 secret 字段 aes 加密存储
|
||||||
|
|
||||||
### 下阶段
|
### 下阶段
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"golang.org/x/crypto/bcrypt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"math"
|
|
||||||
"platform/pkg/env"
|
"platform/pkg/env"
|
||||||
"platform/pkg/logs"
|
"platform/pkg/logs"
|
||||||
"platform/pkg/orm"
|
"platform/pkg/orm"
|
||||||
"platform/web/core"
|
|
||||||
m "platform/web/models"
|
m "platform/web/models"
|
||||||
q "platform/web/queries"
|
q "platform/web/queries"
|
||||||
"time"
|
|
||||||
|
|
||||||
"golang.org/x/crypto/bcrypt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -19,66 +15,48 @@ func main() {
|
|||||||
logs.Init()
|
logs.Init()
|
||||||
orm.Init()
|
orm.Init()
|
||||||
|
|
||||||
err := q.Q.Transaction(func(tx *q.Query) error {
|
err := q.Q.Transaction(func(tx *q.Query) (err error) {
|
||||||
|
|
||||||
_ = q.User.
|
// 代理
|
||||||
Select(q.User.Phone).
|
err = q.Proxy.
|
||||||
Create(&m.User{
|
|
||||||
Phone: "12312341234",
|
|
||||||
})
|
|
||||||
var user, _ = q.User.First()
|
|
||||||
|
|
||||||
_ = q.Resource.
|
|
||||||
Select(q.Resource.UserID, q.Resource.Active).
|
|
||||||
Create(&m.Resource{
|
|
||||||
UserID: user.ID,
|
|
||||||
Active: true,
|
|
||||||
Pss: &m.ResourcePss{
|
|
||||||
Live: 180,
|
|
||||||
Type: 1,
|
|
||||||
Expire: core.LocalDateTime(time.Now().Add(24 * time.Hour * 1000)),
|
|
||||||
DailyLimit: math.MaxInt32,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
_ = q.Proxy.
|
|
||||||
Select(q.Proxy.Version, q.Proxy.Name, q.Proxy.Host, q.Proxy.Type, q.Proxy.Secret).
|
Select(q.Proxy.Version, q.Proxy.Name, q.Proxy.Host, q.Proxy.Type, q.Proxy.Secret).
|
||||||
Create(&m.Proxy{
|
Create(&m.Proxy{
|
||||||
Version: 1,
|
Version: 1,
|
||||||
Name: "7a17e8b4-cdc3-4500-bf16-4a665991a7f6",
|
Name: "7a17e8b4-cdc3-4500-bf16-4a665991a7f6",
|
||||||
Host: "110.40.82.248",
|
Host: "110.40.82.248",
|
||||||
|
Type: 2,
|
||||||
|
Secret: "api:123456",
|
||||||
|
}, &m.Proxy{
|
||||||
|
Version: 1,
|
||||||
|
Name: "58e03f38-4cef-429c-8bb8-530142d0a745",
|
||||||
|
Host: "123.6.147.241",
|
||||||
Type: 1,
|
Type: 1,
|
||||||
Secret: "api:123456",
|
Secret: "api:123456",
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_ = q.Node.
|
// 客户端
|
||||||
Select(
|
testSecret, err := bcrypt.GenerateFromPassword([]byte("test"), bcrypt.DefaultCost)
|
||||||
q.Node.Version,
|
if err != nil {
|
||||||
q.Node.Name,
|
return err
|
||||||
q.Node.Host,
|
}
|
||||||
q.Node.Isp,
|
|
||||||
q.Node.Prov,
|
|
||||||
q.Node.City,
|
|
||||||
q.Node.Status).
|
|
||||||
Create(&m.Node{
|
|
||||||
Version: 1,
|
|
||||||
Name: "test-node",
|
|
||||||
Host: "123",
|
|
||||||
Isp: 0,
|
|
||||||
Prov: "test-prov",
|
|
||||||
City: "test-city",
|
|
||||||
Status: 1})
|
|
||||||
|
|
||||||
var testSecret, _ = bcrypt.GenerateFromPassword([]byte("test"), bcrypt.DefaultCost)
|
tasksSecret, err := bcrypt.GenerateFromPassword([]byte("tasks"), bcrypt.DefaultCost)
|
||||||
var tasksSecret, _ = bcrypt.GenerateFromPassword([]byte("tasks"), bcrypt.DefaultCost)
|
if err != nil {
|
||||||
_ = q.Client.
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
err = q.Client.
|
||||||
Select(
|
Select(
|
||||||
q.Client.ClientID,
|
q.Client.ClientID,
|
||||||
q.Client.ClientSecret,
|
q.Client.ClientSecret,
|
||||||
q.Client.GrantClient,
|
q.Client.GrantClient,
|
||||||
q.Client.GrantRefresh,
|
q.Client.GrantRefresh,
|
||||||
q.Client.Spec,
|
q.Client.Spec,
|
||||||
q.Client.Name).
|
q.Client.Name,
|
||||||
|
).
|
||||||
Create(&m.Client{
|
Create(&m.Client{
|
||||||
ClientID: "test",
|
ClientID: "test",
|
||||||
ClientSecret: string(testSecret),
|
ClientSecret: string(testSecret),
|
||||||
@@ -94,6 +72,10 @@ func main() {
|
|||||||
Spec: 3,
|
Spec: 3,
|
||||||
Name: "异步任务处理服务",
|
Name: "异步任务处理服务",
|
||||||
})
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: platform-dev
|
name: server-dev
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
|
||||||
@@ -14,6 +14,16 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
postgres-migration:
|
||||||
|
image: postgres:17
|
||||||
|
restart: always
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: ${DB_USERNAME}
|
||||||
|
POSTGRES_PASSWORD: ${DB_PASSWORD}
|
||||||
|
POSTGRES_DB: ${DB_NAME}
|
||||||
|
ports:
|
||||||
|
- "5433:5432"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:7.4
|
image: redis:7.4
|
||||||
restart: always
|
restart: always
|
||||||
|
|||||||
@@ -21,6 +21,44 @@ $$;
|
|||||||
-- region 管理员信息
|
-- region 管理员信息
|
||||||
-- ====================
|
-- ====================
|
||||||
|
|
||||||
|
-- logs_request
|
||||||
|
drop table if exists logs_request cascade;
|
||||||
|
create table logs_request (
|
||||||
|
id serial primary key,
|
||||||
|
|
||||||
|
identity int,
|
||||||
|
visitor int,
|
||||||
|
ip varchar(45) not null,
|
||||||
|
ua varchar(255),
|
||||||
|
|
||||||
|
method varchar(10) not null,
|
||||||
|
path varchar(255) not null,
|
||||||
|
|
||||||
|
status int not null,
|
||||||
|
error varchar(255),
|
||||||
|
|
||||||
|
time timestamp default current_timestamp
|
||||||
|
);
|
||||||
|
|
||||||
|
-- logs_access表字段注释
|
||||||
|
comment on table logs_request is '访问日志表';
|
||||||
|
comment on column logs_request.id is '访问日志ID';
|
||||||
|
comment on column logs_request.identity is '访客身份:0-游客,1-用户,2-服务,3-管理员';
|
||||||
|
comment on column logs_request.visitor is '访客ID';
|
||||||
|
comment on column logs_request.ip is 'IP地址';
|
||||||
|
comment on column logs_request.ua is '用户代理';
|
||||||
|
comment on column logs_request.method is '请求方法';
|
||||||
|
comment on column logs_request.path is '请求路径';
|
||||||
|
comment on column logs_request.status is '响应状态码';
|
||||||
|
comment on column logs_request.error is '错误信息';
|
||||||
|
comment on column logs_request.time is '请求时间';
|
||||||
|
|
||||||
|
-- endregion
|
||||||
|
|
||||||
|
-- ====================
|
||||||
|
-- region 管理员信息
|
||||||
|
-- ====================
|
||||||
|
|
||||||
-- admin
|
-- admin
|
||||||
drop table if exists admin cascade;
|
drop table if exists admin cascade;
|
||||||
create table admin (
|
create table admin (
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type Admin struct {
|
|||||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
||||||
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
|
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
|
||||||
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
|
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
|
||||||
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
|
Status int32 `gorm:"column:status;not null;default:1;comment:状态:0-禁用,1-正常" json:"status"` // 状态:0-禁用,1-正常
|
||||||
LastLogin core.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
LastLogin core.LocalDateTime `gorm:"column:last_login;comment:最后登录时间" json:"last_login"` // 最后登录时间
|
||||||
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
|
||||||
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理
|
||||||
|
|||||||
@@ -14,16 +14,16 @@ const TableNameAnnouncement = "announcement"
|
|||||||
|
|
||||||
// Announcement mapped from table <announcement>
|
// Announcement mapped from table <announcement>
|
||||||
type Announcement struct {
|
type Announcement struct {
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`
|
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:公告ID" json:"id"` // 公告ID
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updated_at"`
|
Title string `gorm:"column:title;not null;comment:公告标题" json:"title"` // 公告标题
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
|
Content string `gorm:"column:content;comment:公告内容" json:"content"` // 公告内容
|
||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
|
Type int32 `gorm:"column:type;not null;default:1;comment:公告类型:1-普通公告" json:"type"` // 公告类型:1-普通公告
|
||||||
Type int32 `gorm:"column:type;not null;default:1" json:"type"`
|
Pin bool `gorm:"column:pin;not null;comment:是否置顶" json:"pin"` // 是否置顶
|
||||||
Status int32 `gorm:"column:status;not null;default:1" json:"status"`
|
Status int32 `gorm:"column:status;not null;default:1;comment:公告状态:0-禁用,1-正常" json:"status"` // 公告状态:0-禁用,1-正常
|
||||||
Sort int32 `gorm:"column:sort;not null" json:"sort"`
|
Sort int32 `gorm:"column:sort;not null;comment:公告排序" json:"sort"` // 公告排序
|
||||||
Pin bool `gorm:"column:pin;not null" json:"pin"`
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
Title string `gorm:"column:title;not null" json:"title"`
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
Content string `gorm:"column:content" json:"content"`
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Announcement's table name
|
// TableName Announcement's table name
|
||||||
|
|||||||
@@ -16,16 +16,16 @@ const TableNameBill = "bill"
|
|||||||
type Bill struct {
|
type Bill struct {
|
||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:账单ID" json:"id"` // 账单ID
|
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
|
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||||
|
TradeID int32 `gorm:"column:trade_id;comment:订单ID" json:"trade_id"` // 订单ID
|
||||||
|
ResourceID int32 `gorm:"column:resource_id;comment:套餐ID" json:"resource_id"` // 套餐ID
|
||||||
|
RefundID int32 `gorm:"column:refund_id;comment:退款ID" json:"refund_id"` // 退款ID
|
||||||
|
BillNo string `gorm:"column:bill_no;not null;comment:易读账单号" json:"bill_no"` // 易读账单号
|
||||||
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
|
Info string `gorm:"column:info;comment:产品可读信息" json:"info"` // 产品可读信息
|
||||||
|
Type int32 `gorm:"column:type;not null;comment:账单类型:1-消费,2-退款,3-充值" json:"type"` // 账单类型:1-消费,2-退款,3-充值
|
||||||
|
Amount float64 `gorm:"column:amount;not null;comment:账单金额" json:"amount"` // 账单金额
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
TradeID int32 `gorm:"column:trade_id;comment:订单ID" json:"trade_id"` // 订单ID
|
|
||||||
ResourceID int32 `gorm:"column:resource_id;comment:套餐ID" json:"resource_id"` // 套餐ID
|
|
||||||
Type int32 `gorm:"column:type;not null;comment:账单类型:0-充值,1-消费,2-退款" json:"type"` // 账单类型:0-充值,1-消费,2-退款
|
|
||||||
BillNo string `gorm:"column:bill_no;not null;comment:易读账单号" json:"bill_no"` // 易读账单号
|
|
||||||
RefundID int32 `gorm:"column:refund_id;comment:退款ID" json:"refund_id"` // 退款ID
|
|
||||||
Amount float64 `gorm:"column:amount;not null;comment:账单金额" json:"amount"` // 账单金额
|
|
||||||
Trade *Trade `gorm:"foreignKey:TradeID" json:"trade"`
|
Trade *Trade `gorm:"foreignKey:TradeID" json:"trade"`
|
||||||
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
|
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
|
||||||
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`
|
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`
|
||||||
|
|||||||
@@ -18,10 +18,12 @@ type Channel struct {
|
|||||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||||
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||||
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
|
||||||
|
ProxyHost string `gorm:"column:proxy_host;not null;comment:代理地址" json:"proxy_host"` // 代理地址
|
||||||
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
ProxyPort int32 `gorm:"column:proxy_port;not null;comment:转发端口" json:"proxy_port"` // 转发端口
|
||||||
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
|
||||||
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
NodeHost string `gorm:"column:node_host;comment:节点地址" json:"node_host"` // 节点地址
|
||||||
|
Protocol int32 `gorm:"column:protocol;comment:协议类型:1-http,2-https,3-socks5" json:"protocol"` // 协议类型:1-http,2-https,3-socks5
|
||||||
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
AuthIP bool `gorm:"column:auth_ip;not null;comment:IP认证" json:"auth_ip"` // IP认证
|
||||||
|
UserHost string `gorm:"column:user_host;comment:用户地址" json:"user_host"` // 用户地址
|
||||||
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
AuthPass bool `gorm:"column:auth_pass;not null;comment:密码认证" json:"auth_pass"` // 密码认证
|
||||||
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
|
||||||
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
Password string `gorm:"column:password;comment:密码" json:"password"` // 密码
|
||||||
@@ -29,8 +31,6 @@ type Channel struct {
|
|||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
|
|
||||||
Protocol int32 `gorm:"column:protocol;comment:协议类型:1-http,2-https,3-socks5" json:"protocol"` // 协议类型:1-http,2-https,3-socks5
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Channel's table name
|
// TableName Channel's table name
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ type Client struct {
|
|||||||
GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予
|
GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予
|
||||||
GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予
|
GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予
|
||||||
GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予
|
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
|
GrantPassword bool `gorm:"column:grant_password;not null;comment:允许密码授予" json:"grant_password"` // 允许密码授予
|
||||||
|
Spec int32 `gorm:"column:spec;not null;comment:安全规范:1-native,2-browser,3-web" json:"spec"` // 安全规范:1-native,2-browser,3-web
|
||||||
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
|
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
|
||||||
Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL
|
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-禁用
|
Status int32 `gorm:"column:status;not null;default:1;comment:状态:0-禁用,1-正常" json:"status"` // 状态:0-禁用,1-正常
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
GrantPassword bool `gorm:"column:grant_password;not null" json:"grant_password"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Client's table name
|
// TableName Client's table name
|
||||||
|
|||||||
@@ -14,17 +14,17 @@ const TableNameCoupon = "coupon"
|
|||||||
|
|
||||||
// Coupon mapped from table <coupon>
|
// Coupon mapped from table <coupon>
|
||||||
type Coupon struct {
|
type Coupon struct {
|
||||||
ExpireAt core.LocalDateTime `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
|
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
|
||||||
UpdatedAt core.LocalDateTime `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
|
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:优惠券ID" json:"id"` // 优惠券ID
|
||||||
UserID int32 `gorm:"column:user_id;comment:用户ID" json:"user_id"` // 用户ID
|
UserID int32 `gorm:"column:user_id;comment:用户ID" json:"user_id"` // 用户ID
|
||||||
Status int32 `gorm:"column:status;not null;comment:优惠券状态:0-未使用,1-已使用,2-已过期" json:"status"` // 优惠券状态:0-未使用,1-已使用,2-已过期
|
|
||||||
Code string `gorm:"column:code;not null;comment:优惠券代码" json:"code"` // 优惠券代码
|
Code string `gorm:"column:code;not null;comment:优惠券代码" json:"code"` // 优惠券代码
|
||||||
Remark string `gorm:"column:remark;comment:优惠券备注" json:"remark"` // 优惠券备注
|
Remark string `gorm:"column:remark;comment:优惠券备注" json:"remark"` // 优惠券备注
|
||||||
Amount float64 `gorm:"column:amount;not null;comment:优惠券金额" json:"amount"` // 优惠券金额
|
Amount float64 `gorm:"column:amount;not null;comment:优惠券金额" json:"amount"` // 优惠券金额
|
||||||
MinAmount float64 `gorm:"column:min_amount;not null;comment:最低消费金额" json:"min_amount"` // 最低消费金额
|
MinAmount float64 `gorm:"column:min_amount;not null;comment:最低消费金额" json:"min_amount"` // 最低消费金额
|
||||||
|
Status int32 `gorm:"column:status;not null;comment:优惠券状态:0-未使用,1-已使用,2-已过期" json:"status"` // 优惠券状态:0-未使用,1-已使用,2-已过期
|
||||||
|
ExpireAt core.LocalDateTime `gorm:"column:expire_at;comment:过期时间" json:"expire_at"` // 过期时间
|
||||||
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Coupon's table name
|
// TableName Coupon's table name
|
||||||
|
|||||||
28
web/models/logs_request.gen.go
Normal file
28
web/models/logs_request.gen.go
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package models
|
||||||
|
|
||||||
|
import "platform/web/core"
|
||||||
|
|
||||||
|
const TableNameLogsRequest = "logs_request"
|
||||||
|
|
||||||
|
// LogsRequest mapped from table <logs_request>
|
||||||
|
type LogsRequest struct {
|
||||||
|
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:访问日志ID" json:"id"` // 访问日志ID
|
||||||
|
Identity int32 `gorm:"column:identity;comment:访客身份:0-游客,1-用户,2-服务,3-管理员" json:"identity"` // 访客身份:0-游客,1-用户,2-服务,3-管理员
|
||||||
|
Visitor int32 `gorm:"column:visitor;comment:访客ID" json:"visitor"` // 访客ID
|
||||||
|
IP string `gorm:"column:ip;not null;comment:IP地址" json:"ip"` // IP地址
|
||||||
|
Ua string `gorm:"column:ua;comment:用户代理" json:"ua"` // 用户代理
|
||||||
|
Method string `gorm:"column:method;not null;comment:请求方法" json:"method"` // 请求方法
|
||||||
|
Path string `gorm:"column:path;not null;comment:请求路径" json:"path"` // 请求路径
|
||||||
|
Status int32 `gorm:"column:status;not null;comment:响应状态码" json:"status"` // 响应状态码
|
||||||
|
Error string `gorm:"column:error;comment:错误信息" json:"error"` // 错误信息
|
||||||
|
Time core.LocalDateTime `gorm:"column:time;default:CURRENT_TIMESTAMP;comment:请求时间" json:"time"` // 请求时间
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName LogsRequest's table name
|
||||||
|
func (*LogsRequest) TableName() string {
|
||||||
|
return TableNameLogsRequest
|
||||||
|
}
|
||||||
@@ -15,12 +15,13 @@ const TableNameNode = "node"
|
|||||||
// Node mapped from table <node>
|
// Node mapped from table <node>
|
||||||
type Node struct {
|
type Node struct {
|
||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID
|
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:节点ID" json:"id"` // 节点ID
|
||||||
|
ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID
|
||||||
Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本
|
Version int32 `gorm:"column:version;not null;comment:节点版本" json:"version"` // 节点版本
|
||||||
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
|
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
|
||||||
Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址
|
Host string `gorm:"column:host;not null;comment:节点地址" json:"host"` // 节点地址
|
||||||
|
Isp int32 `gorm:"column:isp;not null;comment:运营商:0-未知,1-电信,2-联通,3-移动" json:"isp"` // 运营商:0-未知,1-电信,2-联通,3-移动
|
||||||
Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份
|
Prov string `gorm:"column:prov;not null;comment:省份" json:"prov"` // 省份
|
||||||
City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市
|
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"` // 代理端口
|
ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口
|
||||||
Status int32 `gorm:"column:status;not null;comment:节点状态:0-离线,1-正常" json:"status"` // 节点状态:0-离线,1-正常
|
Status int32 `gorm:"column:status;not null;comment:节点状态:0-离线,1-正常" json:"status"` // 节点状态:0-离线,1-正常
|
||||||
Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟
|
Rtt int32 `gorm:"column:rtt;comment:延迟" json:"rtt"` // 延迟
|
||||||
@@ -28,7 +29,6 @@ type Node struct {
|
|||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
Isp int32 `gorm:"column:isp;not null;comment:运营商:0-其他,1-电信,2-联通,3-移动" json:"isp"` // 运营商:0-其他,1-电信,2-联通,3-移动
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Node's table name
|
// TableName Node's table name
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ type Product struct {
|
|||||||
Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称
|
Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称
|
||||||
Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述
|
Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述
|
||||||
Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序
|
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-禁用
|
Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:0-禁用,1-正常" json:"status"` // 产品状态:0-禁用,1-正常
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ type Proxy struct {
|
|||||||
Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本
|
Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本
|
||||||
Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称
|
Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称
|
||||||
Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址
|
Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址
|
||||||
Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方
|
Type int32 `gorm:"column:type;not null;comment:代理服务类型:1-三方,2-自有" json:"type"` // 代理服务类型:1-三方,2-自有
|
||||||
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
|
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
|
|||||||
@@ -15,14 +15,14 @@ const TableNameRefund = "refund"
|
|||||||
// Refund mapped from table <refund>
|
// Refund mapped from table <refund>
|
||||||
type Refund struct {
|
type Refund struct {
|
||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID
|
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:退款ID" json:"id"` // 退款ID
|
||||||
|
TradeID int32 `gorm:"column:trade_id;not null;comment:订单ID" json:"trade_id"` // 订单ID
|
||||||
ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID
|
ProductID int32 `gorm:"column:product_id;comment:产品ID" json:"product_id"` // 产品ID
|
||||||
Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额
|
Amount float64 `gorm:"column:amount;not null;comment:退款金额" json:"amount"` // 退款金额
|
||||||
|
Reason string `gorm:"column:reason;comment:退款原因" json:"reason"` // 退款原因
|
||||||
|
Status int32 `gorm:"column:status;not null;comment:退款状态:0-待处理,1-已退款,2-已拒绝" json:"status"` // 退款状态:0-待处理,1-已退款,2-已拒绝
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
TradeID int32 `gorm:"column:trade_id;not null;comment:订单ID" json:"trade_id"` // 订单ID
|
|
||||||
Reason string `gorm:"column:reason;comment:退款原因" json:"reason"` // 退款原因
|
|
||||||
Status int32 `gorm:"column:status;not null;comment:退款状态:0-待处理,1-已退款,2-已拒绝" json:"status"` // 退款状态:0-待处理,1-已退款,2-已拒绝
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Refund's table name
|
// TableName Refund's table name
|
||||||
|
|||||||
@@ -16,12 +16,12 @@ const TableNameResource = "resource"
|
|||||||
type Resource struct {
|
type Resource struct {
|
||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
|
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
|
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
|
||||||
|
ResourceNo string `gorm:"column:resource_no;comment:套餐编号" json:"resource_no"` // 套餐编号
|
||||||
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
Active bool `gorm:"column:active;not null;default:true;comment:套餐状态" json:"active"` // 套餐状态
|
||||||
|
Type int32 `gorm:"column:type;not null;comment:套餐类型:1-动态,2-隧道,3-独享" json:"type"` // 套餐类型:1-动态,2-隧道,3-独享
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
ResourceNo string `gorm:"column:resource_no;comment:套餐编号" json:"resource_no"` // 套餐编号
|
|
||||||
Type int32 `gorm:"column:type;not null;comment:套餐类型:1-动态,2-隧道,3-独享" json:"type"` // 套餐类型:1-动态,2-隧道,3-独享
|
|
||||||
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
|
Pss *ResourcePss `gorm:"foreignKey:ResourceID;references:ID" json:"pss"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ type ResourcePss struct {
|
|||||||
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_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-包量
|
Type int32 `gorm:"column:type;comment:套餐类型:1-包时,2-包量" json:"type"` // 套餐类型:1-包时,2-包量
|
||||||
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
|
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
|
||||||
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
|
|
||||||
Expire core.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
Expire core.LocalDateTime `gorm:"column:expire;comment:过期时间" json:"expire"` // 过期时间
|
||||||
|
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
|
||||||
Used int32 `gorm:"column:used;not null;comment:已用数量" json:"used"` // 已用数量
|
Used int32 `gorm:"column:used;not null;comment:已用数量" json:"used"` // 已用数量
|
||||||
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
|
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
|
||||||
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量
|
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量
|
||||||
|
|||||||
@@ -18,19 +18,19 @@ type Trade struct {
|
|||||||
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_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"` // 内部订单号
|
InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号
|
||||||
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
|
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
|
||||||
|
Type int32 `gorm:"column:type;not null;comment:订单类型:1-购买产品,2-充值余额" json:"type"` // 订单类型:1-购买产品,2-充值余额
|
||||||
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
|
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
|
||||||
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
|
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
|
||||||
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
|
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
|
||||||
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
|
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
|
||||||
Method int32 `gorm:"column:method;not null;comment:支付方式:1-支付宝,2-微信" json:"method"` // 支付方式:1-支付宝,2-微信
|
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-已退款
|
Status int32 `gorm:"column:status;not null;comment:订单状态:0-待支付,1-已支付,2-已取消,3-已退款" json:"status"` // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
||||||
|
PayURL string `gorm:"column:pay_url;comment:支付链接" json:"pay_url"` // 支付链接
|
||||||
|
PaidAt core.LocalDateTime `gorm:"column:paid_at;comment:支付时间" json:"paid_at"` // 支付时间
|
||||||
|
CancelAt core.LocalDateTime `gorm:"column:cancel_at;comment:取消时间" json:"cancel_at"` // 取消时间
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
Type int32 `gorm:"column:type;not null;comment:订单类型:0-充值余额,1-购买产品" json:"type"` // 订单类型:0-充值余额,1-购买产品
|
|
||||||
CancelAt core.LocalDateTime `gorm:"column:cancel_at;comment:取消时间" json:"cancel_at"` // 取消时间
|
|
||||||
PaidAt core.LocalDateTime `gorm:"column:paid_at;comment:支付时间" json:"paid_at"` // 支付时间
|
|
||||||
PayURL string `gorm:"column:pay_url;comment:支付链接" json:"pay_url"` // 支付链接
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Trade's table name
|
// TableName Trade's table name
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ type User struct {
|
|||||||
Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码
|
Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码
|
||||||
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
|
||||||
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
|
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-禁用
|
Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:0-禁用,1-正常" json:"status"` // 用户状态:0-禁用,1-正常
|
||||||
Balance float64 `gorm:"column:balance;not null;comment:账户余额" json:"balance"` // 账户余额
|
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-企业认证
|
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"` // 身份证号或营业执照号
|
IDNo string `gorm:"column:id_no;comment:身份证号或营业执照号" json:"id_no"` // 身份证号或营业执照号
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ type Whitelist struct {
|
|||||||
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:白名单ID" json:"id"` // 白名单ID
|
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
|
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地址
|
Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址
|
||||||
|
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
|
||||||
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP;comment:创建时间" json:"created_at"` // 创建时间
|
||||||
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP;comment:更新时间" json:"updated_at"` // 更新时间
|
||||||
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;comment:删除时间" json:"deleted_at"` // 删除时间
|
||||||
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TableName Whitelist's table name
|
// TableName Whitelist's table name
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ type admin struct {
|
|||||||
Avatar field.String // 头像URL
|
Avatar field.String // 头像URL
|
||||||
Phone field.String // 手机号码
|
Phone field.String // 手机号码
|
||||||
Email field.String // 邮箱
|
Email field.String // 邮箱
|
||||||
Status field.Int32 // 状态:1-正常,0-禁用
|
Status field.Int32 // 状态:0-禁用,1-正常
|
||||||
LastLogin field.Field // 最后登录时间
|
LastLogin field.Field // 最后登录时间
|
||||||
LastLoginHost field.String // 最后登录地址
|
LastLoginHost field.String // 最后登录地址
|
||||||
LastLoginAgent field.String // 最后登录代理
|
LastLoginAgent field.String // 最后登录代理
|
||||||
|
|||||||
@@ -27,16 +27,16 @@ func newAnnouncement(db *gorm.DB, opts ...gen.DOOption) announcement {
|
|||||||
|
|
||||||
tableName := _announcement.announcementDo.TableName()
|
tableName := _announcement.announcementDo.TableName()
|
||||||
_announcement.ALL = field.NewAsterisk(tableName)
|
_announcement.ALL = field.NewAsterisk(tableName)
|
||||||
|
_announcement.ID = field.NewInt32(tableName, "id")
|
||||||
|
_announcement.Title = field.NewString(tableName, "title")
|
||||||
|
_announcement.Content = field.NewString(tableName, "content")
|
||||||
|
_announcement.Type = field.NewInt32(tableName, "type")
|
||||||
|
_announcement.Pin = field.NewBool(tableName, "pin")
|
||||||
|
_announcement.Status = field.NewInt32(tableName, "status")
|
||||||
|
_announcement.Sort = field.NewInt32(tableName, "sort")
|
||||||
_announcement.CreatedAt = field.NewField(tableName, "created_at")
|
_announcement.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_announcement.UpdatedAt = field.NewField(tableName, "updated_at")
|
_announcement.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_announcement.DeletedAt = field.NewField(tableName, "deleted_at")
|
_announcement.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_announcement.ID = field.NewInt32(tableName, "id")
|
|
||||||
_announcement.Type = field.NewInt32(tableName, "type")
|
|
||||||
_announcement.Status = field.NewInt32(tableName, "status")
|
|
||||||
_announcement.Sort = field.NewInt32(tableName, "sort")
|
|
||||||
_announcement.Pin = field.NewBool(tableName, "pin")
|
|
||||||
_announcement.Title = field.NewString(tableName, "title")
|
|
||||||
_announcement.Content = field.NewString(tableName, "content")
|
|
||||||
|
|
||||||
_announcement.fillFieldMap()
|
_announcement.fillFieldMap()
|
||||||
|
|
||||||
@@ -47,16 +47,16 @@ type announcement struct {
|
|||||||
announcementDo
|
announcementDo
|
||||||
|
|
||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
CreatedAt field.Field
|
ID field.Int32 // 公告ID
|
||||||
UpdatedAt field.Field
|
Title field.String // 公告标题
|
||||||
DeletedAt field.Field
|
Content field.String // 公告内容
|
||||||
ID field.Int32
|
Type field.Int32 // 公告类型:1-普通公告
|
||||||
Type field.Int32
|
Pin field.Bool // 是否置顶
|
||||||
Status field.Int32
|
Status field.Int32 // 公告状态:0-禁用,1-正常
|
||||||
Sort field.Int32
|
Sort field.Int32 // 公告排序
|
||||||
Pin field.Bool
|
CreatedAt field.Field // 创建时间
|
||||||
Title field.String
|
UpdatedAt field.Field // 更新时间
|
||||||
Content field.String
|
DeletedAt field.Field // 删除时间
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -73,16 +73,16 @@ func (a announcement) As(alias string) *announcement {
|
|||||||
|
|
||||||
func (a *announcement) updateTableName(table string) *announcement {
|
func (a *announcement) updateTableName(table string) *announcement {
|
||||||
a.ALL = field.NewAsterisk(table)
|
a.ALL = field.NewAsterisk(table)
|
||||||
|
a.ID = field.NewInt32(table, "id")
|
||||||
|
a.Title = field.NewString(table, "title")
|
||||||
|
a.Content = field.NewString(table, "content")
|
||||||
|
a.Type = field.NewInt32(table, "type")
|
||||||
|
a.Pin = field.NewBool(table, "pin")
|
||||||
|
a.Status = field.NewInt32(table, "status")
|
||||||
|
a.Sort = field.NewInt32(table, "sort")
|
||||||
a.CreatedAt = field.NewField(table, "created_at")
|
a.CreatedAt = field.NewField(table, "created_at")
|
||||||
a.UpdatedAt = field.NewField(table, "updated_at")
|
a.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
a.DeletedAt = field.NewField(table, "deleted_at")
|
a.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
a.ID = field.NewInt32(table, "id")
|
|
||||||
a.Type = field.NewInt32(table, "type")
|
|
||||||
a.Status = field.NewInt32(table, "status")
|
|
||||||
a.Sort = field.NewInt32(table, "sort")
|
|
||||||
a.Pin = field.NewBool(table, "pin")
|
|
||||||
a.Title = field.NewString(table, "title")
|
|
||||||
a.Content = field.NewString(table, "content")
|
|
||||||
|
|
||||||
a.fillFieldMap()
|
a.fillFieldMap()
|
||||||
|
|
||||||
@@ -100,16 +100,16 @@ func (a *announcement) GetFieldByName(fieldName string) (field.OrderExpr, bool)
|
|||||||
|
|
||||||
func (a *announcement) fillFieldMap() {
|
func (a *announcement) fillFieldMap() {
|
||||||
a.fieldMap = make(map[string]field.Expr, 10)
|
a.fieldMap = make(map[string]field.Expr, 10)
|
||||||
|
a.fieldMap["id"] = a.ID
|
||||||
|
a.fieldMap["title"] = a.Title
|
||||||
|
a.fieldMap["content"] = a.Content
|
||||||
|
a.fieldMap["type"] = a.Type
|
||||||
|
a.fieldMap["pin"] = a.Pin
|
||||||
|
a.fieldMap["status"] = a.Status
|
||||||
|
a.fieldMap["sort"] = a.Sort
|
||||||
a.fieldMap["created_at"] = a.CreatedAt
|
a.fieldMap["created_at"] = a.CreatedAt
|
||||||
a.fieldMap["updated_at"] = a.UpdatedAt
|
a.fieldMap["updated_at"] = a.UpdatedAt
|
||||||
a.fieldMap["deleted_at"] = a.DeletedAt
|
a.fieldMap["deleted_at"] = a.DeletedAt
|
||||||
a.fieldMap["id"] = a.ID
|
|
||||||
a.fieldMap["type"] = a.Type
|
|
||||||
a.fieldMap["status"] = a.Status
|
|
||||||
a.fieldMap["sort"] = a.Sort
|
|
||||||
a.fieldMap["pin"] = a.Pin
|
|
||||||
a.fieldMap["title"] = a.Title
|
|
||||||
a.fieldMap["content"] = a.Content
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a announcement) clone(db *gorm.DB) announcement {
|
func (a announcement) clone(db *gorm.DB) announcement {
|
||||||
|
|||||||
@@ -29,16 +29,16 @@ func newBill(db *gorm.DB, opts ...gen.DOOption) bill {
|
|||||||
_bill.ALL = field.NewAsterisk(tableName)
|
_bill.ALL = field.NewAsterisk(tableName)
|
||||||
_bill.ID = field.NewInt32(tableName, "id")
|
_bill.ID = field.NewInt32(tableName, "id")
|
||||||
_bill.UserID = field.NewInt32(tableName, "user_id")
|
_bill.UserID = field.NewInt32(tableName, "user_id")
|
||||||
|
_bill.TradeID = field.NewInt32(tableName, "trade_id")
|
||||||
|
_bill.ResourceID = field.NewInt32(tableName, "resource_id")
|
||||||
|
_bill.RefundID = field.NewInt32(tableName, "refund_id")
|
||||||
|
_bill.BillNo = field.NewString(tableName, "bill_no")
|
||||||
_bill.Info = field.NewString(tableName, "info")
|
_bill.Info = field.NewString(tableName, "info")
|
||||||
|
_bill.Type = field.NewInt32(tableName, "type")
|
||||||
|
_bill.Amount = field.NewFloat64(tableName, "amount")
|
||||||
_bill.CreatedAt = field.NewField(tableName, "created_at")
|
_bill.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_bill.UpdatedAt = field.NewField(tableName, "updated_at")
|
_bill.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_bill.DeletedAt = field.NewField(tableName, "deleted_at")
|
_bill.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_bill.TradeID = field.NewInt32(tableName, "trade_id")
|
|
||||||
_bill.ResourceID = field.NewInt32(tableName, "resource_id")
|
|
||||||
_bill.Type = field.NewInt32(tableName, "type")
|
|
||||||
_bill.BillNo = field.NewString(tableName, "bill_no")
|
|
||||||
_bill.RefundID = field.NewInt32(tableName, "refund_id")
|
|
||||||
_bill.Amount = field.NewFloat64(tableName, "amount")
|
|
||||||
_bill.Trade = billBelongsToTrade{
|
_bill.Trade = billBelongsToTrade{
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
@@ -73,16 +73,16 @@ type bill struct {
|
|||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ID field.Int32 // 账单ID
|
ID field.Int32 // 账单ID
|
||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
|
TradeID field.Int32 // 订单ID
|
||||||
|
ResourceID field.Int32 // 套餐ID
|
||||||
|
RefundID field.Int32 // 退款ID
|
||||||
|
BillNo field.String // 易读账单号
|
||||||
Info field.String // 产品可读信息
|
Info field.String // 产品可读信息
|
||||||
|
Type field.Int32 // 账单类型:1-消费,2-退款,3-充值
|
||||||
|
Amount field.Float64 // 账单金额
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
TradeID field.Int32 // 订单ID
|
|
||||||
ResourceID field.Int32 // 套餐ID
|
|
||||||
Type field.Int32 // 账单类型:0-充值,1-消费,2-退款
|
|
||||||
BillNo field.String // 易读账单号
|
|
||||||
RefundID field.Int32 // 退款ID
|
|
||||||
Amount field.Float64 // 账单金额
|
|
||||||
Trade billBelongsToTrade
|
Trade billBelongsToTrade
|
||||||
|
|
||||||
Refund billBelongsToRefund
|
Refund billBelongsToRefund
|
||||||
@@ -106,16 +106,16 @@ func (b *bill) updateTableName(table string) *bill {
|
|||||||
b.ALL = field.NewAsterisk(table)
|
b.ALL = field.NewAsterisk(table)
|
||||||
b.ID = field.NewInt32(table, "id")
|
b.ID = field.NewInt32(table, "id")
|
||||||
b.UserID = field.NewInt32(table, "user_id")
|
b.UserID = field.NewInt32(table, "user_id")
|
||||||
|
b.TradeID = field.NewInt32(table, "trade_id")
|
||||||
|
b.ResourceID = field.NewInt32(table, "resource_id")
|
||||||
|
b.RefundID = field.NewInt32(table, "refund_id")
|
||||||
|
b.BillNo = field.NewString(table, "bill_no")
|
||||||
b.Info = field.NewString(table, "info")
|
b.Info = field.NewString(table, "info")
|
||||||
|
b.Type = field.NewInt32(table, "type")
|
||||||
|
b.Amount = field.NewFloat64(table, "amount")
|
||||||
b.CreatedAt = field.NewField(table, "created_at")
|
b.CreatedAt = field.NewField(table, "created_at")
|
||||||
b.UpdatedAt = field.NewField(table, "updated_at")
|
b.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
b.DeletedAt = field.NewField(table, "deleted_at")
|
b.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
b.TradeID = field.NewInt32(table, "trade_id")
|
|
||||||
b.ResourceID = field.NewInt32(table, "resource_id")
|
|
||||||
b.Type = field.NewInt32(table, "type")
|
|
||||||
b.BillNo = field.NewString(table, "bill_no")
|
|
||||||
b.RefundID = field.NewInt32(table, "refund_id")
|
|
||||||
b.Amount = field.NewFloat64(table, "amount")
|
|
||||||
|
|
||||||
b.fillFieldMap()
|
b.fillFieldMap()
|
||||||
|
|
||||||
@@ -135,16 +135,16 @@ func (b *bill) fillFieldMap() {
|
|||||||
b.fieldMap = make(map[string]field.Expr, 15)
|
b.fieldMap = make(map[string]field.Expr, 15)
|
||||||
b.fieldMap["id"] = b.ID
|
b.fieldMap["id"] = b.ID
|
||||||
b.fieldMap["user_id"] = b.UserID
|
b.fieldMap["user_id"] = b.UserID
|
||||||
|
b.fieldMap["trade_id"] = b.TradeID
|
||||||
|
b.fieldMap["resource_id"] = b.ResourceID
|
||||||
|
b.fieldMap["refund_id"] = b.RefundID
|
||||||
|
b.fieldMap["bill_no"] = b.BillNo
|
||||||
b.fieldMap["info"] = b.Info
|
b.fieldMap["info"] = b.Info
|
||||||
|
b.fieldMap["type"] = b.Type
|
||||||
|
b.fieldMap["amount"] = b.Amount
|
||||||
b.fieldMap["created_at"] = b.CreatedAt
|
b.fieldMap["created_at"] = b.CreatedAt
|
||||||
b.fieldMap["updated_at"] = b.UpdatedAt
|
b.fieldMap["updated_at"] = b.UpdatedAt
|
||||||
b.fieldMap["deleted_at"] = b.DeletedAt
|
b.fieldMap["deleted_at"] = b.DeletedAt
|
||||||
b.fieldMap["trade_id"] = b.TradeID
|
|
||||||
b.fieldMap["resource_id"] = b.ResourceID
|
|
||||||
b.fieldMap["type"] = b.Type
|
|
||||||
b.fieldMap["bill_no"] = b.BillNo
|
|
||||||
b.fieldMap["refund_id"] = b.RefundID
|
|
||||||
b.fieldMap["amount"] = b.Amount
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,10 +31,12 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
|
|||||||
_channel.UserID = field.NewInt32(tableName, "user_id")
|
_channel.UserID = field.NewInt32(tableName, "user_id")
|
||||||
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
|
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
|
||||||
_channel.NodeID = field.NewInt32(tableName, "node_id")
|
_channel.NodeID = field.NewInt32(tableName, "node_id")
|
||||||
|
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
|
||||||
_channel.ProxyPort = field.NewInt32(tableName, "proxy_port")
|
_channel.ProxyPort = field.NewInt32(tableName, "proxy_port")
|
||||||
_channel.UserHost = field.NewString(tableName, "user_host")
|
|
||||||
_channel.NodeHost = field.NewString(tableName, "node_host")
|
_channel.NodeHost = field.NewString(tableName, "node_host")
|
||||||
|
_channel.Protocol = field.NewInt32(tableName, "protocol")
|
||||||
_channel.AuthIP = field.NewBool(tableName, "auth_ip")
|
_channel.AuthIP = field.NewBool(tableName, "auth_ip")
|
||||||
|
_channel.UserHost = field.NewString(tableName, "user_host")
|
||||||
_channel.AuthPass = field.NewBool(tableName, "auth_pass")
|
_channel.AuthPass = field.NewBool(tableName, "auth_pass")
|
||||||
_channel.Username = field.NewString(tableName, "username")
|
_channel.Username = field.NewString(tableName, "username")
|
||||||
_channel.Password = field.NewString(tableName, "password")
|
_channel.Password = field.NewString(tableName, "password")
|
||||||
@@ -42,8 +44,6 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
|
|||||||
_channel.CreatedAt = field.NewField(tableName, "created_at")
|
_channel.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_channel.UpdatedAt = field.NewField(tableName, "updated_at")
|
_channel.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_channel.DeletedAt = field.NewField(tableName, "deleted_at")
|
_channel.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
|
|
||||||
_channel.Protocol = field.NewInt32(tableName, "protocol")
|
|
||||||
|
|
||||||
_channel.fillFieldMap()
|
_channel.fillFieldMap()
|
||||||
|
|
||||||
@@ -58,10 +58,12 @@ type channel struct {
|
|||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
ProxyID field.Int32 // 代理ID
|
ProxyID field.Int32 // 代理ID
|
||||||
NodeID field.Int32 // 节点ID
|
NodeID field.Int32 // 节点ID
|
||||||
|
ProxyHost field.String // 代理地址
|
||||||
ProxyPort field.Int32 // 转发端口
|
ProxyPort field.Int32 // 转发端口
|
||||||
UserHost field.String // 用户地址
|
|
||||||
NodeHost field.String // 节点地址
|
NodeHost field.String // 节点地址
|
||||||
|
Protocol field.Int32 // 协议类型:1-http,2-https,3-socks5
|
||||||
AuthIP field.Bool // IP认证
|
AuthIP field.Bool // IP认证
|
||||||
|
UserHost field.String // 用户地址
|
||||||
AuthPass field.Bool // 密码认证
|
AuthPass field.Bool // 密码认证
|
||||||
Username field.String // 用户名
|
Username field.String // 用户名
|
||||||
Password field.String // 密码
|
Password field.String // 密码
|
||||||
@@ -69,8 +71,6 @@ type channel struct {
|
|||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
ProxyHost field.String
|
|
||||||
Protocol field.Int32 // 协议类型:1-http,2-https,3-socks5
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -91,10 +91,12 @@ func (c *channel) updateTableName(table string) *channel {
|
|||||||
c.UserID = field.NewInt32(table, "user_id")
|
c.UserID = field.NewInt32(table, "user_id")
|
||||||
c.ProxyID = field.NewInt32(table, "proxy_id")
|
c.ProxyID = field.NewInt32(table, "proxy_id")
|
||||||
c.NodeID = field.NewInt32(table, "node_id")
|
c.NodeID = field.NewInt32(table, "node_id")
|
||||||
|
c.ProxyHost = field.NewString(table, "proxy_host")
|
||||||
c.ProxyPort = field.NewInt32(table, "proxy_port")
|
c.ProxyPort = field.NewInt32(table, "proxy_port")
|
||||||
c.UserHost = field.NewString(table, "user_host")
|
|
||||||
c.NodeHost = field.NewString(table, "node_host")
|
c.NodeHost = field.NewString(table, "node_host")
|
||||||
|
c.Protocol = field.NewInt32(table, "protocol")
|
||||||
c.AuthIP = field.NewBool(table, "auth_ip")
|
c.AuthIP = field.NewBool(table, "auth_ip")
|
||||||
|
c.UserHost = field.NewString(table, "user_host")
|
||||||
c.AuthPass = field.NewBool(table, "auth_pass")
|
c.AuthPass = field.NewBool(table, "auth_pass")
|
||||||
c.Username = field.NewString(table, "username")
|
c.Username = field.NewString(table, "username")
|
||||||
c.Password = field.NewString(table, "password")
|
c.Password = field.NewString(table, "password")
|
||||||
@@ -102,8 +104,6 @@ func (c *channel) updateTableName(table string) *channel {
|
|||||||
c.CreatedAt = field.NewField(table, "created_at")
|
c.CreatedAt = field.NewField(table, "created_at")
|
||||||
c.UpdatedAt = field.NewField(table, "updated_at")
|
c.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
c.DeletedAt = field.NewField(table, "deleted_at")
|
c.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
c.ProxyHost = field.NewString(table, "proxy_host")
|
|
||||||
c.Protocol = field.NewInt32(table, "protocol")
|
|
||||||
|
|
||||||
c.fillFieldMap()
|
c.fillFieldMap()
|
||||||
|
|
||||||
@@ -125,10 +125,12 @@ func (c *channel) fillFieldMap() {
|
|||||||
c.fieldMap["user_id"] = c.UserID
|
c.fieldMap["user_id"] = c.UserID
|
||||||
c.fieldMap["proxy_id"] = c.ProxyID
|
c.fieldMap["proxy_id"] = c.ProxyID
|
||||||
c.fieldMap["node_id"] = c.NodeID
|
c.fieldMap["node_id"] = c.NodeID
|
||||||
|
c.fieldMap["proxy_host"] = c.ProxyHost
|
||||||
c.fieldMap["proxy_port"] = c.ProxyPort
|
c.fieldMap["proxy_port"] = c.ProxyPort
|
||||||
c.fieldMap["user_host"] = c.UserHost
|
|
||||||
c.fieldMap["node_host"] = c.NodeHost
|
c.fieldMap["node_host"] = c.NodeHost
|
||||||
|
c.fieldMap["protocol"] = c.Protocol
|
||||||
c.fieldMap["auth_ip"] = c.AuthIP
|
c.fieldMap["auth_ip"] = c.AuthIP
|
||||||
|
c.fieldMap["user_host"] = c.UserHost
|
||||||
c.fieldMap["auth_pass"] = c.AuthPass
|
c.fieldMap["auth_pass"] = c.AuthPass
|
||||||
c.fieldMap["username"] = c.Username
|
c.fieldMap["username"] = c.Username
|
||||||
c.fieldMap["password"] = c.Password
|
c.fieldMap["password"] = c.Password
|
||||||
@@ -136,8 +138,6 @@ func (c *channel) fillFieldMap() {
|
|||||||
c.fieldMap["created_at"] = c.CreatedAt
|
c.fieldMap["created_at"] = c.CreatedAt
|
||||||
c.fieldMap["updated_at"] = c.UpdatedAt
|
c.fieldMap["updated_at"] = c.UpdatedAt
|
||||||
c.fieldMap["deleted_at"] = c.DeletedAt
|
c.fieldMap["deleted_at"] = c.DeletedAt
|
||||||
c.fieldMap["proxy_host"] = c.ProxyHost
|
|
||||||
c.fieldMap["protocol"] = c.Protocol
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c channel) clone(db *gorm.DB) channel {
|
func (c channel) clone(db *gorm.DB) channel {
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ func newClient(db *gorm.DB, opts ...gen.DOOption) client {
|
|||||||
_client.GrantCode = field.NewBool(tableName, "grant_code")
|
_client.GrantCode = field.NewBool(tableName, "grant_code")
|
||||||
_client.GrantClient = field.NewBool(tableName, "grant_client")
|
_client.GrantClient = field.NewBool(tableName, "grant_client")
|
||||||
_client.GrantRefresh = field.NewBool(tableName, "grant_refresh")
|
_client.GrantRefresh = field.NewBool(tableName, "grant_refresh")
|
||||||
|
_client.GrantPassword = field.NewBool(tableName, "grant_password")
|
||||||
_client.Spec = field.NewInt32(tableName, "spec")
|
_client.Spec = field.NewInt32(tableName, "spec")
|
||||||
_client.Name = field.NewString(tableName, "name")
|
_client.Name = field.NewString(tableName, "name")
|
||||||
_client.Icon = field.NewString(tableName, "icon")
|
_client.Icon = field.NewString(tableName, "icon")
|
||||||
@@ -41,7 +42,6 @@ func newClient(db *gorm.DB, opts ...gen.DOOption) client {
|
|||||||
_client.CreatedAt = field.NewField(tableName, "created_at")
|
_client.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_client.UpdatedAt = field.NewField(tableName, "updated_at")
|
_client.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_client.DeletedAt = field.NewField(tableName, "deleted_at")
|
_client.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_client.GrantPassword = field.NewBool(tableName, "grant_password")
|
|
||||||
|
|
||||||
_client.fillFieldMap()
|
_client.fillFieldMap()
|
||||||
|
|
||||||
@@ -59,14 +59,14 @@ type client struct {
|
|||||||
GrantCode field.Bool // 允许授权码授予
|
GrantCode field.Bool // 允许授权码授予
|
||||||
GrantClient field.Bool // 允许客户端凭证授予
|
GrantClient field.Bool // 允许客户端凭证授予
|
||||||
GrantRefresh field.Bool // 允许刷新令牌授予
|
GrantRefresh field.Bool // 允许刷新令牌授予
|
||||||
Spec field.Int32 // 安全规范:0-web,1-native,2-browser
|
GrantPassword field.Bool // 允许密码授予
|
||||||
|
Spec field.Int32 // 安全规范:1-native,2-browser,3-web
|
||||||
Name field.String // 名称
|
Name field.String // 名称
|
||||||
Icon field.String // 图标URL
|
Icon field.String // 图标URL
|
||||||
Status field.Int32 // 状态:1-正常,0-禁用
|
Status field.Int32 // 状态:0-禁用,1-正常
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
GrantPassword field.Bool
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@ func (c *client) updateTableName(table string) *client {
|
|||||||
c.GrantCode = field.NewBool(table, "grant_code")
|
c.GrantCode = field.NewBool(table, "grant_code")
|
||||||
c.GrantClient = field.NewBool(table, "grant_client")
|
c.GrantClient = field.NewBool(table, "grant_client")
|
||||||
c.GrantRefresh = field.NewBool(table, "grant_refresh")
|
c.GrantRefresh = field.NewBool(table, "grant_refresh")
|
||||||
|
c.GrantPassword = field.NewBool(table, "grant_password")
|
||||||
c.Spec = field.NewInt32(table, "spec")
|
c.Spec = field.NewInt32(table, "spec")
|
||||||
c.Name = field.NewString(table, "name")
|
c.Name = field.NewString(table, "name")
|
||||||
c.Icon = field.NewString(table, "icon")
|
c.Icon = field.NewString(table, "icon")
|
||||||
@@ -97,7 +98,6 @@ func (c *client) updateTableName(table string) *client {
|
|||||||
c.CreatedAt = field.NewField(table, "created_at")
|
c.CreatedAt = field.NewField(table, "created_at")
|
||||||
c.UpdatedAt = field.NewField(table, "updated_at")
|
c.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
c.DeletedAt = field.NewField(table, "deleted_at")
|
c.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
c.GrantPassword = field.NewBool(table, "grant_password")
|
|
||||||
|
|
||||||
c.fillFieldMap()
|
c.fillFieldMap()
|
||||||
|
|
||||||
@@ -122,6 +122,7 @@ func (c *client) fillFieldMap() {
|
|||||||
c.fieldMap["grant_code"] = c.GrantCode
|
c.fieldMap["grant_code"] = c.GrantCode
|
||||||
c.fieldMap["grant_client"] = c.GrantClient
|
c.fieldMap["grant_client"] = c.GrantClient
|
||||||
c.fieldMap["grant_refresh"] = c.GrantRefresh
|
c.fieldMap["grant_refresh"] = c.GrantRefresh
|
||||||
|
c.fieldMap["grant_password"] = c.GrantPassword
|
||||||
c.fieldMap["spec"] = c.Spec
|
c.fieldMap["spec"] = c.Spec
|
||||||
c.fieldMap["name"] = c.Name
|
c.fieldMap["name"] = c.Name
|
||||||
c.fieldMap["icon"] = c.Icon
|
c.fieldMap["icon"] = c.Icon
|
||||||
@@ -129,7 +130,6 @@ func (c *client) fillFieldMap() {
|
|||||||
c.fieldMap["created_at"] = c.CreatedAt
|
c.fieldMap["created_at"] = c.CreatedAt
|
||||||
c.fieldMap["updated_at"] = c.UpdatedAt
|
c.fieldMap["updated_at"] = c.UpdatedAt
|
||||||
c.fieldMap["deleted_at"] = c.DeletedAt
|
c.fieldMap["deleted_at"] = c.DeletedAt
|
||||||
c.fieldMap["grant_password"] = c.GrantPassword
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c client) clone(db *gorm.DB) client {
|
func (c client) clone(db *gorm.DB) client {
|
||||||
|
|||||||
@@ -27,17 +27,17 @@ func newCoupon(db *gorm.DB, opts ...gen.DOOption) coupon {
|
|||||||
|
|
||||||
tableName := _coupon.couponDo.TableName()
|
tableName := _coupon.couponDo.TableName()
|
||||||
_coupon.ALL = field.NewAsterisk(tableName)
|
_coupon.ALL = field.NewAsterisk(tableName)
|
||||||
_coupon.ExpireAt = field.NewField(tableName, "expire_at")
|
|
||||||
_coupon.CreatedAt = field.NewField(tableName, "created_at")
|
|
||||||
_coupon.UpdatedAt = field.NewField(tableName, "updated_at")
|
|
||||||
_coupon.DeletedAt = field.NewField(tableName, "deleted_at")
|
|
||||||
_coupon.ID = field.NewInt32(tableName, "id")
|
_coupon.ID = field.NewInt32(tableName, "id")
|
||||||
_coupon.UserID = field.NewInt32(tableName, "user_id")
|
_coupon.UserID = field.NewInt32(tableName, "user_id")
|
||||||
_coupon.Status = field.NewInt32(tableName, "status")
|
|
||||||
_coupon.Code = field.NewString(tableName, "code")
|
_coupon.Code = field.NewString(tableName, "code")
|
||||||
_coupon.Remark = field.NewString(tableName, "remark")
|
_coupon.Remark = field.NewString(tableName, "remark")
|
||||||
_coupon.Amount = field.NewFloat64(tableName, "amount")
|
_coupon.Amount = field.NewFloat64(tableName, "amount")
|
||||||
_coupon.MinAmount = field.NewFloat64(tableName, "min_amount")
|
_coupon.MinAmount = field.NewFloat64(tableName, "min_amount")
|
||||||
|
_coupon.Status = field.NewInt32(tableName, "status")
|
||||||
|
_coupon.ExpireAt = field.NewField(tableName, "expire_at")
|
||||||
|
_coupon.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
|
_coupon.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
|
_coupon.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
|
|
||||||
_coupon.fillFieldMap()
|
_coupon.fillFieldMap()
|
||||||
|
|
||||||
@@ -48,17 +48,17 @@ type coupon struct {
|
|||||||
couponDo
|
couponDo
|
||||||
|
|
||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ExpireAt field.Field // 过期时间
|
|
||||||
CreatedAt field.Field // 创建时间
|
|
||||||
UpdatedAt field.Field // 更新时间
|
|
||||||
DeletedAt field.Field // 删除时间
|
|
||||||
ID field.Int32 // 优惠券ID
|
ID field.Int32 // 优惠券ID
|
||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
Status field.Int32 // 优惠券状态:0-未使用,1-已使用,2-已过期
|
|
||||||
Code field.String // 优惠券代码
|
Code field.String // 优惠券代码
|
||||||
Remark field.String // 优惠券备注
|
Remark field.String // 优惠券备注
|
||||||
Amount field.Float64 // 优惠券金额
|
Amount field.Float64 // 优惠券金额
|
||||||
MinAmount field.Float64 // 最低消费金额
|
MinAmount field.Float64 // 最低消费金额
|
||||||
|
Status field.Int32 // 优惠券状态:0-未使用,1-已使用,2-已过期
|
||||||
|
ExpireAt field.Field // 过期时间
|
||||||
|
CreatedAt field.Field // 创建时间
|
||||||
|
UpdatedAt field.Field // 更新时间
|
||||||
|
DeletedAt field.Field // 删除时间
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -75,17 +75,17 @@ func (c coupon) As(alias string) *coupon {
|
|||||||
|
|
||||||
func (c *coupon) updateTableName(table string) *coupon {
|
func (c *coupon) updateTableName(table string) *coupon {
|
||||||
c.ALL = field.NewAsterisk(table)
|
c.ALL = field.NewAsterisk(table)
|
||||||
c.ExpireAt = field.NewField(table, "expire_at")
|
|
||||||
c.CreatedAt = field.NewField(table, "created_at")
|
|
||||||
c.UpdatedAt = field.NewField(table, "updated_at")
|
|
||||||
c.DeletedAt = field.NewField(table, "deleted_at")
|
|
||||||
c.ID = field.NewInt32(table, "id")
|
c.ID = field.NewInt32(table, "id")
|
||||||
c.UserID = field.NewInt32(table, "user_id")
|
c.UserID = field.NewInt32(table, "user_id")
|
||||||
c.Status = field.NewInt32(table, "status")
|
|
||||||
c.Code = field.NewString(table, "code")
|
c.Code = field.NewString(table, "code")
|
||||||
c.Remark = field.NewString(table, "remark")
|
c.Remark = field.NewString(table, "remark")
|
||||||
c.Amount = field.NewFloat64(table, "amount")
|
c.Amount = field.NewFloat64(table, "amount")
|
||||||
c.MinAmount = field.NewFloat64(table, "min_amount")
|
c.MinAmount = field.NewFloat64(table, "min_amount")
|
||||||
|
c.Status = field.NewInt32(table, "status")
|
||||||
|
c.ExpireAt = field.NewField(table, "expire_at")
|
||||||
|
c.CreatedAt = field.NewField(table, "created_at")
|
||||||
|
c.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
|
c.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
|
|
||||||
c.fillFieldMap()
|
c.fillFieldMap()
|
||||||
|
|
||||||
@@ -103,17 +103,17 @@ func (c *coupon) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||||||
|
|
||||||
func (c *coupon) fillFieldMap() {
|
func (c *coupon) fillFieldMap() {
|
||||||
c.fieldMap = make(map[string]field.Expr, 11)
|
c.fieldMap = make(map[string]field.Expr, 11)
|
||||||
c.fieldMap["expire_at"] = c.ExpireAt
|
|
||||||
c.fieldMap["created_at"] = c.CreatedAt
|
|
||||||
c.fieldMap["updated_at"] = c.UpdatedAt
|
|
||||||
c.fieldMap["deleted_at"] = c.DeletedAt
|
|
||||||
c.fieldMap["id"] = c.ID
|
c.fieldMap["id"] = c.ID
|
||||||
c.fieldMap["user_id"] = c.UserID
|
c.fieldMap["user_id"] = c.UserID
|
||||||
c.fieldMap["status"] = c.Status
|
|
||||||
c.fieldMap["code"] = c.Code
|
c.fieldMap["code"] = c.Code
|
||||||
c.fieldMap["remark"] = c.Remark
|
c.fieldMap["remark"] = c.Remark
|
||||||
c.fieldMap["amount"] = c.Amount
|
c.fieldMap["amount"] = c.Amount
|
||||||
c.fieldMap["min_amount"] = c.MinAmount
|
c.fieldMap["min_amount"] = c.MinAmount
|
||||||
|
c.fieldMap["status"] = c.Status
|
||||||
|
c.fieldMap["expire_at"] = c.ExpireAt
|
||||||
|
c.fieldMap["created_at"] = c.CreatedAt
|
||||||
|
c.fieldMap["updated_at"] = c.UpdatedAt
|
||||||
|
c.fieldMap["deleted_at"] = c.DeletedAt
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c coupon) clone(db *gorm.DB) coupon {
|
func (c coupon) clone(db *gorm.DB) coupon {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ var (
|
|||||||
Client *client
|
Client *client
|
||||||
ClientPermissionLink *clientPermissionLink
|
ClientPermissionLink *clientPermissionLink
|
||||||
Coupon *coupon
|
Coupon *coupon
|
||||||
|
LogsRequest *logsRequest
|
||||||
Node *node
|
Node *node
|
||||||
Permission *permission
|
Permission *permission
|
||||||
Product *product
|
Product *product
|
||||||
@@ -56,6 +57,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
|
|||||||
Client = &Q.Client
|
Client = &Q.Client
|
||||||
ClientPermissionLink = &Q.ClientPermissionLink
|
ClientPermissionLink = &Q.ClientPermissionLink
|
||||||
Coupon = &Q.Coupon
|
Coupon = &Q.Coupon
|
||||||
|
LogsRequest = &Q.LogsRequest
|
||||||
Node = &Q.Node
|
Node = &Q.Node
|
||||||
Permission = &Q.Permission
|
Permission = &Q.Permission
|
||||||
Product = &Q.Product
|
Product = &Q.Product
|
||||||
@@ -86,6 +88,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
|
|||||||
Client: newClient(db, opts...),
|
Client: newClient(db, opts...),
|
||||||
ClientPermissionLink: newClientPermissionLink(db, opts...),
|
ClientPermissionLink: newClientPermissionLink(db, opts...),
|
||||||
Coupon: newCoupon(db, opts...),
|
Coupon: newCoupon(db, opts...),
|
||||||
|
LogsRequest: newLogsRequest(db, opts...),
|
||||||
Node: newNode(db, opts...),
|
Node: newNode(db, opts...),
|
||||||
Permission: newPermission(db, opts...),
|
Permission: newPermission(db, opts...),
|
||||||
Product: newProduct(db, opts...),
|
Product: newProduct(db, opts...),
|
||||||
@@ -117,6 +120,7 @@ type Query struct {
|
|||||||
Client client
|
Client client
|
||||||
ClientPermissionLink clientPermissionLink
|
ClientPermissionLink clientPermissionLink
|
||||||
Coupon coupon
|
Coupon coupon
|
||||||
|
LogsRequest logsRequest
|
||||||
Node node
|
Node node
|
||||||
Permission permission
|
Permission permission
|
||||||
Product product
|
Product product
|
||||||
@@ -149,6 +153,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
|
|||||||
Client: q.Client.clone(db),
|
Client: q.Client.clone(db),
|
||||||
ClientPermissionLink: q.ClientPermissionLink.clone(db),
|
ClientPermissionLink: q.ClientPermissionLink.clone(db),
|
||||||
Coupon: q.Coupon.clone(db),
|
Coupon: q.Coupon.clone(db),
|
||||||
|
LogsRequest: q.LogsRequest.clone(db),
|
||||||
Node: q.Node.clone(db),
|
Node: q.Node.clone(db),
|
||||||
Permission: q.Permission.clone(db),
|
Permission: q.Permission.clone(db),
|
||||||
Product: q.Product.clone(db),
|
Product: q.Product.clone(db),
|
||||||
@@ -188,6 +193,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
|
|||||||
Client: q.Client.replaceDB(db),
|
Client: q.Client.replaceDB(db),
|
||||||
ClientPermissionLink: q.ClientPermissionLink.replaceDB(db),
|
ClientPermissionLink: q.ClientPermissionLink.replaceDB(db),
|
||||||
Coupon: q.Coupon.replaceDB(db),
|
Coupon: q.Coupon.replaceDB(db),
|
||||||
|
LogsRequest: q.LogsRequest.replaceDB(db),
|
||||||
Node: q.Node.replaceDB(db),
|
Node: q.Node.replaceDB(db),
|
||||||
Permission: q.Permission.replaceDB(db),
|
Permission: q.Permission.replaceDB(db),
|
||||||
Product: q.Product.replaceDB(db),
|
Product: q.Product.replaceDB(db),
|
||||||
@@ -217,6 +223,7 @@ type queryCtx struct {
|
|||||||
Client *clientDo
|
Client *clientDo
|
||||||
ClientPermissionLink *clientPermissionLinkDo
|
ClientPermissionLink *clientPermissionLinkDo
|
||||||
Coupon *couponDo
|
Coupon *couponDo
|
||||||
|
LogsRequest *logsRequestDo
|
||||||
Node *nodeDo
|
Node *nodeDo
|
||||||
Permission *permissionDo
|
Permission *permissionDo
|
||||||
Product *productDo
|
Product *productDo
|
||||||
@@ -246,6 +253,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
|
|||||||
Client: q.Client.WithContext(ctx),
|
Client: q.Client.WithContext(ctx),
|
||||||
ClientPermissionLink: q.ClientPermissionLink.WithContext(ctx),
|
ClientPermissionLink: q.ClientPermissionLink.WithContext(ctx),
|
||||||
Coupon: q.Coupon.WithContext(ctx),
|
Coupon: q.Coupon.WithContext(ctx),
|
||||||
|
LogsRequest: q.LogsRequest.WithContext(ctx),
|
||||||
Node: q.Node.WithContext(ctx),
|
Node: q.Node.WithContext(ctx),
|
||||||
Permission: q.Permission.WithContext(ctx),
|
Permission: q.Permission.WithContext(ctx),
|
||||||
Product: q.Product.WithContext(ctx),
|
Product: q.Product.WithContext(ctx),
|
||||||
|
|||||||
355
web/queries/logs_request.gen.go
Normal file
355
web/queries/logs_request.gen.go
Normal file
@@ -0,0 +1,355 @@
|
|||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
// Code generated by gorm.io/gen. DO NOT EDIT.
|
||||||
|
|
||||||
|
package queries
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"gorm.io/gorm"
|
||||||
|
"gorm.io/gorm/clause"
|
||||||
|
"gorm.io/gorm/schema"
|
||||||
|
|
||||||
|
"gorm.io/gen"
|
||||||
|
"gorm.io/gen/field"
|
||||||
|
|
||||||
|
"gorm.io/plugin/dbresolver"
|
||||||
|
|
||||||
|
"platform/web/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func newLogsRequest(db *gorm.DB, opts ...gen.DOOption) logsRequest {
|
||||||
|
_logsRequest := logsRequest{}
|
||||||
|
|
||||||
|
_logsRequest.logsRequestDo.UseDB(db, opts...)
|
||||||
|
_logsRequest.logsRequestDo.UseModel(&models.LogsRequest{})
|
||||||
|
|
||||||
|
tableName := _logsRequest.logsRequestDo.TableName()
|
||||||
|
_logsRequest.ALL = field.NewAsterisk(tableName)
|
||||||
|
_logsRequest.ID = field.NewInt32(tableName, "id")
|
||||||
|
_logsRequest.Identity = field.NewInt32(tableName, "identity")
|
||||||
|
_logsRequest.Visitor = field.NewInt32(tableName, "visitor")
|
||||||
|
_logsRequest.IP = field.NewString(tableName, "ip")
|
||||||
|
_logsRequest.Ua = field.NewString(tableName, "ua")
|
||||||
|
_logsRequest.Method = field.NewString(tableName, "method")
|
||||||
|
_logsRequest.Path = field.NewString(tableName, "path")
|
||||||
|
_logsRequest.Status = field.NewInt32(tableName, "status")
|
||||||
|
_logsRequest.Error = field.NewString(tableName, "error")
|
||||||
|
_logsRequest.Time = field.NewField(tableName, "time")
|
||||||
|
|
||||||
|
_logsRequest.fillFieldMap()
|
||||||
|
|
||||||
|
return _logsRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type logsRequest struct {
|
||||||
|
logsRequestDo
|
||||||
|
|
||||||
|
ALL field.Asterisk
|
||||||
|
ID field.Int32 // 访问日志ID
|
||||||
|
Identity field.Int32 // 访客身份:0-游客,1-用户,2-服务,3-管理员
|
||||||
|
Visitor field.Int32 // 访客ID
|
||||||
|
IP field.String // IP地址
|
||||||
|
Ua field.String // 用户代理
|
||||||
|
Method field.String // 请求方法
|
||||||
|
Path field.String // 请求路径
|
||||||
|
Status field.Int32 // 响应状态码
|
||||||
|
Error field.String // 错误信息
|
||||||
|
Time field.Field // 请求时间
|
||||||
|
|
||||||
|
fieldMap map[string]field.Expr
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequest) Table(newTableName string) *logsRequest {
|
||||||
|
l.logsRequestDo.UseTable(newTableName)
|
||||||
|
return l.updateTableName(newTableName)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequest) As(alias string) *logsRequest {
|
||||||
|
l.logsRequestDo.DO = *(l.logsRequestDo.As(alias).(*gen.DO))
|
||||||
|
return l.updateTableName(alias)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *logsRequest) updateTableName(table string) *logsRequest {
|
||||||
|
l.ALL = field.NewAsterisk(table)
|
||||||
|
l.ID = field.NewInt32(table, "id")
|
||||||
|
l.Identity = field.NewInt32(table, "identity")
|
||||||
|
l.Visitor = field.NewInt32(table, "visitor")
|
||||||
|
l.IP = field.NewString(table, "ip")
|
||||||
|
l.Ua = field.NewString(table, "ua")
|
||||||
|
l.Method = field.NewString(table, "method")
|
||||||
|
l.Path = field.NewString(table, "path")
|
||||||
|
l.Status = field.NewInt32(table, "status")
|
||||||
|
l.Error = field.NewString(table, "error")
|
||||||
|
l.Time = field.NewField(table, "time")
|
||||||
|
|
||||||
|
l.fillFieldMap()
|
||||||
|
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *logsRequest) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
||||||
|
_f, ok := l.fieldMap[fieldName]
|
||||||
|
if !ok || _f == nil {
|
||||||
|
return nil, false
|
||||||
|
}
|
||||||
|
_oe, ok := _f.(field.OrderExpr)
|
||||||
|
return _oe, ok
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *logsRequest) fillFieldMap() {
|
||||||
|
l.fieldMap = make(map[string]field.Expr, 10)
|
||||||
|
l.fieldMap["id"] = l.ID
|
||||||
|
l.fieldMap["identity"] = l.Identity
|
||||||
|
l.fieldMap["visitor"] = l.Visitor
|
||||||
|
l.fieldMap["ip"] = l.IP
|
||||||
|
l.fieldMap["ua"] = l.Ua
|
||||||
|
l.fieldMap["method"] = l.Method
|
||||||
|
l.fieldMap["path"] = l.Path
|
||||||
|
l.fieldMap["status"] = l.Status
|
||||||
|
l.fieldMap["error"] = l.Error
|
||||||
|
l.fieldMap["time"] = l.Time
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequest) clone(db *gorm.DB) logsRequest {
|
||||||
|
l.logsRequestDo.ReplaceConnPool(db.Statement.ConnPool)
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequest) replaceDB(db *gorm.DB) logsRequest {
|
||||||
|
l.logsRequestDo.ReplaceDB(db)
|
||||||
|
return l
|
||||||
|
}
|
||||||
|
|
||||||
|
type logsRequestDo struct{ gen.DO }
|
||||||
|
|
||||||
|
func (l logsRequestDo) Debug() *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Debug())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) WithContext(ctx context.Context) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.WithContext(ctx))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) ReadDB() *logsRequestDo {
|
||||||
|
return l.Clauses(dbresolver.Read)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) WriteDB() *logsRequestDo {
|
||||||
|
return l.Clauses(dbresolver.Write)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Session(config *gorm.Session) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Session(config))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Clauses(conds ...clause.Expression) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Clauses(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Returning(value interface{}, columns ...string) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Returning(value, columns...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Not(conds ...gen.Condition) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Not(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Or(conds ...gen.Condition) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Or(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Select(conds ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Select(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Where(conds ...gen.Condition) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Where(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Order(conds ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Order(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Distinct(cols ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Distinct(cols...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Omit(cols ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Omit(cols...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Join(table schema.Tabler, on ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Join(table, on...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) LeftJoin(table schema.Tabler, on ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.LeftJoin(table, on...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) RightJoin(table schema.Tabler, on ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.RightJoin(table, on...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Group(cols ...field.Expr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Group(cols...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Having(conds ...gen.Condition) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Having(conds...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Limit(limit int) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Limit(limit))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Offset(offset int) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Offset(offset))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Scopes(funcs ...func(gen.Dao) gen.Dao) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Scopes(funcs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Unscoped() *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Unscoped())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Create(values ...*models.LogsRequest) error {
|
||||||
|
if len(values) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return l.DO.Create(values)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) CreateInBatches(values []*models.LogsRequest, batchSize int) error {
|
||||||
|
return l.DO.CreateInBatches(values, batchSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save : !!! underlying implementation is different with GORM
|
||||||
|
// The method is equivalent to executing the statement: db.Clauses(clause.OnConflict{UpdateAll: true}).Create(values)
|
||||||
|
func (l logsRequestDo) Save(values ...*models.LogsRequest) error {
|
||||||
|
if len(values) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return l.DO.Save(values)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) First() (*models.LogsRequest, error) {
|
||||||
|
if result, err := l.DO.First(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return result.(*models.LogsRequest), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Take() (*models.LogsRequest, error) {
|
||||||
|
if result, err := l.DO.Take(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return result.(*models.LogsRequest), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Last() (*models.LogsRequest, error) {
|
||||||
|
if result, err := l.DO.Last(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return result.(*models.LogsRequest), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Find() ([]*models.LogsRequest, error) {
|
||||||
|
result, err := l.DO.Find()
|
||||||
|
return result.([]*models.LogsRequest), err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) FindInBatch(batchSize int, fc func(tx gen.Dao, batch int) error) (results []*models.LogsRequest, err error) {
|
||||||
|
buf := make([]*models.LogsRequest, 0, batchSize)
|
||||||
|
err = l.DO.FindInBatches(&buf, batchSize, func(tx gen.Dao, batch int) error {
|
||||||
|
defer func() { results = append(results, buf...) }()
|
||||||
|
return fc(tx, batch)
|
||||||
|
})
|
||||||
|
return results, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) FindInBatches(result *[]*models.LogsRequest, batchSize int, fc func(tx gen.Dao, batch int) error) error {
|
||||||
|
return l.DO.FindInBatches(result, batchSize, fc)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Attrs(attrs ...field.AssignExpr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Attrs(attrs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Assign(attrs ...field.AssignExpr) *logsRequestDo {
|
||||||
|
return l.withDO(l.DO.Assign(attrs...))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Joins(fields ...field.RelationField) *logsRequestDo {
|
||||||
|
for _, _f := range fields {
|
||||||
|
l = *l.withDO(l.DO.Joins(_f))
|
||||||
|
}
|
||||||
|
return &l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Preload(fields ...field.RelationField) *logsRequestDo {
|
||||||
|
for _, _f := range fields {
|
||||||
|
l = *l.withDO(l.DO.Preload(_f))
|
||||||
|
}
|
||||||
|
return &l
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) FirstOrInit() (*models.LogsRequest, error) {
|
||||||
|
if result, err := l.DO.FirstOrInit(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return result.(*models.LogsRequest), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) FirstOrCreate() (*models.LogsRequest, error) {
|
||||||
|
if result, err := l.DO.FirstOrCreate(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return result.(*models.LogsRequest), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) FindByPage(offset int, limit int) (result []*models.LogsRequest, count int64, err error) {
|
||||||
|
result, err = l.Offset(offset).Limit(limit).Find()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if size := len(result); 0 < limit && 0 < size && size < limit {
|
||||||
|
count = int64(size + offset)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
count, err = l.Offset(-1).Limit(-1).Count()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) ScanByPage(result interface{}, offset int, limit int) (count int64, err error) {
|
||||||
|
count, err = l.Count()
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
err = l.Offset(offset).Limit(limit).Scan(result)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Scan(result interface{}) (err error) {
|
||||||
|
return l.DO.Scan(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l logsRequestDo) Delete(models ...*models.LogsRequest) (result gen.ResultInfo, err error) {
|
||||||
|
return l.DO.Delete(models)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (l *logsRequestDo) withDO(do gen.Dao) *logsRequestDo {
|
||||||
|
l.DO = *do.(*gen.DO)
|
||||||
|
return l
|
||||||
|
}
|
||||||
@@ -28,12 +28,13 @@ func newNode(db *gorm.DB, opts ...gen.DOOption) node {
|
|||||||
tableName := _node.nodeDo.TableName()
|
tableName := _node.nodeDo.TableName()
|
||||||
_node.ALL = field.NewAsterisk(tableName)
|
_node.ALL = field.NewAsterisk(tableName)
|
||||||
_node.ID = field.NewInt32(tableName, "id")
|
_node.ID = field.NewInt32(tableName, "id")
|
||||||
|
_node.ProxyID = field.NewInt32(tableName, "proxy_id")
|
||||||
_node.Version = field.NewInt32(tableName, "version")
|
_node.Version = field.NewInt32(tableName, "version")
|
||||||
_node.Name = field.NewString(tableName, "name")
|
_node.Name = field.NewString(tableName, "name")
|
||||||
_node.Host = field.NewString(tableName, "host")
|
_node.Host = field.NewString(tableName, "host")
|
||||||
|
_node.Isp = field.NewInt32(tableName, "isp")
|
||||||
_node.Prov = field.NewString(tableName, "prov")
|
_node.Prov = field.NewString(tableName, "prov")
|
||||||
_node.City = field.NewString(tableName, "city")
|
_node.City = field.NewString(tableName, "city")
|
||||||
_node.ProxyID = field.NewInt32(tableName, "proxy_id")
|
|
||||||
_node.ProxyPort = field.NewInt32(tableName, "proxy_port")
|
_node.ProxyPort = field.NewInt32(tableName, "proxy_port")
|
||||||
_node.Status = field.NewInt32(tableName, "status")
|
_node.Status = field.NewInt32(tableName, "status")
|
||||||
_node.Rtt = field.NewInt32(tableName, "rtt")
|
_node.Rtt = field.NewInt32(tableName, "rtt")
|
||||||
@@ -41,7 +42,6 @@ func newNode(db *gorm.DB, opts ...gen.DOOption) node {
|
|||||||
_node.CreatedAt = field.NewField(tableName, "created_at")
|
_node.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_node.UpdatedAt = field.NewField(tableName, "updated_at")
|
_node.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_node.DeletedAt = field.NewField(tableName, "deleted_at")
|
_node.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_node.Isp = field.NewInt32(tableName, "isp")
|
|
||||||
|
|
||||||
_node.fillFieldMap()
|
_node.fillFieldMap()
|
||||||
|
|
||||||
@@ -53,12 +53,13 @@ type node struct {
|
|||||||
|
|
||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ID field.Int32 // 节点ID
|
ID field.Int32 // 节点ID
|
||||||
|
ProxyID field.Int32 // 代理ID
|
||||||
Version field.Int32 // 节点版本
|
Version field.Int32 // 节点版本
|
||||||
Name field.String // 节点名称
|
Name field.String // 节点名称
|
||||||
Host field.String // 节点地址
|
Host field.String // 节点地址
|
||||||
|
Isp field.Int32 // 运营商:0-未知,1-电信,2-联通,3-移动
|
||||||
Prov field.String // 省份
|
Prov field.String // 省份
|
||||||
City field.String // 城市
|
City field.String // 城市
|
||||||
ProxyID field.Int32 // 代理ID
|
|
||||||
ProxyPort field.Int32 // 代理端口
|
ProxyPort field.Int32 // 代理端口
|
||||||
Status field.Int32 // 节点状态:0-离线,1-正常
|
Status field.Int32 // 节点状态:0-离线,1-正常
|
||||||
Rtt field.Int32 // 延迟
|
Rtt field.Int32 // 延迟
|
||||||
@@ -66,7 +67,6 @@ type node struct {
|
|||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
Isp field.Int32 // 运营商:0-其他,1-电信,2-联通,3-移动
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -84,12 +84,13 @@ func (n node) As(alias string) *node {
|
|||||||
func (n *node) updateTableName(table string) *node {
|
func (n *node) updateTableName(table string) *node {
|
||||||
n.ALL = field.NewAsterisk(table)
|
n.ALL = field.NewAsterisk(table)
|
||||||
n.ID = field.NewInt32(table, "id")
|
n.ID = field.NewInt32(table, "id")
|
||||||
|
n.ProxyID = field.NewInt32(table, "proxy_id")
|
||||||
n.Version = field.NewInt32(table, "version")
|
n.Version = field.NewInt32(table, "version")
|
||||||
n.Name = field.NewString(table, "name")
|
n.Name = field.NewString(table, "name")
|
||||||
n.Host = field.NewString(table, "host")
|
n.Host = field.NewString(table, "host")
|
||||||
|
n.Isp = field.NewInt32(table, "isp")
|
||||||
n.Prov = field.NewString(table, "prov")
|
n.Prov = field.NewString(table, "prov")
|
||||||
n.City = field.NewString(table, "city")
|
n.City = field.NewString(table, "city")
|
||||||
n.ProxyID = field.NewInt32(table, "proxy_id")
|
|
||||||
n.ProxyPort = field.NewInt32(table, "proxy_port")
|
n.ProxyPort = field.NewInt32(table, "proxy_port")
|
||||||
n.Status = field.NewInt32(table, "status")
|
n.Status = field.NewInt32(table, "status")
|
||||||
n.Rtt = field.NewInt32(table, "rtt")
|
n.Rtt = field.NewInt32(table, "rtt")
|
||||||
@@ -97,7 +98,6 @@ func (n *node) updateTableName(table string) *node {
|
|||||||
n.CreatedAt = field.NewField(table, "created_at")
|
n.CreatedAt = field.NewField(table, "created_at")
|
||||||
n.UpdatedAt = field.NewField(table, "updated_at")
|
n.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
n.DeletedAt = field.NewField(table, "deleted_at")
|
n.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
n.Isp = field.NewInt32(table, "isp")
|
|
||||||
|
|
||||||
n.fillFieldMap()
|
n.fillFieldMap()
|
||||||
|
|
||||||
@@ -116,12 +116,13 @@ func (n *node) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||||||
func (n *node) fillFieldMap() {
|
func (n *node) fillFieldMap() {
|
||||||
n.fieldMap = make(map[string]field.Expr, 15)
|
n.fieldMap = make(map[string]field.Expr, 15)
|
||||||
n.fieldMap["id"] = n.ID
|
n.fieldMap["id"] = n.ID
|
||||||
|
n.fieldMap["proxy_id"] = n.ProxyID
|
||||||
n.fieldMap["version"] = n.Version
|
n.fieldMap["version"] = n.Version
|
||||||
n.fieldMap["name"] = n.Name
|
n.fieldMap["name"] = n.Name
|
||||||
n.fieldMap["host"] = n.Host
|
n.fieldMap["host"] = n.Host
|
||||||
|
n.fieldMap["isp"] = n.Isp
|
||||||
n.fieldMap["prov"] = n.Prov
|
n.fieldMap["prov"] = n.Prov
|
||||||
n.fieldMap["city"] = n.City
|
n.fieldMap["city"] = n.City
|
||||||
n.fieldMap["proxy_id"] = n.ProxyID
|
|
||||||
n.fieldMap["proxy_port"] = n.ProxyPort
|
n.fieldMap["proxy_port"] = n.ProxyPort
|
||||||
n.fieldMap["status"] = n.Status
|
n.fieldMap["status"] = n.Status
|
||||||
n.fieldMap["rtt"] = n.Rtt
|
n.fieldMap["rtt"] = n.Rtt
|
||||||
@@ -129,7 +130,6 @@ func (n *node) fillFieldMap() {
|
|||||||
n.fieldMap["created_at"] = n.CreatedAt
|
n.fieldMap["created_at"] = n.CreatedAt
|
||||||
n.fieldMap["updated_at"] = n.UpdatedAt
|
n.fieldMap["updated_at"] = n.UpdatedAt
|
||||||
n.fieldMap["deleted_at"] = n.DeletedAt
|
n.fieldMap["deleted_at"] = n.DeletedAt
|
||||||
n.fieldMap["isp"] = n.Isp
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n node) clone(db *gorm.DB) node {
|
func (n node) clone(db *gorm.DB) node {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ type product struct {
|
|||||||
Name field.String // 产品名称
|
Name field.String // 产品名称
|
||||||
Description field.String // 产品描述
|
Description field.String // 产品描述
|
||||||
Sort field.Int32 // 排序
|
Sort field.Int32 // 排序
|
||||||
Status field.Int32 // 产品状态:1-正常,0-禁用
|
Status field.Int32 // 产品状态:0-禁用,1-正常
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ type proxy struct {
|
|||||||
Version field.Int32 // 代理服务版本
|
Version field.Int32 // 代理服务版本
|
||||||
Name field.String // 代理服务名称
|
Name field.String // 代理服务名称
|
||||||
Host field.String // 代理服务地址
|
Host field.String // 代理服务地址
|
||||||
Type field.Int32 // 代理服务类型:0-自有,1-三方
|
Type field.Int32 // 代理服务类型:1-三方,2-自有
|
||||||
Secret field.String // 代理服务密钥
|
Secret field.String // 代理服务密钥
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
|
|||||||
@@ -28,14 +28,14 @@ func newRefund(db *gorm.DB, opts ...gen.DOOption) refund {
|
|||||||
tableName := _refund.refundDo.TableName()
|
tableName := _refund.refundDo.TableName()
|
||||||
_refund.ALL = field.NewAsterisk(tableName)
|
_refund.ALL = field.NewAsterisk(tableName)
|
||||||
_refund.ID = field.NewInt32(tableName, "id")
|
_refund.ID = field.NewInt32(tableName, "id")
|
||||||
|
_refund.TradeID = field.NewInt32(tableName, "trade_id")
|
||||||
_refund.ProductID = field.NewInt32(tableName, "product_id")
|
_refund.ProductID = field.NewInt32(tableName, "product_id")
|
||||||
_refund.Amount = field.NewFloat64(tableName, "amount")
|
_refund.Amount = field.NewFloat64(tableName, "amount")
|
||||||
|
_refund.Reason = field.NewString(tableName, "reason")
|
||||||
|
_refund.Status = field.NewInt32(tableName, "status")
|
||||||
_refund.CreatedAt = field.NewField(tableName, "created_at")
|
_refund.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_refund.UpdatedAt = field.NewField(tableName, "updated_at")
|
_refund.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_refund.DeletedAt = field.NewField(tableName, "deleted_at")
|
_refund.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_refund.TradeID = field.NewInt32(tableName, "trade_id")
|
|
||||||
_refund.Reason = field.NewString(tableName, "reason")
|
|
||||||
_refund.Status = field.NewInt32(tableName, "status")
|
|
||||||
|
|
||||||
_refund.fillFieldMap()
|
_refund.fillFieldMap()
|
||||||
|
|
||||||
@@ -47,14 +47,14 @@ type refund struct {
|
|||||||
|
|
||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ID field.Int32 // 退款ID
|
ID field.Int32 // 退款ID
|
||||||
|
TradeID field.Int32 // 订单ID
|
||||||
ProductID field.Int32 // 产品ID
|
ProductID field.Int32 // 产品ID
|
||||||
Amount field.Float64 // 退款金额
|
Amount field.Float64 // 退款金额
|
||||||
|
Reason field.String // 退款原因
|
||||||
|
Status field.Int32 // 退款状态:0-待处理,1-已退款,2-已拒绝
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
TradeID field.Int32 // 订单ID
|
|
||||||
Reason field.String // 退款原因
|
|
||||||
Status field.Int32 // 退款状态:0-待处理,1-已退款,2-已拒绝
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -72,14 +72,14 @@ func (r refund) As(alias string) *refund {
|
|||||||
func (r *refund) updateTableName(table string) *refund {
|
func (r *refund) updateTableName(table string) *refund {
|
||||||
r.ALL = field.NewAsterisk(table)
|
r.ALL = field.NewAsterisk(table)
|
||||||
r.ID = field.NewInt32(table, "id")
|
r.ID = field.NewInt32(table, "id")
|
||||||
|
r.TradeID = field.NewInt32(table, "trade_id")
|
||||||
r.ProductID = field.NewInt32(table, "product_id")
|
r.ProductID = field.NewInt32(table, "product_id")
|
||||||
r.Amount = field.NewFloat64(table, "amount")
|
r.Amount = field.NewFloat64(table, "amount")
|
||||||
|
r.Reason = field.NewString(table, "reason")
|
||||||
|
r.Status = field.NewInt32(table, "status")
|
||||||
r.CreatedAt = field.NewField(table, "created_at")
|
r.CreatedAt = field.NewField(table, "created_at")
|
||||||
r.UpdatedAt = field.NewField(table, "updated_at")
|
r.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
r.DeletedAt = field.NewField(table, "deleted_at")
|
r.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
r.TradeID = field.NewInt32(table, "trade_id")
|
|
||||||
r.Reason = field.NewString(table, "reason")
|
|
||||||
r.Status = field.NewInt32(table, "status")
|
|
||||||
|
|
||||||
r.fillFieldMap()
|
r.fillFieldMap()
|
||||||
|
|
||||||
@@ -98,14 +98,14 @@ func (r *refund) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
|
|||||||
func (r *refund) fillFieldMap() {
|
func (r *refund) fillFieldMap() {
|
||||||
r.fieldMap = make(map[string]field.Expr, 9)
|
r.fieldMap = make(map[string]field.Expr, 9)
|
||||||
r.fieldMap["id"] = r.ID
|
r.fieldMap["id"] = r.ID
|
||||||
|
r.fieldMap["trade_id"] = r.TradeID
|
||||||
r.fieldMap["product_id"] = r.ProductID
|
r.fieldMap["product_id"] = r.ProductID
|
||||||
r.fieldMap["amount"] = r.Amount
|
r.fieldMap["amount"] = r.Amount
|
||||||
|
r.fieldMap["reason"] = r.Reason
|
||||||
|
r.fieldMap["status"] = r.Status
|
||||||
r.fieldMap["created_at"] = r.CreatedAt
|
r.fieldMap["created_at"] = r.CreatedAt
|
||||||
r.fieldMap["updated_at"] = r.UpdatedAt
|
r.fieldMap["updated_at"] = r.UpdatedAt
|
||||||
r.fieldMap["deleted_at"] = r.DeletedAt
|
r.fieldMap["deleted_at"] = r.DeletedAt
|
||||||
r.fieldMap["trade_id"] = r.TradeID
|
|
||||||
r.fieldMap["reason"] = r.Reason
|
|
||||||
r.fieldMap["status"] = r.Status
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r refund) clone(db *gorm.DB) refund {
|
func (r refund) clone(db *gorm.DB) refund {
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ func newResource(db *gorm.DB, opts ...gen.DOOption) resource {
|
|||||||
_resource.ALL = field.NewAsterisk(tableName)
|
_resource.ALL = field.NewAsterisk(tableName)
|
||||||
_resource.ID = field.NewInt32(tableName, "id")
|
_resource.ID = field.NewInt32(tableName, "id")
|
||||||
_resource.UserID = field.NewInt32(tableName, "user_id")
|
_resource.UserID = field.NewInt32(tableName, "user_id")
|
||||||
|
_resource.ResourceNo = field.NewString(tableName, "resource_no")
|
||||||
_resource.Active = field.NewBool(tableName, "active")
|
_resource.Active = field.NewBool(tableName, "active")
|
||||||
|
_resource.Type = field.NewInt32(tableName, "type")
|
||||||
_resource.CreatedAt = field.NewField(tableName, "created_at")
|
_resource.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_resource.UpdatedAt = field.NewField(tableName, "updated_at")
|
_resource.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_resource.DeletedAt = field.NewField(tableName, "deleted_at")
|
_resource.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_resource.ResourceNo = field.NewString(tableName, "resource_no")
|
|
||||||
_resource.Type = field.NewInt32(tableName, "type")
|
|
||||||
_resource.Pss = resourceHasOnePss{
|
_resource.Pss = resourceHasOnePss{
|
||||||
db: db.Session(&gorm.Session{}),
|
db: db.Session(&gorm.Session{}),
|
||||||
|
|
||||||
@@ -52,12 +52,12 @@ type resource struct {
|
|||||||
ALL field.Asterisk
|
ALL field.Asterisk
|
||||||
ID field.Int32 // 套餐ID
|
ID field.Int32 // 套餐ID
|
||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
|
ResourceNo field.String // 套餐编号
|
||||||
Active field.Bool // 套餐状态
|
Active field.Bool // 套餐状态
|
||||||
|
Type field.Int32 // 套餐类型:1-动态,2-隧道,3-独享
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
ResourceNo field.String // 套餐编号
|
|
||||||
Type field.Int32 // 套餐类型:1-动态,2-隧道,3-独享
|
|
||||||
Pss resourceHasOnePss
|
Pss resourceHasOnePss
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
@@ -77,12 +77,12 @@ func (r *resource) updateTableName(table string) *resource {
|
|||||||
r.ALL = field.NewAsterisk(table)
|
r.ALL = field.NewAsterisk(table)
|
||||||
r.ID = field.NewInt32(table, "id")
|
r.ID = field.NewInt32(table, "id")
|
||||||
r.UserID = field.NewInt32(table, "user_id")
|
r.UserID = field.NewInt32(table, "user_id")
|
||||||
|
r.ResourceNo = field.NewString(table, "resource_no")
|
||||||
r.Active = field.NewBool(table, "active")
|
r.Active = field.NewBool(table, "active")
|
||||||
|
r.Type = field.NewInt32(table, "type")
|
||||||
r.CreatedAt = field.NewField(table, "created_at")
|
r.CreatedAt = field.NewField(table, "created_at")
|
||||||
r.UpdatedAt = field.NewField(table, "updated_at")
|
r.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
r.DeletedAt = field.NewField(table, "deleted_at")
|
r.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
r.ResourceNo = field.NewString(table, "resource_no")
|
|
||||||
r.Type = field.NewInt32(table, "type")
|
|
||||||
|
|
||||||
r.fillFieldMap()
|
r.fillFieldMap()
|
||||||
|
|
||||||
@@ -102,12 +102,12 @@ func (r *resource) fillFieldMap() {
|
|||||||
r.fieldMap = make(map[string]field.Expr, 9)
|
r.fieldMap = make(map[string]field.Expr, 9)
|
||||||
r.fieldMap["id"] = r.ID
|
r.fieldMap["id"] = r.ID
|
||||||
r.fieldMap["user_id"] = r.UserID
|
r.fieldMap["user_id"] = r.UserID
|
||||||
|
r.fieldMap["resource_no"] = r.ResourceNo
|
||||||
r.fieldMap["active"] = r.Active
|
r.fieldMap["active"] = r.Active
|
||||||
|
r.fieldMap["type"] = r.Type
|
||||||
r.fieldMap["created_at"] = r.CreatedAt
|
r.fieldMap["created_at"] = r.CreatedAt
|
||||||
r.fieldMap["updated_at"] = r.UpdatedAt
|
r.fieldMap["updated_at"] = r.UpdatedAt
|
||||||
r.fieldMap["deleted_at"] = r.DeletedAt
|
r.fieldMap["deleted_at"] = r.DeletedAt
|
||||||
r.fieldMap["resource_no"] = r.ResourceNo
|
|
||||||
r.fieldMap["type"] = r.Type
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ func newResourcePss(db *gorm.DB, opts ...gen.DOOption) resourcePss {
|
|||||||
_resourcePss.ResourceID = field.NewInt32(tableName, "resource_id")
|
_resourcePss.ResourceID = field.NewInt32(tableName, "resource_id")
|
||||||
_resourcePss.Type = field.NewInt32(tableName, "type")
|
_resourcePss.Type = field.NewInt32(tableName, "type")
|
||||||
_resourcePss.Live = field.NewInt32(tableName, "live")
|
_resourcePss.Live = field.NewInt32(tableName, "live")
|
||||||
_resourcePss.Quota = field.NewInt32(tableName, "quota")
|
|
||||||
_resourcePss.Expire = field.NewField(tableName, "expire")
|
_resourcePss.Expire = field.NewField(tableName, "expire")
|
||||||
|
_resourcePss.Quota = field.NewInt32(tableName, "quota")
|
||||||
_resourcePss.Used = field.NewInt32(tableName, "used")
|
_resourcePss.Used = field.NewInt32(tableName, "used")
|
||||||
_resourcePss.DailyLimit = field.NewInt32(tableName, "daily_limit")
|
_resourcePss.DailyLimit = field.NewInt32(tableName, "daily_limit")
|
||||||
_resourcePss.DailyUsed = field.NewInt32(tableName, "daily_used")
|
_resourcePss.DailyUsed = field.NewInt32(tableName, "daily_used")
|
||||||
@@ -51,8 +51,8 @@ type resourcePss struct {
|
|||||||
ResourceID field.Int32 // 套餐ID
|
ResourceID field.Int32 // 套餐ID
|
||||||
Type field.Int32 // 套餐类型:1-包时,2-包量
|
Type field.Int32 // 套餐类型:1-包时,2-包量
|
||||||
Live field.Int32 // 可用时长(秒)
|
Live field.Int32 // 可用时长(秒)
|
||||||
Quota field.Int32 // 配额数量
|
|
||||||
Expire field.Field // 过期时间
|
Expire field.Field // 过期时间
|
||||||
|
Quota field.Int32 // 配额数量
|
||||||
Used field.Int32 // 已用数量
|
Used field.Int32 // 已用数量
|
||||||
DailyLimit field.Int32 // 每日限制
|
DailyLimit field.Int32 // 每日限制
|
||||||
DailyUsed field.Int32 // 今日已用数量
|
DailyUsed field.Int32 // 今日已用数量
|
||||||
@@ -77,8 +77,8 @@ func (r *resourcePss) updateTableName(table string) *resourcePss {
|
|||||||
r.ResourceID = field.NewInt32(table, "resource_id")
|
r.ResourceID = field.NewInt32(table, "resource_id")
|
||||||
r.Type = field.NewInt32(table, "type")
|
r.Type = field.NewInt32(table, "type")
|
||||||
r.Live = field.NewInt32(table, "live")
|
r.Live = field.NewInt32(table, "live")
|
||||||
r.Quota = field.NewInt32(table, "quota")
|
|
||||||
r.Expire = field.NewField(table, "expire")
|
r.Expire = field.NewField(table, "expire")
|
||||||
|
r.Quota = field.NewInt32(table, "quota")
|
||||||
r.Used = field.NewInt32(table, "used")
|
r.Used = field.NewInt32(table, "used")
|
||||||
r.DailyLimit = field.NewInt32(table, "daily_limit")
|
r.DailyLimit = field.NewInt32(table, "daily_limit")
|
||||||
r.DailyUsed = field.NewInt32(table, "daily_used")
|
r.DailyUsed = field.NewInt32(table, "daily_used")
|
||||||
@@ -104,8 +104,8 @@ func (r *resourcePss) fillFieldMap() {
|
|||||||
r.fieldMap["resource_id"] = r.ResourceID
|
r.fieldMap["resource_id"] = r.ResourceID
|
||||||
r.fieldMap["type"] = r.Type
|
r.fieldMap["type"] = r.Type
|
||||||
r.fieldMap["live"] = r.Live
|
r.fieldMap["live"] = r.Live
|
||||||
r.fieldMap["quota"] = r.Quota
|
|
||||||
r.fieldMap["expire"] = r.Expire
|
r.fieldMap["expire"] = r.Expire
|
||||||
|
r.fieldMap["quota"] = r.Quota
|
||||||
r.fieldMap["used"] = r.Used
|
r.fieldMap["used"] = r.Used
|
||||||
r.fieldMap["daily_limit"] = r.DailyLimit
|
r.fieldMap["daily_limit"] = r.DailyLimit
|
||||||
r.fieldMap["daily_used"] = r.DailyUsed
|
r.fieldMap["daily_used"] = r.DailyUsed
|
||||||
|
|||||||
@@ -31,19 +31,19 @@ func newTrade(db *gorm.DB, opts ...gen.DOOption) trade {
|
|||||||
_trade.UserID = field.NewInt32(tableName, "user_id")
|
_trade.UserID = field.NewInt32(tableName, "user_id")
|
||||||
_trade.InnerNo = field.NewString(tableName, "inner_no")
|
_trade.InnerNo = field.NewString(tableName, "inner_no")
|
||||||
_trade.OuterNo = field.NewString(tableName, "outer_no")
|
_trade.OuterNo = field.NewString(tableName, "outer_no")
|
||||||
|
_trade.Type = field.NewInt32(tableName, "type")
|
||||||
_trade.Subject = field.NewString(tableName, "subject")
|
_trade.Subject = field.NewString(tableName, "subject")
|
||||||
_trade.Remark = field.NewString(tableName, "remark")
|
_trade.Remark = field.NewString(tableName, "remark")
|
||||||
_trade.Amount = field.NewFloat64(tableName, "amount")
|
_trade.Amount = field.NewFloat64(tableName, "amount")
|
||||||
_trade.Payment = field.NewFloat64(tableName, "payment")
|
_trade.Payment = field.NewFloat64(tableName, "payment")
|
||||||
_trade.Method = field.NewInt32(tableName, "method")
|
_trade.Method = field.NewInt32(tableName, "method")
|
||||||
_trade.Status = field.NewInt32(tableName, "status")
|
_trade.Status = field.NewInt32(tableName, "status")
|
||||||
|
_trade.PayURL = field.NewString(tableName, "pay_url")
|
||||||
|
_trade.PaidAt = field.NewField(tableName, "paid_at")
|
||||||
|
_trade.CancelAt = field.NewField(tableName, "cancel_at")
|
||||||
_trade.CreatedAt = field.NewField(tableName, "created_at")
|
_trade.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_trade.UpdatedAt = field.NewField(tableName, "updated_at")
|
_trade.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_trade.DeletedAt = field.NewField(tableName, "deleted_at")
|
_trade.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_trade.Type = field.NewInt32(tableName, "type")
|
|
||||||
_trade.CancelAt = field.NewField(tableName, "cancel_at")
|
|
||||||
_trade.PaidAt = field.NewField(tableName, "paid_at")
|
|
||||||
_trade.PayURL = field.NewString(tableName, "pay_url")
|
|
||||||
|
|
||||||
_trade.fillFieldMap()
|
_trade.fillFieldMap()
|
||||||
|
|
||||||
@@ -58,19 +58,19 @@ type trade struct {
|
|||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
InnerNo field.String // 内部订单号
|
InnerNo field.String // 内部订单号
|
||||||
OuterNo field.String // 外部订单号
|
OuterNo field.String // 外部订单号
|
||||||
|
Type field.Int32 // 订单类型:1-购买产品,2-充值余额
|
||||||
Subject field.String // 订单主题
|
Subject field.String // 订单主题
|
||||||
Remark field.String // 订单备注
|
Remark field.String // 订单备注
|
||||||
Amount field.Float64 // 订单总金额
|
Amount field.Float64 // 订单总金额
|
||||||
Payment field.Float64 // 支付金额
|
Payment field.Float64 // 支付金额
|
||||||
Method field.Int32 // 支付方式:1-支付宝,2-微信
|
Method field.Int32 // 支付方式:1-支付宝,2-微信
|
||||||
Status field.Int32 // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
Status field.Int32 // 订单状态:0-待支付,1-已支付,2-已取消,3-已退款
|
||||||
|
PayURL field.String // 支付链接
|
||||||
|
PaidAt field.Field // 支付时间
|
||||||
|
CancelAt field.Field // 取消时间
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
Type field.Int32 // 订单类型:0-充值余额,1-购买产品
|
|
||||||
CancelAt field.Field // 取消时间
|
|
||||||
PaidAt field.Field // 支付时间
|
|
||||||
PayURL field.String // 支付链接
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -91,19 +91,19 @@ func (t *trade) updateTableName(table string) *trade {
|
|||||||
t.UserID = field.NewInt32(table, "user_id")
|
t.UserID = field.NewInt32(table, "user_id")
|
||||||
t.InnerNo = field.NewString(table, "inner_no")
|
t.InnerNo = field.NewString(table, "inner_no")
|
||||||
t.OuterNo = field.NewString(table, "outer_no")
|
t.OuterNo = field.NewString(table, "outer_no")
|
||||||
|
t.Type = field.NewInt32(table, "type")
|
||||||
t.Subject = field.NewString(table, "subject")
|
t.Subject = field.NewString(table, "subject")
|
||||||
t.Remark = field.NewString(table, "remark")
|
t.Remark = field.NewString(table, "remark")
|
||||||
t.Amount = field.NewFloat64(table, "amount")
|
t.Amount = field.NewFloat64(table, "amount")
|
||||||
t.Payment = field.NewFloat64(table, "payment")
|
t.Payment = field.NewFloat64(table, "payment")
|
||||||
t.Method = field.NewInt32(table, "method")
|
t.Method = field.NewInt32(table, "method")
|
||||||
t.Status = field.NewInt32(table, "status")
|
t.Status = field.NewInt32(table, "status")
|
||||||
|
t.PayURL = field.NewString(table, "pay_url")
|
||||||
|
t.PaidAt = field.NewField(table, "paid_at")
|
||||||
|
t.CancelAt = field.NewField(table, "cancel_at")
|
||||||
t.CreatedAt = field.NewField(table, "created_at")
|
t.CreatedAt = field.NewField(table, "created_at")
|
||||||
t.UpdatedAt = field.NewField(table, "updated_at")
|
t.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
t.DeletedAt = field.NewField(table, "deleted_at")
|
t.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
t.Type = field.NewInt32(table, "type")
|
|
||||||
t.CancelAt = field.NewField(table, "cancel_at")
|
|
||||||
t.PaidAt = field.NewField(table, "paid_at")
|
|
||||||
t.PayURL = field.NewString(table, "pay_url")
|
|
||||||
|
|
||||||
t.fillFieldMap()
|
t.fillFieldMap()
|
||||||
|
|
||||||
@@ -125,19 +125,19 @@ func (t *trade) fillFieldMap() {
|
|||||||
t.fieldMap["user_id"] = t.UserID
|
t.fieldMap["user_id"] = t.UserID
|
||||||
t.fieldMap["inner_no"] = t.InnerNo
|
t.fieldMap["inner_no"] = t.InnerNo
|
||||||
t.fieldMap["outer_no"] = t.OuterNo
|
t.fieldMap["outer_no"] = t.OuterNo
|
||||||
|
t.fieldMap["type"] = t.Type
|
||||||
t.fieldMap["subject"] = t.Subject
|
t.fieldMap["subject"] = t.Subject
|
||||||
t.fieldMap["remark"] = t.Remark
|
t.fieldMap["remark"] = t.Remark
|
||||||
t.fieldMap["amount"] = t.Amount
|
t.fieldMap["amount"] = t.Amount
|
||||||
t.fieldMap["payment"] = t.Payment
|
t.fieldMap["payment"] = t.Payment
|
||||||
t.fieldMap["method"] = t.Method
|
t.fieldMap["method"] = t.Method
|
||||||
t.fieldMap["status"] = t.Status
|
t.fieldMap["status"] = t.Status
|
||||||
|
t.fieldMap["pay_url"] = t.PayURL
|
||||||
|
t.fieldMap["paid_at"] = t.PaidAt
|
||||||
|
t.fieldMap["cancel_at"] = t.CancelAt
|
||||||
t.fieldMap["created_at"] = t.CreatedAt
|
t.fieldMap["created_at"] = t.CreatedAt
|
||||||
t.fieldMap["updated_at"] = t.UpdatedAt
|
t.fieldMap["updated_at"] = t.UpdatedAt
|
||||||
t.fieldMap["deleted_at"] = t.DeletedAt
|
t.fieldMap["deleted_at"] = t.DeletedAt
|
||||||
t.fieldMap["type"] = t.Type
|
|
||||||
t.fieldMap["cancel_at"] = t.CancelAt
|
|
||||||
t.fieldMap["paid_at"] = t.PaidAt
|
|
||||||
t.fieldMap["pay_url"] = t.PayURL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t trade) clone(db *gorm.DB) trade {
|
func (t trade) clone(db *gorm.DB) trade {
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ type user struct {
|
|||||||
Password field.String // 用户密码
|
Password field.String // 用户密码
|
||||||
Name field.String // 真实姓名
|
Name field.String // 真实姓名
|
||||||
Avatar field.String // 头像URL
|
Avatar field.String // 头像URL
|
||||||
Status field.Int32 // 用户状态:1-正常,0-禁用
|
Status field.Int32 // 用户状态:0-禁用,1-正常
|
||||||
Balance field.Float64 // 账户余额
|
Balance field.Float64 // 账户余额
|
||||||
IDType field.Int32 // 认证类型:0-未认证,1-个人认证,2-企业认证
|
IDType field.Int32 // 认证类型:0-未认证,1-个人认证,2-企业认证
|
||||||
IDNo field.String // 身份证号或营业执照号
|
IDNo field.String // 身份证号或营业执照号
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ func newWhitelist(db *gorm.DB, opts ...gen.DOOption) whitelist {
|
|||||||
_whitelist.ID = field.NewInt32(tableName, "id")
|
_whitelist.ID = field.NewInt32(tableName, "id")
|
||||||
_whitelist.UserID = field.NewInt32(tableName, "user_id")
|
_whitelist.UserID = field.NewInt32(tableName, "user_id")
|
||||||
_whitelist.Host = field.NewString(tableName, "host")
|
_whitelist.Host = field.NewString(tableName, "host")
|
||||||
|
_whitelist.Remark = field.NewString(tableName, "remark")
|
||||||
_whitelist.CreatedAt = field.NewField(tableName, "created_at")
|
_whitelist.CreatedAt = field.NewField(tableName, "created_at")
|
||||||
_whitelist.UpdatedAt = field.NewField(tableName, "updated_at")
|
_whitelist.UpdatedAt = field.NewField(tableName, "updated_at")
|
||||||
_whitelist.DeletedAt = field.NewField(tableName, "deleted_at")
|
_whitelist.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||||
_whitelist.Remark = field.NewString(tableName, "remark")
|
|
||||||
|
|
||||||
_whitelist.fillFieldMap()
|
_whitelist.fillFieldMap()
|
||||||
|
|
||||||
@@ -47,10 +47,10 @@ type whitelist struct {
|
|||||||
ID field.Int32 // 白名单ID
|
ID field.Int32 // 白名单ID
|
||||||
UserID field.Int32 // 用户ID
|
UserID field.Int32 // 用户ID
|
||||||
Host field.String // IP地址
|
Host field.String // IP地址
|
||||||
|
Remark field.String // 备注
|
||||||
CreatedAt field.Field // 创建时间
|
CreatedAt field.Field // 创建时间
|
||||||
UpdatedAt field.Field // 更新时间
|
UpdatedAt field.Field // 更新时间
|
||||||
DeletedAt field.Field // 删除时间
|
DeletedAt field.Field // 删除时间
|
||||||
Remark field.String // 备注
|
|
||||||
|
|
||||||
fieldMap map[string]field.Expr
|
fieldMap map[string]field.Expr
|
||||||
}
|
}
|
||||||
@@ -70,10 +70,10 @@ func (w *whitelist) updateTableName(table string) *whitelist {
|
|||||||
w.ID = field.NewInt32(table, "id")
|
w.ID = field.NewInt32(table, "id")
|
||||||
w.UserID = field.NewInt32(table, "user_id")
|
w.UserID = field.NewInt32(table, "user_id")
|
||||||
w.Host = field.NewString(table, "host")
|
w.Host = field.NewString(table, "host")
|
||||||
|
w.Remark = field.NewString(table, "remark")
|
||||||
w.CreatedAt = field.NewField(table, "created_at")
|
w.CreatedAt = field.NewField(table, "created_at")
|
||||||
w.UpdatedAt = field.NewField(table, "updated_at")
|
w.UpdatedAt = field.NewField(table, "updated_at")
|
||||||
w.DeletedAt = field.NewField(table, "deleted_at")
|
w.DeletedAt = field.NewField(table, "deleted_at")
|
||||||
w.Remark = field.NewString(table, "remark")
|
|
||||||
|
|
||||||
w.fillFieldMap()
|
w.fillFieldMap()
|
||||||
|
|
||||||
@@ -94,10 +94,10 @@ func (w *whitelist) fillFieldMap() {
|
|||||||
w.fieldMap["id"] = w.ID
|
w.fieldMap["id"] = w.ID
|
||||||
w.fieldMap["user_id"] = w.UserID
|
w.fieldMap["user_id"] = w.UserID
|
||||||
w.fieldMap["host"] = w.Host
|
w.fieldMap["host"] = w.Host
|
||||||
|
w.fieldMap["remark"] = w.Remark
|
||||||
w.fieldMap["created_at"] = w.CreatedAt
|
w.fieldMap["created_at"] = w.CreatedAt
|
||||||
w.fieldMap["updated_at"] = w.UpdatedAt
|
w.fieldMap["updated_at"] = w.UpdatedAt
|
||||||
w.fieldMap["deleted_at"] = w.DeletedAt
|
w.fieldMap["deleted_at"] = w.DeletedAt
|
||||||
w.fieldMap["remark"] = w.Remark
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w whitelist) clone(db *gorm.DB) whitelist {
|
func (w whitelist) clone(db *gorm.DB) whitelist {
|
||||||
|
|||||||
Reference in New Issue
Block a user