实现云端控制的动态节点分配逻辑

This commit is contained in:
2025-03-28 10:03:29 +08:00
parent e337a9c08e
commit e61f0bef32
16 changed files with 1313 additions and 138 deletions

View File

@@ -28,6 +28,7 @@ var (
Node *node
Permission *permission
Product *product
Proxy *proxy
Refund *refund
Resource *resource
ResourcePps *resourcePps
@@ -54,6 +55,7 @@ func SetDefault(db *gorm.DB, opts ...gen.DOOption) {
Node = &Q.Node
Permission = &Q.Permission
Product = &Q.Product
Proxy = &Q.Proxy
Refund = &Q.Refund
Resource = &Q.Resource
ResourcePps = &Q.ResourcePps
@@ -81,6 +83,7 @@ func Use(db *gorm.DB, opts ...gen.DOOption) *Query {
Node: newNode(db, opts...),
Permission: newPermission(db, opts...),
Product: newProduct(db, opts...),
Proxy: newProxy(db, opts...),
Refund: newRefund(db, opts...),
Resource: newResource(db, opts...),
ResourcePps: newResourcePps(db, opts...),
@@ -109,6 +112,7 @@ type Query struct {
Node node
Permission permission
Product product
Proxy proxy
Refund refund
Resource resource
ResourcePps resourcePps
@@ -138,6 +142,7 @@ func (q *Query) clone(db *gorm.DB) *Query {
Node: q.Node.clone(db),
Permission: q.Permission.clone(db),
Product: q.Product.clone(db),
Proxy: q.Proxy.clone(db),
Refund: q.Refund.clone(db),
Resource: q.Resource.clone(db),
ResourcePps: q.ResourcePps.clone(db),
@@ -174,6 +179,7 @@ func (q *Query) ReplaceDB(db *gorm.DB) *Query {
Node: q.Node.replaceDB(db),
Permission: q.Permission.replaceDB(db),
Product: q.Product.replaceDB(db),
Proxy: q.Proxy.replaceDB(db),
Refund: q.Refund.replaceDB(db),
Resource: q.Resource.replaceDB(db),
ResourcePps: q.ResourcePps.replaceDB(db),
@@ -200,6 +206,7 @@ type queryCtx struct {
Node *nodeDo
Permission *permissionDo
Product *productDo
Proxy *proxyDo
Refund *refundDo
Resource *resourceDo
ResourcePps *resourcePpsDo
@@ -226,6 +233,7 @@ func (q *Query) WithContext(ctx context.Context) *queryCtx {
Node: q.Node.WithContext(ctx),
Permission: q.Permission.WithContext(ctx),
Product: q.Product.WithContext(ctx),
Proxy: q.Proxy.WithContext(ctx),
Refund: q.Refund.WithContext(ctx),
Resource: q.Resource.WithContext(ctx),
ResourcePps: q.ResourcePps.WithContext(ctx),