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);
}
// 缓存中保存加密值
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) {

View File

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