Commit 543bc3d25fc01b1ffbef8e8f7f16b8abe3260649
1 parent
df6bba2a
点播时长换算单位
Showing
1 changed file
with
4 additions
and
3 deletions
src/main/java/com/cnlive/shenhe/api/VideosControllerApi.java
| @@ -72,6 +72,8 @@ public class VideosControllerApi { | @@ -72,6 +72,8 @@ public class VideosControllerApi { | ||
| 72 | //g得到视频id去查询是否已有 | 72 | //g得到视频id去查询是否已有 |
| 73 | String videoId = json.getString("videoId"); | 73 | String videoId = json.getString("videoId"); |
| 74 | shyVideos1.setVideo_id(videoId); | 74 | shyVideos1.setVideo_id(videoId); |
| 75 | + Integer duration = json.getInteger("duration"); | ||
| 76 | + if (CommonUtils.isNotNull(duration)) duration = duration / 1000; | ||
| 75 | //查询一下 存在,更新 没有,插入 | 77 | //查询一下 存在,更新 没有,插入 |
| 76 | List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1); | 78 | List<ShyVideos> listshyVideos = videosService.findshyVideo(shyVideos1); |
| 77 | if (listshyVideos.size() > 0) { | 79 | if (listshyVideos.size() > 0) { |
| @@ -96,7 +98,7 @@ public class VideosControllerApi { | @@ -96,7 +98,7 @@ public class VideosControllerApi { | ||
| 96 | shyVideos.setState(CommonConst.AUDIT_INTT); | 98 | shyVideos.setState(CommonConst.AUDIT_INTT); |
| 97 | shyVideos.setBucket(json.getString("bucketName")); | 99 | shyVideos.setBucket(json.getString("bucketName")); |
| 98 | shyVideos.setPlat(json.getInteger("bucketType")); | 100 | shyVideos.setPlat(json.getInteger("bucketType")); |
| 99 | - shyVideos.setDuration(json.getInteger("duration")); | 101 | + shyVideos.setDuration(duration); |
| 100 | boolean YorN = videosService.updateshyVideos(shyVideos); | 102 | boolean YorN = videosService.updateshyVideos(shyVideos); |
| 101 | if (YorN == true) { | 103 | if (YorN == true) { |
| 102 | return new ResponseBean(ErrorEnum.SUCCESS); | 104 | return new ResponseBean(ErrorEnum.SUCCESS); |
| @@ -111,7 +113,7 @@ public class VideosControllerApi { | @@ -111,7 +113,7 @@ public class VideosControllerApi { | ||
| 111 | shyVideos1.setVideo_imgs(videoCoverUrl); | 113 | shyVideos1.setVideo_imgs(videoCoverUrl); |
| 112 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { | 114 | if (CommonUtils.isNotEmpty(videoCoverUrl)) { |
| 113 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); | 115 | String poster = json.getJSONObject("videoCoverUrl").getString("224*126"); |
| 114 | - if(CommonUtils.isEmpty(poster)){ | 116 | + if (CommonUtils.isEmpty(poster)) { |
| 115 | //ugc短视频只有一张图片 | 117 | //ugc短视频只有一张图片 |
| 116 | poster = json.getJSONObject("videoCoverUrl").getString("key"); | 118 | poster = json.getJSONObject("videoCoverUrl").getString("key"); |
| 117 | } | 119 | } |
| @@ -127,7 +129,6 @@ public class VideosControllerApi { | @@ -127,7 +129,6 @@ public class VideosControllerApi { | ||
| 127 | shyVideos1.setState(CommonConst.AUDIT_INTT); | 129 | shyVideos1.setState(CommonConst.AUDIT_INTT); |
| 128 | shyVideos1.setBucket(json.getString("bucketName")); | 130 | shyVideos1.setBucket(json.getString("bucketName")); |
| 129 | shyVideos1.setPlat(json.getInteger("bucketType")); | 131 | shyVideos1.setPlat(json.getInteger("bucketType")); |
| 130 | - Integer duration = json.getInteger("duration"); | ||
| 131 | shyVideos1.setDuration(duration); | 132 | shyVideos1.setDuration(duration); |
| 132 | if (CommonUtils.isNotNull(duration) && duration > 80) { | 133 | if (CommonUtils.isNotNull(duration) && duration > 80) { |
| 133 | shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧 | 134 | shyVideos1 = avsample(shyVideos1);//视频至少可以抽8张,请求抽帧 |