添加直播回放接口

This commit is contained in:
xuwenbo
2020-09-01 15:18:06 +08:00
parent 6fa3077d83
commit 302415542a
4 changed files with 28 additions and 2 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
target
.idea/
*.log
logs

View File

@ -8,6 +8,7 @@
*/
package co.yixiang.modules.wechat.rest.controller;
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
import co.yixiang.api.ApiResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.logging.aop.log.Log;
@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
@ -48,5 +50,9 @@ public class WechatLiveController {
public ApiResult<WechatLiveVo> getYxWechatLives(YxWechatLiveQueryCriteria criteria, Pageable pageable){
return ApiResult.ok(yxWechatLiveService.queryAll(criteria,pageable));
}
@GetMapping("yxWechatLive/getLiveReplay/{id}")
@ApiOperation("获取直播回放")
public ApiResult<List<WxMaLiveResult.LiveReplay>> getLiveReplay(@PathVariable Integer id){
return ApiResult.ok(yxWechatLiveService.getLiveReplay(id));
}
}

View File

@ -8,6 +8,7 @@
*/
package co.yixiang.modules.wechat.service;
import cn.binarywang.wx.miniapp.bean.WxMaLiveResult;
import co.yixiang.common.service.BaseService;
import co.yixiang.modules.wechat.domain.YxWechatLive;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveDto;
@ -60,4 +61,11 @@ public interface YxWechatLiveService extends BaseService<YxWechatLive>{
* @throws IOException /
*/
void download(List<YxWechatLiveDto> all, HttpServletResponse response) throws IOException;
/**
* 获取直播回放
* @param roomId
* @return
*/
List<WxMaLiveResult.LiveReplay> getLiveReplay(Integer roomId);
}

View File

@ -144,7 +144,18 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl<YxWechatLiveMapper,
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxWechatLive.class, criteria));
}
@Override
//@Cacheable
public List<WxMaLiveResult.LiveReplay> getLiveReplay(Integer roomId){
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
WxMaLiveResult get_replay = new WxMaLiveResult();
try {
get_replay = wxMaService.getLiveService().getLiveReplay("get_replay", roomId, 0, 100);
} catch (WxErrorException e) {
e.printStackTrace();
}
return get_replay.getLiveReplay();
}
@Override
public void download(List<YxWechatLiveDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();