Commit 082e7a72 authored by jiaorz's avatar jiaorz

随机视频列表

parent 1451680b
......@@ -139,16 +139,16 @@ public class MsgBiz {
}
query.with(new Sort(Sort.Direction.DESC, "count.praise"));
List<Msg> msgList = fetchAndAttach(mongoTemplate.find(query, Msg.class, "s_msg"), userId);
Set<Msg> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgList)) {
if(number >= msgList.size()) {
return ObjectRestResponse.succ(msgList);
List<MsgVo> msgVoList = replaceMsgResult(msgList);
Set<MsgVo> resultList = new HashSet<>();
if(CollectionUtils.isNotEmpty(msgVoList)) {
if(number >= msgVoList.size()) {
return ObjectRestResponse.succ(msgVoList);
}
Set<Integer> set = new HashSet<>();
RandomUtil.randomSet(msgList.size(), number, set, number);
RandomUtil.randomSet(msgVoList.size(), number, set, number);
for(Integer i : set) {
resultList.add(msgList.get(i));
resultList.add(msgVoList.get(i));
}
}
return ObjectRestResponse.succ(resultList);
......
......@@ -61,5 +61,14 @@ public class MsgController {
return msgBiz.getMsgList(msgQueryDto);
}
@GetMapping(value = "/app/unauth/getHostMsgList")
public ObjectRestResponse getHostMsgList(String messageId, Integer number) {
return msgBiz.getHotMsgListWithoutOne(messageId, number);
}
@GetMapping(value = "/app/unauth/get")
public ObjectRestResponse getDetail(String id) {
return msgBiz.get(id);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment