diff --git a/internal/dao/apikey.go b/internal/dao/apikey.go index 837dc76..7bb3108 100644 --- a/internal/dao/apikey.go +++ b/internal/dao/apikey.go @@ -87,7 +87,13 @@ func (dao *ApiKeyDAO) FindApiKeysBySupportModel(db *gorm.DB, modelName string) ( var apiKeys []model.ApiKey switch dao.cfg.DB_Type { case "mysql": - return nil, errors.New("not support") + err := db.Raw(` + SELECT * + FROM apikeys + WHERE active = true + AND JSON_CONTAINS(support_models, ?, '$')`, modelName). + Scan(&apiKeys).Error + return apiKeys, err case "postgres": return nil, errors.New("not support") }