feat(api): enhance server status handling with protocol support and refactor related logic

This commit is contained in:
Chang lue Tsen
2025-09-01 04:17:33 -04:00
parent 6dc1bee14c
commit 3012a68339
18 changed files with 261 additions and 1428 deletions
+11 -13
View File
@@ -7,10 +7,8 @@ import (
"github.com/perfect-panel/server/internal/model/node"
"github.com/perfect-panel/server/pkg/device"
"github.com/perfect-panel/server/internal/model/ads"
"github.com/perfect-panel/server/internal/model/cache"
"github.com/perfect-panel/server/internal/config"
"github.com/perfect-panel/server/internal/model/ads"
"github.com/perfect-panel/server/internal/model/announcement"
"github.com/perfect-panel/server/internal/model/auth"
"github.com/perfect-panel/server/internal/model/coupon"
@@ -35,11 +33,11 @@ import (
)
type ServiceContext struct {
DB *gorm.DB
Redis *redis.Client
Config config.Config
Queue *asynq.Client
NodeCache *cache.NodeCacheClient
DB *gorm.DB
Redis *redis.Client
Config config.Config
Queue *asynq.Client
//NodeCache *cache.NodeCacheClient
AuthModel auth.Model
AdsModel ads.Model
LogModel log.Model
@@ -86,11 +84,11 @@ func NewServiceContext(c config.Config) *ServiceContext {
}
authLimiter := limit.NewPeriodLimit(86400, 15, rds, config.SendCountLimitKeyPrefix, limit.Align())
srv := &ServiceContext{
DB: db,
Redis: rds,
Config: c,
Queue: NewAsynqClient(c),
NodeCache: cache.NewNodeCacheClient(rds),
DB: db,
Redis: rds,
Config: c,
Queue: NewAsynqClient(c),
//NodeCache: cache.NewNodeCacheClient(rds),
AuthLimiter: authLimiter,
AdsModel: ads.NewModel(db, rds),
LogModel: log.NewModel(db),