|
@@ -61,11 +61,11 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
|
|
|
try {
|
|
|
CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
uploadAdvideo(token, videoUrl, token.getAccountId() + "");
|
|
|
- String localUrl = LoadFileUtil.downLoadFromUrl(videoUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
|
|
|
- JSONObject jsonObject = videoUpload(token, localUrl);
|
|
|
+ // String localUrl = LoadFileUtil.downLoadFromUrl(videoUrl, PropertiesUtils.getValue("kuaishou_config", "video_sava_path"));
|
|
|
+ JSONObject jsonObject = videoUpload(token, videoUrl);
|
|
|
log.info("头条上传素材返回信息:{},accountId:{}", jsonObject, accountId);
|
|
|
} catch (Exception e) {
|
|
|
- log.info("头条上传文件失败");
|
|
|
+ log.info("头条上传视频文件失败,accountId:{}", accountId);
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
|
|
@@ -100,23 +100,19 @@ public class FileInfoServiceImpl extends ServiceImpl<FileInfoMapper, FileInfo> i
|
|
|
return resultMap;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> uploadImageToBytedance(String accountId, String imageUrl) {
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
- JSONObject resultObject = uploadAdImage(token, imageUrl, token.getAccountId() + "");
|
|
|
- Integer code = resultObject.getInteger("code");
|
|
|
- String message = resultObject.getString("message");
|
|
|
- if (null == code || code != 0) {
|
|
|
- log.info("图片文件上传失败,accountId:{},message:{}", accountId, message);
|
|
|
- ResultMapUtils.setResultMap(resultMap, StatusCode.BYTEDANCE_IMAGE_UPLOAD_FAIL.getCode());
|
|
|
- return resultMap;
|
|
|
+ try {
|
|
|
+ CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
|
|
|
+ JSONObject jsonObject = imageUpload(token, String.valueOf(token.getAccountId()), imageUrl);
|
|
|
+ log.info("头条上传图片素材返回信息:{},accountId:{}", jsonObject, accountId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("头条上传图片文件失败,accountId:{}", accountId);
|
|
|
+ e.printStackTrace();
|
|
|
}
|
|
|
- FileInfo fileInfo = (FileInfo) resultObject.get("file");
|
|
|
- ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
|
|
|
- JSONArray array = new JSONArray();
|
|
|
- array.add(fileInfo.getFileId());
|
|
|
- resultMap.put("imageIds", array);
|
|
|
+
|
|
|
return resultMap;
|
|
|
}
|
|
|
|