diff --git a/internal/dao/apikey.go b/internal/dao/apikey.go index a113326..5c67880 100644 --- a/internal/dao/apikey.go +++ b/internal/dao/apikey.go @@ -29,8 +29,8 @@ type ApiKeyDAO struct { db *gorm.DB } -func NewApiKeyDAO(db *gorm.DB) *ApiKeyDAO { - return &ApiKeyDAO{db: db} +func NewApiKeyDAO(cfg *config.Config, db *gorm.DB) *ApiKeyDAO { + return &ApiKeyDAO{cfg: cfg, db: db} } // CreateApiKey 创建ApiKey diff --git a/wire/wire_gen.go b/wire/wire_gen.go index 2652e82..1467fa1 100644 --- a/wire/wire_gen.go +++ b/wire/wire_gen.go @@ -27,7 +27,7 @@ func InitTeamHandler(ctx context.Context, cfg *config.Config, db *gorm.DB) (*con userService := service.NewUserService(db, userDAO) tokenDAO := dao.NewTokenDAO(db) tokenService := service.NewTokenService(tokenDAO) - apiKeyDAO := dao.NewApiKeyDAO(db) + apiKeyDAO := dao.NewApiKeyDAO(cfg, db) apiKeyService := service.NewApiKeyService(db, apiKeyDAO) usageDAO := dao.NewUsageDAO(cfg, db) dailyUsageDAO := dao.NewDailyUsageDAO(cfg, db) @@ -41,7 +41,7 @@ func InitAPIHandler(ctx context.Context, cfg *config.Config, db *gorm.DB) (*cont userServiceImpl := service2.NewUserService(cfg, db, userDAO) tokenDAO := dao.NewTokenDAO(db) tokenServiceImpl := service2.NewTokenService(db, tokenDAO) - apiKeyDAO := dao.NewApiKeyDAO(db) + apiKeyDAO := dao.NewApiKeyDAO(cfg, db) apiKeyServiceImpl := service2.NewApiKeyService(db, apiKeyDAO) webAuthnService, err := service2.NewWebAuthnService(cfg, db) if err != nil { @@ -54,7 +54,7 @@ func InitAPIHandler(ctx context.Context, cfg *config.Config, db *gorm.DB) (*cont func InitProxyHandler(ctx context.Context, cfg *config.Config, db *gorm.DB, wg *sync.WaitGroup) (*controller3.Proxy, error) { userDAO := dao.NewUserDAO(db) - apiKeyDAO := dao.NewApiKeyDAO(db) + apiKeyDAO := dao.NewApiKeyDAO(cfg, db) tokenDAO := dao.NewTokenDAO(db) usageDAO := dao.NewUsageDAO(cfg, db) dailyUsageDAO := dao.NewDailyUsageDAO(cfg, db)