添加访问日志表及相关字段,更新模型字段注释

This commit is contained in:
2025-05-08 10:46:21 +08:00
parent 0e0affb008
commit c93d0bf467
37 changed files with 664 additions and 242 deletions

View File

@@ -21,7 +21,7 @@ type Admin struct {
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
Phone string `gorm:"column:phone;comment:手机号码" json:"phone"` // 手机号码
Email string `gorm:"column:email;comment:邮箱" json:"email"` // 邮箱
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
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"` // 最后登录时间
LastLoginHost string `gorm:"column:last_login_host;comment:最后登录地址" json:"last_login_host"` // 最后登录地址
LastLoginAgent string `gorm:"column:last_login_agent;comment:最后登录代理" json:"last_login_agent"` // 最后登录代理

View File

@@ -14,16 +14,16 @@ const TableNameAnnouncement = "announcement"
// Announcement mapped from table <announcement>
type Announcement struct {
CreatedAt core.LocalDateTime `gorm:"column:created_at;default:CURRENT_TIMESTAMP" json:"created_at"`
UpdatedAt core.LocalDateTime `gorm:"column:updated_at;default:CURRENT_TIMESTAMP" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at" json:"deleted_at"`
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true" json:"id"`
Type int32 `gorm:"column:type;not null;default:1" json:"type"`
Status int32 `gorm:"column:status;not null;default:1" json:"status"`
Sort int32 `gorm:"column:sort;not null" json:"sort"`
Pin bool `gorm:"column:pin;not null" json:"pin"`
Title string `gorm:"column:title;not null" json:"title"`
Content string `gorm:"column:content" json:"content"`
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:公告ID" json:"id"` // 公告ID
Title string `gorm:"column:title;not null;comment:公告标题" json:"title"` // 公告标题
Content string `gorm:"column:content;comment:公告内容" json:"content"` // 公告内容
Type int32 `gorm:"column:type;not null;default:1;comment:公告类型1-普通公告" json:"type"` // 公告类型1-普通公告
Pin bool `gorm:"column:pin;not null;comment:是否置顶" json:"pin"` // 是否置顶
Status int32 `gorm:"column:status;not null;default:1;comment:公告状态0-禁用1-正常" json:"status"` // 公告状态0-禁用1-正常
Sort int32 `gorm:"column:sort;not null;comment:公告排序" json:"sort"` // 公告排序
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 Announcement's table name

View File

@@ -16,16 +16,16 @@ const TableNameBill = "bill"
type Bill struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:账单ID" json:"id"` // 账单ID
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
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"` // 产品可读信息
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"` // 创建时间
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"` // 删除时间
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"`
Refund *Refund `gorm:"foreignKey:RefundID" json:"refund"`
Resource *Resource `gorm:"foreignKey:ResourceID" json:"resource"`

View File

@@ -18,10 +18,12 @@ type Channel struct {
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
ProxyID int32 `gorm:"column:proxy_id;not null;comment:代理ID" json:"proxy_id"` // 代理ID
NodeID int32 `gorm:"column:node_id;comment:节点ID" json:"node_id"` // 节点ID
ProxyHost string `gorm:"column:proxy_host;not null;comment:代理地址" json:"proxy_host"` // 代理地址
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"` // 节点地址
Protocol int32 `gorm:"column:protocol;comment:协议类型1-http2-https3-socks5" json:"protocol"` // 协议类型1-http2-https3-socks5
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"` // 密码认证
Username string `gorm:"column:username;comment:用户名" json:"username"` // 用户名
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"` // 创建时间
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"` // 删除时间
ProxyHost string `gorm:"column:proxy_host;not null" json:"proxy_host"`
Protocol int32 `gorm:"column:protocol;comment:协议类型1-http2-https3-socks5" json:"protocol"` // 协议类型1-http2-https3-socks5
}
// TableName Channel's table name

View File

@@ -21,14 +21,14 @@ type Client struct {
GrantCode bool `gorm:"column:grant_code;not null;comment:允许授权码授予" json:"grant_code"` // 允许授权码授予
GrantClient bool `gorm:"column:grant_client;not null;comment:允许客户端凭证授予" json:"grant_client"` // 允许客户端凭证授予
GrantRefresh bool `gorm:"column:grant_refresh;not null;comment:允许刷新令牌授予" json:"grant_refresh"` // 允许刷新令牌授予
Spec int32 `gorm:"column:spec;not null;comment:安全规范0-web1-native2-browser" json:"spec"` // 安全规范0-web1-native2-browser
GrantPassword bool `gorm:"column:grant_password;not null;comment:允许密码授予" json:"grant_password"` // 允许密码授予
Spec int32 `gorm:"column:spec;not null;comment:安全规范1-native2-browser3-web" json:"spec"` // 安全规范1-native2-browser3-web
Name string `gorm:"column:name;not null;comment:名称" json:"name"` // 名称
Icon string `gorm:"column:icon;comment:图标URL" json:"icon"` // 图标URL
Status int32 `gorm:"column:status;not null;default:1;comment:状态:1-正常,0-禁用" json:"status"` // 状态:1-正常,0-禁用
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"` // 创建时间
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"` // 删除时间
GrantPassword bool `gorm:"column:grant_password;not null" json:"grant_password"`
}
// TableName Client's table name

View File

@@ -14,17 +14,17 @@ const TableNameCoupon = "coupon"
// Coupon mapped from table <coupon>
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
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"` // 优惠券代码
Remark string `gorm:"column:remark;comment:优惠券备注" json:"remark"` // 优惠券备注
Amount float64 `gorm:"column:amount;not null;comment:优惠券金额" json:"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

View File

@@ -0,0 +1,28 @@
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
// Code generated by gorm.io/gen. DO NOT EDIT.
package models
import "platform/web/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
}

View File

@@ -15,12 +15,13 @@ const TableNameNode = "node"
// Node mapped from table <node>
type Node struct {
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"` // 节点版本
Name string `gorm:"column:name;not null;comment:节点名称" json:"name"` // 节点名称
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"` // 省份
City string `gorm:"column:city;not null;comment:城市" json:"city"` // 城市
ProxyID int32 `gorm:"column:proxy_id;comment:代理ID" json:"proxy_id"` // 代理ID
ProxyPort int32 `gorm:"column:proxy_port;comment:代理端口" json:"proxy_port"` // 代理端口
Status int32 `gorm:"column:status;not null;comment:节点状态0-离线1-正常" json:"status"` // 节点状态0-离线1-正常
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"` // 创建时间
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"` // 删除时间
Isp int32 `gorm:"column:isp;not null;comment:运营商0-其他1-电信2-联通3-移动" json:"isp"` // 运营商0-其他1-电信2-联通3-移动
}
// TableName Node's table name

View File

@@ -19,7 +19,7 @@ type Product struct {
Name string `gorm:"column:name;not null;comment:产品名称" json:"name"` // 产品名称
Description string `gorm:"column:description;comment:产品描述" json:"description"` // 产品描述
Sort int32 `gorm:"column:sort;not null;comment:排序" json:"sort"` // 排序
Status int32 `gorm:"column:status;not null;default:1;comment:产品状态:1-正常,0-禁用" json:"status"` // 产品状态:1-正常,0-禁用
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"` // 创建时间
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"` // 删除时间

View File

@@ -18,7 +18,7 @@ type Proxy struct {
Version int32 `gorm:"column:version;not null;comment:代理服务版本" json:"version"` // 代理服务版本
Name string `gorm:"column:name;not null;comment:代理服务名称" json:"name"` // 代理服务名称
Host string `gorm:"column:host;not null;comment:代理服务地址" json:"host"` // 代理服务地址
Type int32 `gorm:"column:type;not null;comment:代理服务类型:0-自有,1-三方" json:"type"` // 代理服务类型:0-自有,1-三方
Type int32 `gorm:"column:type;not null;comment:代理服务类型1-三方2-自有" json:"type"` // 代理服务类型1-三方2-自有
Secret string `gorm:"column:secret;comment:代理服务密钥" json:"secret"` // 代理服务密钥
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"` // 更新时间

View File

@@ -15,14 +15,14 @@ const TableNameRefund = "refund"
// Refund mapped from table <refund>
type Refund struct {
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
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"` // 创建时间
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"` // 删除时间
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

View File

@@ -16,12 +16,12 @@ const TableNameResource = "resource"
type Resource struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:套餐ID" json:"id"` // 套餐ID
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
ResourceNo string `gorm:"column:resource_no;comment:套餐编号" json:"resource_no"` // 套餐编号
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"` // 创建时间
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"` // 删除时间
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"`
}

View File

@@ -14,8 +14,8 @@ type ResourcePss struct {
ResourceID int32 `gorm:"column:resource_id;not null;comment:套餐ID" json:"resource_id"` // 套餐ID
Type int32 `gorm:"column:type;comment:套餐类型1-包时2-包量" json:"type"` // 套餐类型1-包时2-包量
Live int32 `gorm:"column:live;comment:可用时长(秒)" json:"live"` // 可用时长(秒)
Quota int32 `gorm:"column:quota;comment:配额数量" json:"quota"` // 配额数量
Expire 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"` // 已用数量
DailyLimit int32 `gorm:"column:daily_limit;not null;comment:每日限制" json:"daily_limit"` // 每日限制
DailyUsed int32 `gorm:"column:daily_used;not null;comment:今日已用数量" json:"daily_used"` // 今日已用数量

View File

@@ -18,19 +18,19 @@ type Trade struct {
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
InnerNo string `gorm:"column:inner_no;not null;comment:内部订单号" json:"inner_no"` // 内部订单号
OuterNo string `gorm:"column:outer_no;comment:外部订单号" json:"outer_no"` // 外部订单号
Type int32 `gorm:"column:type;not null;comment:订单类型1-购买产品2-充值余额" json:"type"` // 订单类型1-购买产品2-充值余额
Subject string `gorm:"column:subject;not null;comment:订单主题" json:"subject"` // 订单主题
Remark string `gorm:"column:remark;comment:订单备注" json:"remark"` // 订单备注
Amount float64 `gorm:"column:amount;not null;comment:订单总金额" json:"amount"` // 订单总金额
Payment float64 `gorm:"column:payment;not null;comment:支付金额" json:"payment"` // 支付金额
Method int32 `gorm:"column:method;not null;comment:支付方式1-支付宝2-微信" json:"method"` // 支付方式1-支付宝2-微信
Status int32 `gorm:"column:status;not null;comment:订单状态0-待支付1-已支付2-已取消3-已退款" json:"status"` // 订单状态0-待支付1-已支付2-已取消3-已退款
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"` // 创建时间
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"` // 删除时间
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

View File

@@ -22,7 +22,7 @@ type User struct {
Password string `gorm:"column:password;comment:用户密码" json:"password"` // 用户密码
Name string `gorm:"column:name;comment:真实姓名" json:"name"` // 真实姓名
Avatar string `gorm:"column:avatar;comment:头像URL" json:"avatar"` // 头像URL
Status int32 `gorm:"column:status;not null;default:1;comment:用户状态:1-正常,0-禁用" json:"status"` // 用户状态:1-正常,0-禁用
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"` // 账户余额
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"` // 身份证号或营业执照号

View File

@@ -17,10 +17,10 @@ type Whitelist struct {
ID int32 `gorm:"column:id;primaryKey;autoIncrement:true;comment:白名单ID" json:"id"` // 白名单ID
UserID int32 `gorm:"column:user_id;not null;comment:用户ID" json:"user_id"` // 用户ID
Host string `gorm:"column:host;not null;comment:IP地址" json:"host"` // IP地址
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
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"` // 删除时间
Remark string `gorm:"column:remark;comment:备注" json:"remark"` // 备注
}
// TableName Whitelist's table name

View File

@@ -58,7 +58,7 @@ type admin struct {
Avatar field.String // 头像URL
Phone field.String // 手机号码
Email field.String // 邮箱
Status field.Int32 // 状态:1-正常,0-禁用
Status field.Int32 // 状态0-禁用1-正常
LastLogin field.Field // 最后登录时间
LastLoginHost field.String // 最后登录地址
LastLoginAgent field.String // 最后登录代理

View File

@@ -27,16 +27,16 @@ func newAnnouncement(db *gorm.DB, opts ...gen.DOOption) announcement {
tableName := _announcement.announcementDo.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.UpdatedAt = field.NewField(tableName, "updated_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()
@@ -47,16 +47,16 @@ type announcement struct {
announcementDo
ALL field.Asterisk
CreatedAt field.Field
UpdatedAt field.Field
DeletedAt field.Field
ID field.Int32
Type field.Int32
Status field.Int32
Sort field.Int32
Pin field.Bool
Title field.String
Content field.String
ID field.Int32 // 公告ID
Title field.String // 公告标题
Content field.String // 公告内容
Type field.Int32 // 公告类型1-普通公告
Pin field.Bool // 是否置顶
Status field.Int32 // 公告状态0-禁用1-正常
Sort field.Int32 // 公告排序
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
fieldMap map[string]field.Expr
}
@@ -73,16 +73,16 @@ func (a announcement) As(alias string) *announcement {
func (a *announcement) updateTableName(table string) *announcement {
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.UpdatedAt = field.NewField(table, "updated_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()
@@ -100,16 +100,16 @@ func (a *announcement) GetFieldByName(fieldName string) (field.OrderExpr, bool)
func (a *announcement) fillFieldMap() {
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["updated_at"] = a.UpdatedAt
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 {

View File

@@ -29,16 +29,16 @@ func newBill(db *gorm.DB, opts ...gen.DOOption) bill {
_bill.ALL = field.NewAsterisk(tableName)
_bill.ID = field.NewInt32(tableName, "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.Type = field.NewInt32(tableName, "type")
_bill.Amount = field.NewFloat64(tableName, "amount")
_bill.CreatedAt = field.NewField(tableName, "created_at")
_bill.UpdatedAt = field.NewField(tableName, "updated_at")
_bill.DeletedAt = field.NewField(tableName, "deleted_at")
_bill.TradeID = field.NewInt32(tableName, "trade_id")
_bill.ResourceID = field.NewInt32(tableName, "resource_id")
_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{
db: db.Session(&gorm.Session{}),
@@ -73,16 +73,16 @@ type bill struct {
ALL field.Asterisk
ID 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 // 产品可读信息
Type field.Int32 // 账单类型1-消费2-退款3-充值
Amount field.Float64 // 账单金额
CreatedAt field.Field // 创建时间
UpdatedAt 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
Refund billBelongsToRefund
@@ -106,16 +106,16 @@ func (b *bill) updateTableName(table string) *bill {
b.ALL = field.NewAsterisk(table)
b.ID = field.NewInt32(table, "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.Type = field.NewInt32(table, "type")
b.Amount = field.NewFloat64(table, "amount")
b.CreatedAt = field.NewField(table, "created_at")
b.UpdatedAt = field.NewField(table, "updated_at")
b.DeletedAt = field.NewField(table, "deleted_at")
b.TradeID = field.NewInt32(table, "trade_id")
b.ResourceID = field.NewInt32(table, "resource_id")
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()
@@ -135,16 +135,16 @@ func (b *bill) fillFieldMap() {
b.fieldMap = make(map[string]field.Expr, 15)
b.fieldMap["id"] = b.ID
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["type"] = b.Type
b.fieldMap["amount"] = b.Amount
b.fieldMap["created_at"] = b.CreatedAt
b.fieldMap["updated_at"] = b.UpdatedAt
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
}

View File

@@ -31,10 +31,12 @@ func newChannel(db *gorm.DB, opts ...gen.DOOption) channel {
_channel.UserID = field.NewInt32(tableName, "user_id")
_channel.ProxyID = field.NewInt32(tableName, "proxy_id")
_channel.NodeID = field.NewInt32(tableName, "node_id")
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
_channel.ProxyPort = field.NewInt32(tableName, "proxy_port")
_channel.UserHost = field.NewString(tableName, "user_host")
_channel.NodeHost = field.NewString(tableName, "node_host")
_channel.Protocol = field.NewInt32(tableName, "protocol")
_channel.AuthIP = field.NewBool(tableName, "auth_ip")
_channel.UserHost = field.NewString(tableName, "user_host")
_channel.AuthPass = field.NewBool(tableName, "auth_pass")
_channel.Username = field.NewString(tableName, "username")
_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.UpdatedAt = field.NewField(tableName, "updated_at")
_channel.DeletedAt = field.NewField(tableName, "deleted_at")
_channel.ProxyHost = field.NewString(tableName, "proxy_host")
_channel.Protocol = field.NewInt32(tableName, "protocol")
_channel.fillFieldMap()
@@ -58,10 +58,12 @@ type channel struct {
UserID field.Int32 // 用户ID
ProxyID field.Int32 // 代理ID
NodeID field.Int32 // 节点ID
ProxyHost field.String // 代理地址
ProxyPort field.Int32 // 转发端口
UserHost field.String // 用户地址
NodeHost field.String // 节点地址
Protocol field.Int32 // 协议类型1-http2-https3-socks5
AuthIP field.Bool // IP认证
UserHost field.String // 用户地址
AuthPass field.Bool // 密码认证
Username field.String // 用户名
Password field.String // 密码
@@ -69,8 +71,6 @@ type channel struct {
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
ProxyHost field.String
Protocol field.Int32 // 协议类型1-http2-https3-socks5
fieldMap map[string]field.Expr
}
@@ -91,10 +91,12 @@ func (c *channel) updateTableName(table string) *channel {
c.UserID = field.NewInt32(table, "user_id")
c.ProxyID = field.NewInt32(table, "proxy_id")
c.NodeID = field.NewInt32(table, "node_id")
c.ProxyHost = field.NewString(table, "proxy_host")
c.ProxyPort = field.NewInt32(table, "proxy_port")
c.UserHost = field.NewString(table, "user_host")
c.NodeHost = field.NewString(table, "node_host")
c.Protocol = field.NewInt32(table, "protocol")
c.AuthIP = field.NewBool(table, "auth_ip")
c.UserHost = field.NewString(table, "user_host")
c.AuthPass = field.NewBool(table, "auth_pass")
c.Username = field.NewString(table, "username")
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.UpdatedAt = field.NewField(table, "updated_at")
c.DeletedAt = field.NewField(table, "deleted_at")
c.ProxyHost = field.NewString(table, "proxy_host")
c.Protocol = field.NewInt32(table, "protocol")
c.fillFieldMap()
@@ -125,10 +125,12 @@ func (c *channel) fillFieldMap() {
c.fieldMap["user_id"] = c.UserID
c.fieldMap["proxy_id"] = c.ProxyID
c.fieldMap["node_id"] = c.NodeID
c.fieldMap["proxy_host"] = c.ProxyHost
c.fieldMap["proxy_port"] = c.ProxyPort
c.fieldMap["user_host"] = c.UserHost
c.fieldMap["node_host"] = c.NodeHost
c.fieldMap["protocol"] = c.Protocol
c.fieldMap["auth_ip"] = c.AuthIP
c.fieldMap["user_host"] = c.UserHost
c.fieldMap["auth_pass"] = c.AuthPass
c.fieldMap["username"] = c.Username
c.fieldMap["password"] = c.Password
@@ -136,8 +138,6 @@ func (c *channel) fillFieldMap() {
c.fieldMap["created_at"] = c.CreatedAt
c.fieldMap["updated_at"] = c.UpdatedAt
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 {

View File

@@ -34,6 +34,7 @@ func newClient(db *gorm.DB, opts ...gen.DOOption) client {
_client.GrantCode = field.NewBool(tableName, "grant_code")
_client.GrantClient = field.NewBool(tableName, "grant_client")
_client.GrantRefresh = field.NewBool(tableName, "grant_refresh")
_client.GrantPassword = field.NewBool(tableName, "grant_password")
_client.Spec = field.NewInt32(tableName, "spec")
_client.Name = field.NewString(tableName, "name")
_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.UpdatedAt = field.NewField(tableName, "updated_at")
_client.DeletedAt = field.NewField(tableName, "deleted_at")
_client.GrantPassword = field.NewBool(tableName, "grant_password")
_client.fillFieldMap()
@@ -59,14 +59,14 @@ type client struct {
GrantCode field.Bool // 允许授权码授予
GrantClient field.Bool // 允许客户端凭证授予
GrantRefresh field.Bool // 允许刷新令牌授予
Spec field.Int32 // 安全规范0-web1-native2-browser
GrantPassword field.Bool // 允许密码授予
Spec field.Int32 // 安全规范1-native2-browser3-web
Name field.String // 名称
Icon field.String // 图标URL
Status field.Int32 // 状态:1-正常,0-禁用
Status field.Int32 // 状态0-禁用1-正常
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
GrantPassword field.Bool
fieldMap map[string]field.Expr
}
@@ -90,6 +90,7 @@ func (c *client) updateTableName(table string) *client {
c.GrantCode = field.NewBool(table, "grant_code")
c.GrantClient = field.NewBool(table, "grant_client")
c.GrantRefresh = field.NewBool(table, "grant_refresh")
c.GrantPassword = field.NewBool(table, "grant_password")
c.Spec = field.NewInt32(table, "spec")
c.Name = field.NewString(table, "name")
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.UpdatedAt = field.NewField(table, "updated_at")
c.DeletedAt = field.NewField(table, "deleted_at")
c.GrantPassword = field.NewBool(table, "grant_password")
c.fillFieldMap()
@@ -122,6 +122,7 @@ func (c *client) fillFieldMap() {
c.fieldMap["grant_code"] = c.GrantCode
c.fieldMap["grant_client"] = c.GrantClient
c.fieldMap["grant_refresh"] = c.GrantRefresh
c.fieldMap["grant_password"] = c.GrantPassword
c.fieldMap["spec"] = c.Spec
c.fieldMap["name"] = c.Name
c.fieldMap["icon"] = c.Icon
@@ -129,7 +130,6 @@ func (c *client) fillFieldMap() {
c.fieldMap["created_at"] = c.CreatedAt
c.fieldMap["updated_at"] = c.UpdatedAt
c.fieldMap["deleted_at"] = c.DeletedAt
c.fieldMap["grant_password"] = c.GrantPassword
}
func (c client) clone(db *gorm.DB) client {

View File

@@ -27,17 +27,17 @@ func newCoupon(db *gorm.DB, opts ...gen.DOOption) coupon {
tableName := _coupon.couponDo.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.UserID = field.NewInt32(tableName, "user_id")
_coupon.Status = field.NewInt32(tableName, "status")
_coupon.Code = field.NewString(tableName, "code")
_coupon.Remark = field.NewString(tableName, "remark")
_coupon.Amount = field.NewFloat64(tableName, "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()
@@ -48,17 +48,17 @@ type coupon struct {
couponDo
ALL field.Asterisk
ExpireAt field.Field // 过期时间
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
ID field.Int32 // 优惠券ID
UserID field.Int32 // 用户ID
Status field.Int32 // 优惠券状态0-未使用1-已使用2-已过期
Code field.String // 优惠券代码
Remark field.String // 优惠券备注
Amount 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
}
@@ -75,17 +75,17 @@ func (c coupon) As(alias string) *coupon {
func (c *coupon) updateTableName(table string) *coupon {
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.UserID = field.NewInt32(table, "user_id")
c.Status = field.NewInt32(table, "status")
c.Code = field.NewString(table, "code")
c.Remark = field.NewString(table, "remark")
c.Amount = field.NewFloat64(table, "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()
@@ -103,17 +103,17 @@ func (c *coupon) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
func (c *coupon) fillFieldMap() {
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["user_id"] = c.UserID
c.fieldMap["status"] = c.Status
c.fieldMap["code"] = c.Code
c.fieldMap["remark"] = c.Remark
c.fieldMap["amount"] = c.Amount
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 {

View File

@@ -27,6 +27,7 @@ var (
Client *client
ClientPermissionLink *clientPermissionLink
Coupon *coupon
LogsRequest *logsRequest
Node *node
Permission *permission
Product *product
@@ -56,6 +57,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
Client = &Q.Client
ClientPermissionLink = &Q.ClientPermissionLink
Coupon = &Q.Coupon
LogsRequest = &Q.LogsRequest
Node = &Q.Node
Permission = &Q.Permission
Product = &Q.Product
@@ -86,6 +88,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
Client: newClient(db, opts...),
ClientPermissionLink: newClientPermissionLink(db, opts...),
Coupon: newCoupon(db, opts...),
LogsRequest: newLogsRequest(db, opts...),
Node: newNode(db, opts...),
Permission: newPermission(db, opts...),
Product: newProduct(db, opts...),
@@ -117,6 +120,7 @@ type Query struct {
Client client
ClientPermissionLink clientPermissionLink
Coupon coupon
LogsRequest logsRequest
Node node
Permission permission
Product product
@@ -149,6 +153,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
Client: q.Client.clone(db),
ClientPermissionLink: q.ClientPermissionLink.clone(db),
Coupon: q.Coupon.clone(db),
LogsRequest: q.LogsRequest.clone(db),
Node: q.Node.clone(db),
Permission: q.Permission.clone(db),
Product: q.Product.clone(db),
@@ -188,6 +193,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
Client: q.Client.replaceDB(db),
ClientPermissionLink: q.ClientPermissionLink.replaceDB(db),
Coupon: q.Coupon.replaceDB(db),
LogsRequest: q.LogsRequest.replaceDB(db),
Node: q.Node.replaceDB(db),
Permission: q.Permission.replaceDB(db),
Product: q.Product.replaceDB(db),
@@ -217,6 +223,7 @@ type queryCtx struct {
Client *clientDo
ClientPermissionLink *clientPermissionLinkDo
Coupon *couponDo
LogsRequest *logsRequestDo
Node *nodeDo
Permission *permissionDo
Product *productDo
@@ -246,6 +253,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
Client: q.Client.WithContext(ctx),
ClientPermissionLink: q.ClientPermissionLink.WithContext(ctx),
Coupon: q.Coupon.WithContext(ctx),
LogsRequest: q.LogsRequest.WithContext(ctx),
Node: q.Node.WithContext(ctx),
Permission: q.Permission.WithContext(ctx),
Product: q.Product.WithContext(ctx),

View 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
}

View File

@@ -28,12 +28,13 @@ func newNode(db *gorm.DB, opts ...gen.DOOption) node {
tableName := _node.nodeDo.TableName()
_node.ALL = field.NewAsterisk(tableName)
_node.ID = field.NewInt32(tableName, "id")
_node.ProxyID = field.NewInt32(tableName, "proxy_id")
_node.Version = field.NewInt32(tableName, "version")
_node.Name = field.NewString(tableName, "name")
_node.Host = field.NewString(tableName, "host")
_node.Isp = field.NewInt32(tableName, "isp")
_node.Prov = field.NewString(tableName, "prov")
_node.City = field.NewString(tableName, "city")
_node.ProxyID = field.NewInt32(tableName, "proxy_id")
_node.ProxyPort = field.NewInt32(tableName, "proxy_port")
_node.Status = field.NewInt32(tableName, "status")
_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.UpdatedAt = field.NewField(tableName, "updated_at")
_node.DeletedAt = field.NewField(tableName, "deleted_at")
_node.Isp = field.NewInt32(tableName, "isp")
_node.fillFieldMap()
@@ -53,12 +53,13 @@ type node struct {
ALL field.Asterisk
ID field.Int32 // 节点ID
ProxyID field.Int32 // 代理ID
Version field.Int32 // 节点版本
Name field.String // 节点名称
Host field.String // 节点地址
Isp field.Int32 // 运营商0-未知1-电信2-联通3-移动
Prov field.String // 省份
City field.String // 城市
ProxyID field.Int32 // 代理ID
ProxyPort field.Int32 // 代理端口
Status field.Int32 // 节点状态0-离线1-正常
Rtt field.Int32 // 延迟
@@ -66,7 +67,6 @@ type node struct {
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
Isp field.Int32 // 运营商0-其他1-电信2-联通3-移动
fieldMap map[string]field.Expr
}
@@ -84,12 +84,13 @@ func (n node) As(alias string) *node {
func (n *node) updateTableName(table string) *node {
n.ALL = field.NewAsterisk(table)
n.ID = field.NewInt32(table, "id")
n.ProxyID = field.NewInt32(table, "proxy_id")
n.Version = field.NewInt32(table, "version")
n.Name = field.NewString(table, "name")
n.Host = field.NewString(table, "host")
n.Isp = field.NewInt32(table, "isp")
n.Prov = field.NewString(table, "prov")
n.City = field.NewString(table, "city")
n.ProxyID = field.NewInt32(table, "proxy_id")
n.ProxyPort = field.NewInt32(table, "proxy_port")
n.Status = field.NewInt32(table, "status")
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.UpdatedAt = field.NewField(table, "updated_at")
n.DeletedAt = field.NewField(table, "deleted_at")
n.Isp = field.NewInt32(table, "isp")
n.fillFieldMap()
@@ -116,12 +116,13 @@ func (n *node) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
func (n *node) fillFieldMap() {
n.fieldMap = make(map[string]field.Expr, 15)
n.fieldMap["id"] = n.ID
n.fieldMap["proxy_id"] = n.ProxyID
n.fieldMap["version"] = n.Version
n.fieldMap["name"] = n.Name
n.fieldMap["host"] = n.Host
n.fieldMap["isp"] = n.Isp
n.fieldMap["prov"] = n.Prov
n.fieldMap["city"] = n.City
n.fieldMap["proxy_id"] = n.ProxyID
n.fieldMap["proxy_port"] = n.ProxyPort
n.fieldMap["status"] = n.Status
n.fieldMap["rtt"] = n.Rtt
@@ -129,7 +130,6 @@ func (n *node) fillFieldMap() {
n.fieldMap["created_at"] = n.CreatedAt
n.fieldMap["updated_at"] = n.UpdatedAt
n.fieldMap["deleted_at"] = n.DeletedAt
n.fieldMap["isp"] = n.Isp
}
func (n node) clone(db *gorm.DB) node {

View File

@@ -51,7 +51,7 @@ type product struct {
Name field.String // 产品名称
Description field.String // 产品描述
Sort field.Int32 // 排序
Status field.Int32 // 产品状态:1-正常,0-禁用
Status field.Int32 // 产品状态0-禁用1-正常
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间

View File

@@ -50,7 +50,7 @@ type proxy struct {
Version field.Int32 // 代理服务版本
Name field.String // 代理服务名称
Host field.String // 代理服务地址
Type field.Int32 // 代理服务类型:0-自有,1-三方
Type field.Int32 // 代理服务类型1-三方2-自有
Secret field.String // 代理服务密钥
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间

View File

@@ -28,14 +28,14 @@ func newRefund(db *gorm.DB, opts ...gen.DOOption) refund {
tableName := _refund.refundDo.TableName()
_refund.ALL = field.NewAsterisk(tableName)
_refund.ID = field.NewInt32(tableName, "id")
_refund.TradeID = field.NewInt32(tableName, "trade_id")
_refund.ProductID = field.NewInt32(tableName, "product_id")
_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.UpdatedAt = field.NewField(tableName, "updated_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()
@@ -47,14 +47,14 @@ type refund struct {
ALL field.Asterisk
ID field.Int32 // 退款ID
TradeID field.Int32 // 订单ID
ProductID field.Int32 // 产品ID
Amount field.Float64 // 退款金额
Reason field.String // 退款原因
Status field.Int32 // 退款状态0-待处理1-已退款2-已拒绝
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
TradeID field.Int32 // 订单ID
Reason field.String // 退款原因
Status field.Int32 // 退款状态0-待处理1-已退款2-已拒绝
fieldMap map[string]field.Expr
}
@@ -72,14 +72,14 @@ func (r refund) As(alias string) *refund {
func (r *refund) updateTableName(table string) *refund {
r.ALL = field.NewAsterisk(table)
r.ID = field.NewInt32(table, "id")
r.TradeID = field.NewInt32(table, "trade_id")
r.ProductID = field.NewInt32(table, "product_id")
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.UpdatedAt = field.NewField(table, "updated_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()
@@ -98,14 +98,14 @@ func (r *refund) GetFieldByName(fieldName string) (field.OrderExpr, bool) {
func (r *refund) fillFieldMap() {
r.fieldMap = make(map[string]field.Expr, 9)
r.fieldMap["id"] = r.ID
r.fieldMap["trade_id"] = r.TradeID
r.fieldMap["product_id"] = r.ProductID
r.fieldMap["amount"] = r.Amount
r.fieldMap["reason"] = r.Reason
r.fieldMap["status"] = r.Status
r.fieldMap["created_at"] = r.CreatedAt
r.fieldMap["updated_at"] = r.UpdatedAt
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 {

View File

@@ -29,12 +29,12 @@ func newResource(db *gorm.DB, opts ...gen.DOOption) resource {
_resource.ALL = field.NewAsterisk(tableName)
_resource.ID = field.NewInt32(tableName, "id")
_resource.UserID = field.NewInt32(tableName, "user_id")
_resource.ResourceNo = field.NewString(tableName, "resource_no")
_resource.Active = field.NewBool(tableName, "active")
_resource.Type = field.NewInt32(tableName, "type")
_resource.CreatedAt = field.NewField(tableName, "created_at")
_resource.UpdatedAt = field.NewField(tableName, "updated_at")
_resource.DeletedAt = field.NewField(tableName, "deleted_at")
_resource.ResourceNo = field.NewString(tableName, "resource_no")
_resource.Type = field.NewInt32(tableName, "type")
_resource.Pss = resourceHasOnePss{
db: db.Session(&gorm.Session{}),
@@ -52,12 +52,12 @@ type resource struct {
ALL field.Asterisk
ID field.Int32 // 套餐ID
UserID field.Int32 // 用户ID
ResourceNo field.String // 套餐编号
Active field.Bool // 套餐状态
Type field.Int32 // 套餐类型1-动态2-隧道3-独享
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
ResourceNo field.String // 套餐编号
Type field.Int32 // 套餐类型1-动态2-隧道3-独享
Pss resourceHasOnePss
fieldMap map[string]field.Expr
@@ -77,12 +77,12 @@ func (r *resource) updateTableName(table string) *resource {
r.ALL = field.NewAsterisk(table)
r.ID = field.NewInt32(table, "id")
r.UserID = field.NewInt32(table, "user_id")
r.ResourceNo = field.NewString(table, "resource_no")
r.Active = field.NewBool(table, "active")
r.Type = field.NewInt32(table, "type")
r.CreatedAt = field.NewField(table, "created_at")
r.UpdatedAt = field.NewField(table, "updated_at")
r.DeletedAt = field.NewField(table, "deleted_at")
r.ResourceNo = field.NewString(table, "resource_no")
r.Type = field.NewInt32(table, "type")
r.fillFieldMap()
@@ -102,12 +102,12 @@ func (r *resource) fillFieldMap() {
r.fieldMap = make(map[string]field.Expr, 9)
r.fieldMap["id"] = r.ID
r.fieldMap["user_id"] = r.UserID
r.fieldMap["resource_no"] = r.ResourceNo
r.fieldMap["active"] = r.Active
r.fieldMap["type"] = r.Type
r.fieldMap["created_at"] = r.CreatedAt
r.fieldMap["updated_at"] = r.UpdatedAt
r.fieldMap["deleted_at"] = r.DeletedAt
r.fieldMap["resource_no"] = r.ResourceNo
r.fieldMap["type"] = r.Type
}

View File

@@ -31,8 +31,8 @@ func newResourcePss(db *gorm.DB, opts ...gen.DOOption) resourcePss {
_resourcePss.ResourceID = field.NewInt32(tableName, "resource_id")
_resourcePss.Type = field.NewInt32(tableName, "type")
_resourcePss.Live = field.NewInt32(tableName, "live")
_resourcePss.Quota = field.NewInt32(tableName, "quota")
_resourcePss.Expire = field.NewField(tableName, "expire")
_resourcePss.Quota = field.NewInt32(tableName, "quota")
_resourcePss.Used = field.NewInt32(tableName, "used")
_resourcePss.DailyLimit = field.NewInt32(tableName, "daily_limit")
_resourcePss.DailyUsed = field.NewInt32(tableName, "daily_used")
@@ -51,8 +51,8 @@ type resourcePss struct {
ResourceID field.Int32 // 套餐ID
Type field.Int32 // 套餐类型1-包时2-包量
Live field.Int32 // 可用时长(秒)
Quota field.Int32 // 配额数量
Expire field.Field // 过期时间
Quota field.Int32 // 配额数量
Used field.Int32 // 已用数量
DailyLimit field.Int32 // 每日限制
DailyUsed field.Int32 // 今日已用数量
@@ -77,8 +77,8 @@ func (r *resourcePss) updateTableName(table string) *resourcePss {
r.ResourceID = field.NewInt32(table, "resource_id")
r.Type = field.NewInt32(table, "type")
r.Live = field.NewInt32(table, "live")
r.Quota = field.NewInt32(table, "quota")
r.Expire = field.NewField(table, "expire")
r.Quota = field.NewInt32(table, "quota")
r.Used = field.NewInt32(table, "used")
r.DailyLimit = field.NewInt32(table, "daily_limit")
r.DailyUsed = field.NewInt32(table, "daily_used")
@@ -104,8 +104,8 @@ func (r *resourcePss) fillFieldMap() {
r.fieldMap["resource_id"] = r.ResourceID
r.fieldMap["type"] = r.Type
r.fieldMap["live"] = r.Live
r.fieldMap["quota"] = r.Quota
r.fieldMap["expire"] = r.Expire
r.fieldMap["quota"] = r.Quota
r.fieldMap["used"] = r.Used
r.fieldMap["daily_limit"] = r.DailyLimit
r.fieldMap["daily_used"] = r.DailyUsed

View File

@@ -31,19 +31,19 @@ func newTrade(db *gorm.DB, opts ...gen.DOOption) trade {
_trade.UserID = field.NewInt32(tableName, "user_id")
_trade.InnerNo = field.NewString(tableName, "inner_no")
_trade.OuterNo = field.NewString(tableName, "outer_no")
_trade.Type = field.NewInt32(tableName, "type")
_trade.Subject = field.NewString(tableName, "subject")
_trade.Remark = field.NewString(tableName, "remark")
_trade.Amount = field.NewFloat64(tableName, "amount")
_trade.Payment = field.NewFloat64(tableName, "payment")
_trade.Method = field.NewInt32(tableName, "method")
_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.UpdatedAt = field.NewField(tableName, "updated_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()
@@ -58,19 +58,19 @@ type trade struct {
UserID field.Int32 // 用户ID
InnerNo field.String // 内部订单号
OuterNo field.String // 外部订单号
Type field.Int32 // 订单类型1-购买产品2-充值余额
Subject field.String // 订单主题
Remark field.String // 订单备注
Amount field.Float64 // 订单总金额
Payment field.Float64 // 支付金额
Method field.Int32 // 支付方式1-支付宝2-微信
Status field.Int32 // 订单状态0-待支付1-已支付2-已取消3-已退款
PayURL field.String // 支付链接
PaidAt field.Field // 支付时间
CancelAt field.Field // 取消时间
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
Type field.Int32 // 订单类型0-充值余额1-购买产品
CancelAt field.Field // 取消时间
PaidAt field.Field // 支付时间
PayURL field.String // 支付链接
fieldMap map[string]field.Expr
}
@@ -91,19 +91,19 @@ func (t *trade) updateTableName(table string) *trade {
t.UserID = field.NewInt32(table, "user_id")
t.InnerNo = field.NewString(table, "inner_no")
t.OuterNo = field.NewString(table, "outer_no")
t.Type = field.NewInt32(table, "type")
t.Subject = field.NewString(table, "subject")
t.Remark = field.NewString(table, "remark")
t.Amount = field.NewFloat64(table, "amount")
t.Payment = field.NewFloat64(table, "payment")
t.Method = field.NewInt32(table, "method")
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.UpdatedAt = field.NewField(table, "updated_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()
@@ -125,19 +125,19 @@ func (t *trade) fillFieldMap() {
t.fieldMap["user_id"] = t.UserID
t.fieldMap["inner_no"] = t.InnerNo
t.fieldMap["outer_no"] = t.OuterNo
t.fieldMap["type"] = t.Type
t.fieldMap["subject"] = t.Subject
t.fieldMap["remark"] = t.Remark
t.fieldMap["amount"] = t.Amount
t.fieldMap["payment"] = t.Payment
t.fieldMap["method"] = t.Method
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["updated_at"] = t.UpdatedAt
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 {

View File

@@ -66,7 +66,7 @@ type user struct {
Password field.String // 用户密码
Name field.String // 真实姓名
Avatar field.String // 头像URL
Status field.Int32 // 用户状态:1-正常,0-禁用
Status field.Int32 // 用户状态0-禁用1-正常
Balance field.Float64 // 账户余额
IDType field.Int32 // 认证类型0-未认证1-个人认证2-企业认证
IDNo field.String // 身份证号或营业执照号

View File

@@ -30,10 +30,10 @@ func newWhitelist(db *gorm.DB, opts ...gen.DOOption) whitelist {
_whitelist.ID = field.NewInt32(tableName, "id")
_whitelist.UserID = field.NewInt32(tableName, "user_id")
_whitelist.Host = field.NewString(tableName, "host")
_whitelist.Remark = field.NewString(tableName, "remark")
_whitelist.CreatedAt = field.NewField(tableName, "created_at")
_whitelist.UpdatedAt = field.NewField(tableName, "updated_at")
_whitelist.DeletedAt = field.NewField(tableName, "deleted_at")
_whitelist.Remark = field.NewString(tableName, "remark")
_whitelist.fillFieldMap()
@@ -47,10 +47,10 @@ type whitelist struct {
ID field.Int32 // 白名单ID
UserID field.Int32 // 用户ID
Host field.String // IP地址
Remark field.String // 备注
CreatedAt field.Field // 创建时间
UpdatedAt field.Field // 更新时间
DeletedAt field.Field // 删除时间
Remark field.String // 备注
fieldMap map[string]field.Expr
}
@@ -70,10 +70,10 @@ func (w *whitelist) updateTableName(table string) *whitelist {
w.ID = field.NewInt32(table, "id")
w.UserID = field.NewInt32(table, "user_id")
w.Host = field.NewString(table, "host")
w.Remark = field.NewString(table, "remark")
w.CreatedAt = field.NewField(table, "created_at")
w.UpdatedAt = field.NewField(table, "updated_at")
w.DeletedAt = field.NewField(table, "deleted_at")
w.Remark = field.NewString(table, "remark")
w.fillFieldMap()
@@ -94,10 +94,10 @@ func (w *whitelist) fillFieldMap() {
w.fieldMap["id"] = w.ID
w.fieldMap["user_id"] = w.UserID
w.fieldMap["host"] = w.Host
w.fieldMap["remark"] = w.Remark
w.fieldMap["created_at"] = w.CreatedAt
w.fieldMap["updated_at"] = w.UpdatedAt
w.fieldMap["deleted_at"] = w.DeletedAt
w.fieldMap["remark"] = w.Remark
}
func (w whitelist) clone(db *gorm.DB) whitelist {