添加官网接口
This commit is contained in:
@@ -1,19 +1,23 @@
|
||||
package com.peanut.modules.sys.controller;
|
||||
|
||||
import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
|
||||
import com.aliyun.vod20170321.models.GetVideoPlayAuthResponse;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.PageUtils;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.common.service.AsyncService;
|
||||
import com.peanut.common.utils.*;
|
||||
import com.peanut.modules.common.dao.ShopProductToLabelDao;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.common.dao.VideoM3u8Dao;
|
||||
import com.peanut.modules.common.entity.*;
|
||||
import com.peanut.modules.common.service.CoursePsycheService;
|
||||
import com.peanut.modules.common.service.MessageService;
|
||||
import com.peanut.modules.common.service.TaihuWelfareService;
|
||||
import com.peanut.modules.common.to.ParamTo;
|
||||
import com.peanut.modules.master.service.CourseCatalogueService;
|
||||
import com.peanut.modules.medical.service.CourseCatalogueChapterVideoService;
|
||||
import com.peanut.modules.medical.service.CourseMedicalService;
|
||||
import com.peanut.modules.medical.service.CourseService;
|
||||
import com.peanut.modules.sociology.service.CourseCatalogueChapterService;
|
||||
@@ -57,6 +61,10 @@ public class VisitorController {
|
||||
@Autowired
|
||||
private CourseCatalogueChapterService courseCatalogueChapterService;
|
||||
@Autowired
|
||||
private CourseCatalogueChapterVideoService courseCatalogueChapterVideoService;
|
||||
@Autowired
|
||||
private AsyncService asyncService;
|
||||
@Autowired
|
||||
private com.peanut.modules.medical.service.ShopProductService productService;
|
||||
@Autowired
|
||||
private CourseService courseService;
|
||||
@@ -70,6 +78,11 @@ public class VisitorController {
|
||||
private CoursePsycheService coursePsycheService;
|
||||
@Autowired
|
||||
private TaihuWelfareService taihuWelfareService;
|
||||
@Autowired
|
||||
private VideoM3u8Dao videoM3u8Dao;
|
||||
@Autowired
|
||||
private PlayToken playToken;
|
||||
|
||||
|
||||
//新书
|
||||
@RequestMapping("/getNewBook")
|
||||
@@ -231,11 +244,96 @@ public class VisitorController {
|
||||
@RequestMapping("/getMedicalCourseCatalogueInfo")
|
||||
public R getMedicalCourseCatalogueInfo(@RequestBody Map params){
|
||||
LambdaQueryWrapper<CourseCatalogueChapterEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CourseCatalogueChapterEntity::getIsAudition,1);
|
||||
wrapper.eq(CourseCatalogueChapterEntity::getCatalogueId,params.get("catalogueId"));
|
||||
wrapper.orderByAsc(CourseCatalogueChapterEntity::getSort);
|
||||
List<CourseCatalogueChapterEntity> list = courseCatalogueChapterService.list(wrapper);
|
||||
return R.ok().put("list",list);
|
||||
}
|
||||
//课程章节章节详情
|
||||
@RequestMapping("/getCourseCatalogueChapterDetail")
|
||||
public R getCourseCatalogueChapterDetail(@RequestBody ParamTo param){
|
||||
CourseCatalogueChapterEntity byId = courseCatalogueChapterService.getById(param.getId());
|
||||
HashMap<String, Object> flag = new HashMap<>();
|
||||
flag.put("detail",byId);
|
||||
List<CourseCatalogueChapterVideoEntity> courseCatalogueChapterVideoEntities = courseCatalogueChapterVideoService
|
||||
.list(new LambdaQueryWrapper<CourseCatalogueChapterVideoEntity>()
|
||||
.eq(CourseCatalogueChapterVideoEntity::getChapterId, param.getId())
|
||||
.orderByAsc(CourseCatalogueChapterVideoEntity::getSort));
|
||||
for(CourseCatalogueChapterVideoEntity c : courseCatalogueChapterVideoEntities){
|
||||
if(c.getType()==1){
|
||||
continue;
|
||||
}
|
||||
String s_str = "";
|
||||
if(c.getVideo().startsWith("common/")){
|
||||
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/";
|
||||
} else if (c.getVideo().startsWith("article/")) {
|
||||
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/";
|
||||
}else{
|
||||
s_str = "https://ehh-private-01.oss-cn-beijing.aliyuncs.com/video/taiHuClass/";
|
||||
}
|
||||
c.setVideoUrl(s_str+c.getVideo());
|
||||
}
|
||||
flag.put("videos",courseCatalogueChapterVideoEntities);
|
||||
return R.ok().put("data",flag);
|
||||
}
|
||||
//验证video权限
|
||||
@RequestMapping("/checkVideo")
|
||||
public R checkVideo(@RequestBody CourseCatalogueChapterVideoEntity videoEntity) throws Exception {
|
||||
//获取基础数据
|
||||
CourseCatalogueChapterVideoEntity video = courseCatalogueChapterVideoService.getById(videoEntity.getId());
|
||||
if (video.getDuration() == 0) {
|
||||
asyncService.pushDurationToVideo(video.getId());//补充视频信息,获取总时长
|
||||
}
|
||||
CourseCatalogueChapterEntity courseCatalogueChapterEntity = courseCatalogueChapterService.getById(video.getChapterId());
|
||||
CourseCatalogueEntity courseCatalogueEntity = courseCatalogueService.getById(courseCatalogueChapterEntity.getCatalogueId());
|
||||
//审查课程观看权限
|
||||
if(courseCatalogueChapterEntity.getIsAudition()==0){
|
||||
return R.error(505,"鉴权失败!");
|
||||
}
|
||||
//开始增加视频数据所需的其他信息,加密视频组装playauth
|
||||
if (video.getType() == 1) {
|
||||
GetVideoPlayAuthResponse p = SpdbUtil.getPlayAuth(video.getVideo());
|
||||
String playAuth = p.getBody().getPlayAuth();
|
||||
video.setPlayAuth(playAuth);
|
||||
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);
|
||||
//添加转码失败的标记
|
||||
if(url==null){
|
||||
List<VideoM3u8Entity> videoM3u8Entities = videoM3u8Dao.selectList(new LambdaQueryWrapper<VideoM3u8Entity>().eq(VideoM3u8Entity::getVid, video.getVideo()));
|
||||
VideoM3u8Entity videoM3u8Entity = videoM3u8Entities.get(0);
|
||||
videoM3u8Entity.setState(1);
|
||||
videoM3u8Dao.updateById(videoM3u8Entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (video.getType() == 0) {
|
||||
String s_str = "";
|
||||
if (video.getVideo().startsWith("common/")) {
|
||||
s_str = "https://oss.taihumed.com/video/";
|
||||
} else if (video.getVideo().startsWith("article/")) {
|
||||
s_str = "https://oss.taihumed.com/video/";
|
||||
} else {
|
||||
s_str = "https://oss.taihumed.com/video/taiHuClass/";
|
||||
}
|
||||
video.setVideoUrl(s_str + video.getVideo());
|
||||
}
|
||||
if(video.getType() == 2){
|
||||
String s_str = "";
|
||||
if (video.getVideo().startsWith("article/")) {
|
||||
s_str = "https://oss.taihumed.com/voice/article/";
|
||||
} else {
|
||||
s_str = "https://oss.taihumed.com/voice/taiHuClass/";
|
||||
}
|
||||
video.setVideoUrl(s_str + video.getVideo());
|
||||
}
|
||||
return R.ok().put("video",video);
|
||||
}
|
||||
|
||||
/**
|
||||
* 营销标签下商品列表
|
||||
|
||||
Reference in New Issue
Block a user