fix store bug

This commit is contained in:
Sakurasan
2025-04-17 20:15:41 +08:00
parent 87778326ea
commit 5403ed0cba
2 changed files with 5 additions and 5 deletions

View File

@@ -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

View File

@@ -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)