From b17aec4a1a5c08acb78433b1fd391e42c2733bb7 Mon Sep 17 00:00:00 2001 From: yys <47@gamerwa.com> Date: Fri, 3 Apr 2026 14:17:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E8=A7=A3=E5=86=B3=E8=A7=86?= =?UTF-8?q?=E9=A2=91=E7=94=9F=E6=88=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/ai/service/impl/ByteDeptApiKeyServiceImpl.java | 6 +++--- .../main/java/com/ruoyi/ai/service/impl/ByteService.java | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteDeptApiKeyServiceImpl.java b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteDeptApiKeyServiceImpl.java index fd7a7b3..440c417 100644 --- a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteDeptApiKeyServiceImpl.java +++ b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteDeptApiKeyServiceImpl.java @@ -70,9 +70,9 @@ public class ByteDeptApiKeyServiceImpl implements IByteDeptApiKeyService { throw new ServiceException(NO_API_KEY_MSG); } // 缓存中保存加密值 - redisCache.setCacheObject(cacheKey, apiKey, CACHE_HOURS, TimeUnit.HOURS); - // 返回处解密 - return encryptionService.decode(apiKey); + String encodeApiKey = encryptionService.encode(apiKey); + redisCache.setCacheObject(cacheKey, encodeApiKey, CACHE_HOURS, TimeUnit.HOURS); + return apiKey; } private static String trimKey(String raw) { diff --git a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteService.java b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteService.java index 4c7ff4e..e1ffd17 100644 --- a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteService.java +++ b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/service/impl/ByteService.java @@ -11,12 +11,14 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.http.OkHttpUtils; +import lombok.extern.slf4j.Slf4j; import okhttp3.HttpUrl; import okhttp3.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +@Slf4j @Service public class ByteService implements IByteService { @@ -107,9 +109,8 @@ public class ByteService implements IByteService { jsonBody )) .build(); - + log.info("调用火山接口, request = {}", jsonBody); Response response = OkHttpUtils.newCall(request).execute(); - if (!response.isSuccessful()) { String errorMsg = response.body() != null ? response.body().string() : "imgToVideo error"; throw new Exception("imgToVideo error:" + errorMsg); @@ -120,6 +121,7 @@ public class ByteService implements IByteService { } String responseBody = response.body().string(); + log.info("调用火山接口, response = {}", responseBody); return objectMapper.readValue(responseBody, ByteBodyRes.class); }