添加访问日志表及相关字段,更新模型字段注释
This commit is contained in:
@@ -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 // 最后登录代理
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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-http,2-https,3-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-http,2-https,3-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 {
|
||||
|
||||
@@ -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-web,1-native,2-browser
|
||||
GrantPassword field.Bool // 允许密码授予
|
||||
Spec field.Int32 // 安全规范:1-native,2-browser,3-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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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),
|
||||
|
||||
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()
|
||||
_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 {
|
||||
|
||||
@@ -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 // 删除时间
|
||||
|
||||
@@ -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 // 更新时间
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 // 身份证号或营业执照号
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user