This commit is contained in:
Sakurasan
2025-04-20 19:21:51 +08:00
parent b80f0759a5
commit d426781e47

View File

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