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); }