|
@@ -71,7 +71,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
|
|
|
public void uploadVideoToBytedance(String accountId, String videoUrl, String userId, String materialName) {
|
|
|
try {
|
|
|
CtopOauthToken token = ctopOauthTokenService.getOauthTokenByAccountId(accountId);
|
|
|
- JSONObject jsonObject = videoUpload(token, videoUrl);
|
|
|
+ JSONObject jsonObject = videoUpload(token, videoUrl,materialName);
|
|
|
if (!Check.isNull(jsonObject)) {
|
|
|
Integer code = jsonObject.getInteger("code");
|
|
|
if (code == 0) {
|
|
@@ -256,7 +256,7 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
|
|
|
}
|
|
|
|
|
|
|
|
|
- private JSONObject videoUpload(CtopOauthToken token, String videoPath) {
|
|
|
+ private JSONObject videoUpload(CtopOauthToken token, String videoPath,String materialName) {
|
|
|
CloseableHttpResponse response = null;
|
|
|
CloseableHttpClient client = null;
|
|
|
// 请求地址
|
|
@@ -267,12 +267,13 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
|
|
|
// 文件参数
|
|
|
try {
|
|
|
FileBody file = new FileBody(new File(videoPath));
|
|
|
+
|
|
|
MultipartEntityBuilder entityBuilder = MultipartEntityBuilder.create()
|
|
|
.addPart("video_file", file);
|
|
|
// 其他参数
|
|
|
entityBuilder.addTextBody("advertiser_id", String.valueOf(token.getAccountId()));
|
|
|
entityBuilder.addTextBody("video_signature", DigestUtils.md5Hex(new FileInputStream(new File(videoPath))));
|
|
|
- entityBuilder.addTextBody("filename",file.getFilename(), ContentType.create("text/plain", Charset.forName("UTF-8")));
|
|
|
+ entityBuilder.addTextBody("filename",materialName, ContentType.create("text/plain", Charset.forName("UTF-8")));
|
|
|
HttpEntity entity = entityBuilder.build();
|
|
|
client = HttpClientBuilder.create().build();
|
|
|
httpPost.setURI(URI.create(url));
|