feat: add toolbox query, upload module, update config and gitignore
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"qnc-server/app/main/api/internal/config"
|
||||
"qnc-server/app/main/api/internal/middleware"
|
||||
"qnc-server/app/main/api/internal/service"
|
||||
tianxingjuhe "qnc-server/app/main/api/internal/service/tianxingjuhe_sdk"
|
||||
tianyuanapi "qnc-server/app/main/api/internal/service/tianyuanapi_sdk"
|
||||
"qnc-server/app/main/model"
|
||||
"time"
|
||||
@@ -99,6 +100,7 @@ type ServiceContext struct {
|
||||
DictService *service.DictService
|
||||
ImageService *service.ImageService
|
||||
AuthorizationService *service.AuthorizationService
|
||||
ToolboxService *service.ToolboxService
|
||||
}
|
||||
|
||||
// NewServiceContext 创建服务上下文
|
||||
@@ -201,6 +203,23 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
dictService := service.NewDictService(adminDictTypeModel, adminDictDataModel)
|
||||
imageService := service.NewImageService()
|
||||
|
||||
tianxingjuheTimeout := c.Tianxingjuhe.Timeout
|
||||
if tianxingjuheTimeout <= 0 {
|
||||
tianxingjuheTimeout = 30
|
||||
}
|
||||
tianxingjuheClient, tjErr := tianxingjuhe.NewClient(tianxingjuhe.Config{
|
||||
BaseURL: c.Tianxingjuhe.URL,
|
||||
Key: c.Tianxingjuhe.Key,
|
||||
Timeout: tianxingjuheTimeout,
|
||||
})
|
||||
if tjErr != nil {
|
||||
logx.Errorf("初始化天行聚合API失败: %+v", tjErr)
|
||||
}
|
||||
var toolboxService *service.ToolboxService
|
||||
if tianxingjuheClient != nil {
|
||||
toolboxService = service.NewToolboxService(tianxingjuheClient)
|
||||
}
|
||||
|
||||
// ============================== 异步任务服务 ==============================
|
||||
asynqServer := asynq.NewServer(
|
||||
asynq.RedisClientOpt{Addr: c.CacheRedis[0].Host, Password: c.CacheRedis[0].Pass},
|
||||
@@ -296,6 +315,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
|
||||
DictService: dictService,
|
||||
ImageService: imageService,
|
||||
AuthorizationService: authorizationService,
|
||||
ToolboxService: toolboxService,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user