vod普通加密
This commit is contained in:
@@ -28,7 +28,7 @@ import java.util.Map;
|
||||
public class SpdbUtil {
|
||||
|
||||
@Autowired
|
||||
private static VideoM3u8Dao videoM3u8Dao;
|
||||
private VideoM3u8Dao videoM3u8Dao;
|
||||
|
||||
private static Client client;
|
||||
static {
|
||||
@@ -161,8 +161,12 @@ public class SpdbUtil {
|
||||
}
|
||||
|
||||
|
||||
public static void vodTranslationM3u8(String vid) throws Exception {
|
||||
List<VideoM3u8Entity> videoM3u8Entities = videoM3u8Dao.selectList(new LambdaQueryWrapper<VideoM3u8Entity>().eq(VideoM3u8Entity::getVid, vid));
|
||||
public void vodTranslationM3u8(String vid) throws Exception {
|
||||
LambdaQueryWrapper<VideoM3u8Entity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(VideoM3u8Entity::getVid,vid);
|
||||
|
||||
|
||||
List<VideoM3u8Entity> videoM3u8Entities = videoM3u8Dao.selectList(wrapper);
|
||||
if(videoM3u8Entities.size()>0){
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ public class CourseController {
|
||||
private ShopProductService shopProductService;
|
||||
@Autowired
|
||||
private VideoM3u8Dao videoM3u8Dao;
|
||||
@Autowired
|
||||
private SpdbUtil spdbUtil;
|
||||
|
||||
|
||||
@RequestMapping("/getCourseList")
|
||||
@@ -78,6 +80,21 @@ public class CourseController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/cossVod")
|
||||
public R cossVod(@RequestBody Map<String,Integer> map) throws Exception {
|
||||
int p = map.get("page");
|
||||
int l = map.get("limit");
|
||||
LambdaQueryWrapper<CourseCatalogueChapterVideoEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseCatalogueChapterVideoEntity::getType,1);
|
||||
Page<CourseCatalogueChapterVideoEntity> courseCatalogueChapterVideoEntityPage = courseCatalogueChapterVideoService.getBaseMapper().selectPage(new Page<>(p, l), wrapper);
|
||||
for (CourseCatalogueChapterVideoEntity c :courseCatalogueChapterVideoEntityPage.getRecords()){
|
||||
spdbUtil.vodTranslationM3u8(c.getVideo());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping("/getCoursedetail")
|
||||
public R getCoursedetail(@RequestBody ParamTo param){
|
||||
CourseEntity course = courseService.getById(param.getId());
|
||||
|
||||
@@ -47,6 +47,8 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
|
||||
private MyUserDao userDao;
|
||||
@Autowired
|
||||
private PlayToken playToken;
|
||||
@Autowired
|
||||
private VideoM3u8Dao videoM3u8Dao;
|
||||
|
||||
@Override
|
||||
public Page getCourseCatalogueChapterVideoList(ParamTo param) {
|
||||
@@ -109,11 +111,14 @@ public class CourseCatalogueChapterVideoServiceImpl extends ServiceImpl<CourseCa
|
||||
GetVideoPlayAuthResponse p = SpdbUtil.getPlayAuth(video.getVideo());
|
||||
String playAuth = p.getBody().getPlayAuth();
|
||||
video.setPlayAuth(playAuth);
|
||||
String s = playToken.generateToken();
|
||||
GetPlayInfoResponseBody urlBody = SpdbUtil.getUrl(video.getVideo());
|
||||
String url = urlBody==null?null:urlBody.getPlayInfoList().getPlayInfo().get(0).getPlayURL()+"?MtsHlsUriToken="+s;
|
||||
video.setMtsHlsUriToken(s);
|
||||
video.setM3u8Url(url);
|
||||
Integer integer = videoM3u8Dao.selectCount(new LambdaQueryWrapper<VideoM3u8Entity>().eq(VideoM3u8Entity::getVid, video.getVideo()));
|
||||
if(integer>0){
|
||||
String s = playToken.generateToken();
|
||||
GetPlayInfoResponseBody urlBody = SpdbUtil.getUrl(video.getVideo());
|
||||
String url = urlBody==null?null:urlBody.getPlayInfoList().getPlayInfo().get(0).getPlayURL()+"?MtsHlsUriToken="+s;
|
||||
video.setMtsHlsUriToken(s);
|
||||
video.setM3u8Url(url);
|
||||
}
|
||||
}
|
||||
UserCourseVideoPositionEntity videoPosition = getVideoPosition(video, uId);
|
||||
video.setUserCourseVideoPositionEntity(videoPosition);
|
||||
|
||||
@@ -221,8 +221,8 @@ public class CourseController {
|
||||
@RequestMapping("/mytt2")
|
||||
public R mytt2(@RequestBody Map<String,String> map){
|
||||
GetPlayInfoResponseBody urlbody = SpdbUtil.getUrl(map.get("vid"));
|
||||
String url = urlbody==null?null:urlbody.getPlayInfoList().getPlayInfo().get(0).getPlayURL();
|
||||
return R.ok().put("result",url);
|
||||
// String url = urlbody==null?null:urlbody.getPlayInfoList().getPlayInfo().get(0).getPlayURL();
|
||||
return R.ok().put("result",urlbody);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.Map;
|
||||
public class VodAliController {
|
||||
@Autowired
|
||||
private PlayToken playToken;
|
||||
@Autowired
|
||||
private SpdbUtil spdbUtil;
|
||||
|
||||
@GetMapping("/vodAliVideoRe")
|
||||
public byte[] vodAliVideoRe(@RequestParam("CipherText") String cipherText,
|
||||
@@ -41,7 +43,7 @@ public class VodAliController {
|
||||
@PostMapping("/uploadCallback")
|
||||
public void uploadCallback(@RequestBody Map<String,Object> map) throws Exception {
|
||||
String vid = String.valueOf(map.get("VideoId"));
|
||||
SpdbUtil.vodTranslationM3u8(vid);
|
||||
spdbUtil.vodTranslationM3u8(vid);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ connection-timeout: 6000000ms
|
||||
spring:
|
||||
# 环境 dev/dev1|test|prod
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev1
|
||||
# jackson时间格式化
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
|
||||
Reference in New Issue
Block a user