This commit is contained in:
2026-06-19 14:36:54 +08:00
parent bdb851b701
commit 114ad82746
21 changed files with 1316 additions and 22 deletions

View File

@@ -45,6 +45,7 @@ type ServiceContext struct {
QueryCleanupDetailModel model.QueryCleanupDetailModel
QueryCleanupConfigModel model.QueryCleanupConfigModel
QueryUserRecordModel model.QueryUserRecordModel
QueryWhitelistOpLogModel model.QueryWhitelistOpLogModel
// 代理相关模型
AgentModel model.AgentModel
@@ -104,6 +105,7 @@ type ServiceContext struct {
AuthorizationService *service.AuthorizationService
ToolboxService *service.ToolboxService
TianxingjuheService *tianxingjuhe.Client
TianyuanapiClient *tianyuanapi.Client
}
// NewServiceContext 创建服务上下文
@@ -138,6 +140,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
queryCleanupDetailModel := model.NewQueryCleanupDetailModel(db, cacheConf)
queryCleanupConfigModel := model.NewQueryCleanupConfigModel(db, cacheConf)
queryUserRecordModel := model.NewQueryUserRecordModel(db, cacheConf)
queryWhitelistOpLogModel := model.NewQueryWhitelistOpLogModel(db, cacheConf)
// ============================== 代理相关模型 ==============================
agentModel := model.NewAgentModel(db, cacheConf)
@@ -189,6 +192,8 @@ func NewServiceContext(c config.Config) *ServiceContext {
})
if err != nil {
logx.Errorf("初始化天远API失败: %+v", err)
} else if c.Tianyuanapi.WhitelistMgmtKey != "" {
tianyuanapi.SetWhitelistMgmtKey(c.Tianyuanapi.WhitelistMgmtKey)
}
// 初始化天行聚合API客户端
@@ -262,6 +267,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
QueryCleanupDetailModel: queryCleanupDetailModel,
QueryCleanupConfigModel: queryCleanupConfigModel,
QueryUserRecordModel: queryUserRecordModel,
QueryWhitelistOpLogModel: queryWhitelistOpLogModel,
// 代理相关模型
AgentModel: agentModel,
@@ -321,6 +327,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
AuthorizationService: authorizationService,
ToolboxService: toolboxService,
TianxingjuheService: tianxingjuheService,
TianyuanapiClient: tianyuanapi,
}
}