From ab141df783309d4a704f7b7d20aa465bf42ed371 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 02 九月 2020 18:40:25 +0800 Subject: [PATCH] '爱奇艺新版接口' --- src/main/java/com/yeshi/buwan/controller/parser/UserParser.java | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java index ac147d6..6f2c0c8 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java @@ -6,6 +6,7 @@ import com.yeshi.buwan.util.JuHe.VideoResourceUtil; import com.yeshi.buwan.util.annotation.RequireUid; import com.yeshi.buwan.util.email.MailSenderUtil; +import com.yeshi.buwan.util.video.VideoCategoryConstant; import com.yeshi.buwan.vo.AcceptData; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -18,6 +19,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Set; @Controller public class UserParser { @@ -53,7 +55,7 @@ out.print(JsonUtil.loadFalseJson("鑾峰彇uid澶辫触")); return; } else { - Map<String, String> map = configService.getConfigAsMap(detailSystem,acceptData.getVersion()); + Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); ShareContent share = shareService.getShareContent(detailSystem.getId()); JSONObject object = new JSONObject(); object.put("Uid", uid); @@ -141,7 +143,7 @@ List<String> list = searchService.suggestSearch(key, acceptData.getSystem()); if (acceptData.getPlatform().equalsIgnoreCase("ios")) { if (Constant.IOSTest) { - if (acceptData.getVersion()== 1) { + if (acceptData.getVersion() == 1) { list = new ArrayList<String>(); } } @@ -157,6 +159,34 @@ out.print(JsonUtil.loadTrueJson(object.toString())); } + + private List<VideoDetailInfo> createSearchVideoDetailsVO(VideoInfo video) { + List<VideoDetailInfo> detailList = new ArrayList<>(); + if (video.getVideoType() != null && (Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DIANSHIJU || Integer.parseInt(video.getVideoType().getId() + "") == VideoCategoryConstant.CATEGORY_DONGMAN)) { + if (video.getVideocount() <= 5) { + for (int i = 0; i < video.getVideocount(); i++) { + VideoDetailInfo detail = new VideoDetailInfo(); + detail.setTag((i + 1) + ""); + detailList.add(detail); + } + } else { + for (int i = 0; i < 3; i++) { + VideoDetailInfo detail = new VideoDetailInfo(); + detail.setTag((i + 1) + ""); + detailList.add(detail); + } + + for (int i = video.getVideocount() - 3; i < video.getVideocount(); i++) { + VideoDetailInfo detail = new VideoDetailInfo(); + detail.setTag((i + 1) + ""); + detailList.add(detail); + } + } + } + + return detailList; + } + // 鎼滅储 public void search(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { @@ -208,6 +238,20 @@ List<VideoInfo> list = searchService.search(detailSystem.getId(), request.getRemoteAddr(), acceptData.getUid(), key, pageIndex, (StringUtil.isNullOrEmpty(contentType) ? 0 : Integer.parseInt(contentType)), acceptData.getSystem(), resourceList, cacheMD5); + //缁勭粐鏁版嵁 + Set<Integer> albumCategorys = VideoCategoryConstant.getAlbumCategorys(); + for (VideoInfo video : list) { + //濡傛灉鏄鐗囷紝涓斾负5澶у垎绫� 灏遍噰鐢ㄧ珫鏉″睍绀� + /** + * 鏄笓杈戯紝骞朵笖涓烘鐗� + */ + //video.getVideoType() != null && albumCategorys.contains(Integer.parseInt(video.getVideoType().getId() + "")) && + if (video.getContentType() == 0) { + video.setVideoDetailList(createSearchVideoDetailsVO(video)); + video.setShowType(1); + } else + video.setShowType(0); + } cacheMD5 = "0"; if (list != null) { for (VideoInfo info : list) { -- Gitblit v1.8.0