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