fix:解决视频生成问题

This commit is contained in:
yys 2026-04-03 14:17:19 +08:00
parent 78b32dd252
commit b17aec4a1a
2 changed files with 7 additions and 5 deletions

View File

@ -70,9 +70,9 @@ public class ByteDeptApiKeyServiceImpl implements IByteDeptApiKeyService {
throw new ServiceException(NO_API_KEY_MSG); throw new ServiceException(NO_API_KEY_MSG);
} }
// 缓存中保存加密值 // 缓存中保存加密值
redisCache.setCacheObject(cacheKey, apiKey, CACHE_HOURS, TimeUnit.HOURS); String encodeApiKey = encryptionService.encode(apiKey);
// 返回处解密 redisCache.setCacheObject(cacheKey, encodeApiKey, CACHE_HOURS, TimeUnit.HOURS);
return encryptionService.decode(apiKey); return apiKey;
} }
private static String trimKey(String raw) { private static String trimKey(String raw) {

View File

@ -11,12 +11,14 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.OkHttpUtils; import com.ruoyi.common.utils.http.OkHttpUtils;
import lombok.extern.slf4j.Slf4j;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.*; import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Slf4j
@Service @Service
public class ByteService implements IByteService { public class ByteService implements IByteService {
@ -107,9 +109,8 @@ public class ByteService implements IByteService {
jsonBody jsonBody
)) ))
.build(); .build();
log.info("调用火山接口, request = {}", jsonBody);
Response response = OkHttpUtils.newCall(request).execute(); Response response = OkHttpUtils.newCall(request).execute();
if (!response.isSuccessful()) { if (!response.isSuccessful()) {
String errorMsg = response.body() != null ? response.body().string() : "imgToVideo error"; String errorMsg = response.body() != null ? response.body().string() : "imgToVideo error";
throw new Exception("imgToVideo error" + errorMsg); throw new Exception("imgToVideo error" + errorMsg);
@ -120,6 +121,7 @@ public class ByteService implements IByteService {
} }
String responseBody = response.body().string(); String responseBody = response.body().string();
log.info("调用火山接口, response = {}", responseBody);
return objectMapper.readValue(responseBody, ByteBodyRes.class); return objectMapper.readValue(responseBody, ByteBodyRes.class);
} }