|
@@ -96,23 +96,55 @@ public class VideoApiService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- public void updateVideo(Long uid, Long videoId, String coverUrl, String title) {
|
|
|
+ public String updateVideo(Long uid, Long videoId, String coverUrl, String title) {
|
|
|
String url = videoApiHost + "/longvideoapi/openapi/video/update";
|
|
|
+ String result = null;
|
|
|
try {
|
|
|
+ JSONObject videoDetail = getVideoInfo(videoId);
|
|
|
+ JSONObject chargeDetail = videoDetail.getJSONObject("chargeDetail");
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("loginUid", uid);
|
|
|
+ param.put("id", videoId);
|
|
|
param.put("videoId", videoId);
|
|
|
+ param.put("appType", 8);
|
|
|
param.put("coverImgPath", coverUrl);
|
|
|
param.put("title", title);
|
|
|
+ param.put("viewStatus", 1);
|
|
|
+ param.put("videoCollectionId", videoDetail.getLong("videoCollectionId"));
|
|
|
+ param.put("barrageSwitch", videoDetail.getLong("barrageSwitch"));
|
|
|
+ param.put("charge", chargeDetail.getInteger("charge"));
|
|
|
+ param.put("price", chargeDetail.getLong("price"));
|
|
|
+ param.put("allowIosPlay", chargeDetail.getLong("allowIosPlay"));
|
|
|
+ param.put("allowDownload", 0);
|
|
|
String post = httpPoolClient.post(url, param.toJSONString());
|
|
|
JSONObject res = JSONObject.parseObject(post);
|
|
|
if (res.getInteger("code") != 0) {
|
|
|
log.error("updateVideo error, uid:{} videoId={} coverUrl={} title={} res={}", uid, videoId, coverUrl, title, res);
|
|
|
+ result = res.getString("msg");
|
|
|
throw new CommonException(ExceptionEnum.VIDEO_PUBLISH_FAILED.getCode(), res.getString("msg"));
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
log.error("updateVideo error", e);
|
|
|
}
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public JSONObject getVideoInfo(Long videoId) {
|
|
|
+ String url = videoApiHost + "/longvideoapi/openapi/video/getVideoInfo";
|
|
|
+ try {
|
|
|
+ JSONObject param = new JSONObject();
|
|
|
+ param.put("videoId", videoId);
|
|
|
+ String post = httpPoolClient.post(url, param.toJSONString());
|
|
|
+ JSONObject res = JSONObject.parseObject(post);
|
|
|
+ if (res.getInteger("code") != 0) {
|
|
|
+ log.error("getVideoInfo error, videoId={} res={}", videoId, res);
|
|
|
+ throw new CommonException(ExceptionEnum.VIDEO_PUBLISH_FAILED.getCode(), res.getString("msg"));
|
|
|
+ }
|
|
|
+ return res.getJSONObject("data");
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("getVideoInfo error", e);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
public void deleteVideo(Long uid, Long videoId) {
|