From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 24 九月 2021 15:22:03 +0800 Subject: [PATCH] 接入视频直播 --- src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java | 619 ++++++++++++++++++++++++++++--------------------------- 1 files changed, 312 insertions(+), 307 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java b/src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java index 828481e..a4cfb00 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java @@ -7,11 +7,11 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.yeshi.buwan.exception.video.VideoPlayException; import org.springframework.stereotype.Controller; -import com.rabbitmq.tools.json.JSONUtil; import com.yeshi.buwan.domain.CategoryContry; -import com.yeshi.buwan.domain.DetailSystem; +import com.yeshi.buwan.domain.system.DetailSystem; import com.yeshi.buwan.domain.VideoDetailInfo; import com.yeshi.buwan.domain.VideoInfo; import com.yeshi.buwan.domain.VideoType; @@ -37,359 +37,364 @@ @Controller public class WebVideosParser { - @Resource - private SystemService systemService; + @Resource + private SystemService systemService; - @Resource - private VideoResourceUtil videoResouceUtil; + @Resource + private VideoResourceUtil videoResouceUtil; - @Resource - private ClassService classService; + @Resource + private ClassService classService; - @Resource - private CategoryAreaService categoryAreaService; + @Resource + private CategoryAreaService categoryAreaService; - @Resource - private VideoDetailUtil videoDeailUtil; + @Resource + private VideoDetailUtil videoDeailUtil; - @Resource - private CommentService commentService; + @Resource + private CommentService commentService; - @Resource - private AttentionService attentionService; + @Resource + private AttentionService attentionService; - @Resource - private RecommendService recommendService; + @Resource + private RecommendService recommendService; - // 鑾峰彇瑙嗛鍒楄〃 - public void getVideoList(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - String pid = request.getParameter("Pid"); - String cid = request.getParameter("Cid"); - String order = request.getParameter("Order"); - String type = request.getParameter("CategoryType"); - String pageIndex = request.getParameter("Page"); + // 鑾峰彇瑙嗛鍒楄〃 + public void getVideoList(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + String pid = request.getParameter("Pid"); + String cid = request.getParameter("Cid"); + String order = request.getParameter("Order"); + String type = request.getParameter("CategoryType"); + String pageIndex = request.getParameter("Page"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(packageName)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); - return; - } + if (StringUtil.isNullOrEmpty(packageName)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); + return; + } - if (StringUtil.isNullOrEmpty(pid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(pid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(cid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(cid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(order)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燨rder")); - return; - } + if (StringUtil.isNullOrEmpty(order)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燨rder")); + return; + } - if (StringUtil.isNullOrEmpty(type)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燭ype")); - return; - } + if (StringUtil.isNullOrEmpty(type)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燭ype")); + return; + } - if (StringUtil.isNullOrEmpty(pageIndex)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩age")); - return; - } + if (StringUtil.isNullOrEmpty(pageIndex)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩age")); + return; + } - JSONObject object = new JSONObject(); + JSONObject object = new JSONObject(); - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, 0); - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - // 鑾峰彇瑙嗛鍒楄〃 - List<VideoInfo> list1; - if (type.equalsIgnoreCase("area")) { - CategoryContry cc = categoryAreaService.getCategoryArea(cid); - String country = cc.getName(); - long typeid = cc.getParent().getCid(); - if (StringUtil.isNullOrEmpty(order)) - order = 1 + ""; - list1 = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, Integer.parseInt(pageIndex), 20, - Integer.parseInt(order), resourceList, country, StringUtil.Md5(typeid + "-" + detailSystem + "-" - + pageIndex + "-" + order + "-" + country + "-" + CacheUtil.getMD5Long(resourceList))); - } else { - list1 = classService.getTypeVideoList(StringUtil.isNullOrEmpty(cid) ? pid : cid, detailSystem, - Integer.parseInt(pageIndex), 20, Integer.parseInt(order), resourceList, - CacheUtil.getMD5Long(resourceList)); - } + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(detailSystem, 1,null); + // 鑾峰彇瑙嗛鍒楄〃 + List<VideoInfo> list1; + if (type.equalsIgnoreCase("area")) { + CategoryContry cc = categoryAreaService.getCategoryArea(cid); + String country = cc.getName(); + long typeid = cc.getParent().getCid(); + if (StringUtil.isNullOrEmpty(order)) + order = 1 + ""; + list1 = categoryAreaService.getVideoInfoByArea(typeid + "", detailSystem, Integer.parseInt(pageIndex), 20, + Integer.parseInt(order), resourceList, country, StringUtil.Md5(typeid + "-" + detailSystem + "-" + + pageIndex + "-" + order + "-" + country + "-" + CacheUtil.getMD5Long(resourceList))); + } else { + list1 = classService.getTypeVideoList(StringUtil.isNullOrEmpty(cid) ? pid : cid, detailSystem, + Integer.parseInt(pageIndex), 20, Integer.parseInt(order), resourceList, + CacheUtil.getMD5Long(resourceList)); + } - List<VideoInfo> list = new ArrayList<VideoInfo>(); - list.addAll(list1); - JSONArray array = new JSONArray(); - for (VideoInfo info : list) - array.add(StringUtil.outPutResultJson(info)); - object.put("data", array); - object.put("count", 1000); - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } + List<VideoInfo> list = new ArrayList<>(); + list.addAll(list1); + JSONArray array = new JSONArray(); + for (VideoInfo info : list) + array.add(StringUtil.outPutResultJson(info)); + object.put("data", array); + object.put("count", 1000); + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } - // 鑾峰彇瑙嗛鍒楄〃 - public void getVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - String videoId = request.getParameter("VideoId"); - String loginUid = request.getParameter("LoginUid"); - String resourceId = request.getParameter("ResourceId"); + // 鑾峰彇瑙嗛鍒楄〃 + public void getVideoDetail(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + String videoId = request.getParameter("VideoId"); + String loginUid = request.getParameter("LoginUid"); + String resourceId = request.getParameter("ResourceId"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(packageName)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); - return; - } + if (StringUtil.isNullOrEmpty(packageName)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); + return; + } - if (StringUtil.isNullOrEmpty(videoId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); - return; - } + if (StringUtil.isNullOrEmpty(videoId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); + return; + } - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, 0); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(new DetailSystem("44"), 1,null); - VideoInfo info = (videoDeailUtil.getVideoInfo(videoId, resourceId, resourceList, - CacheUtil.getMD5Long(resourceList))); - if (info == null) - return; + VideoInfo info = (videoDeailUtil.getVideoInfo(null, videoId, resourceId, resourceList, + CacheUtil.getMD5Long(resourceList))); + if (info == null) + return; - List<VideoType> typeList = classService.getVideoTypeList(info.getId()); - if (typeList != null && typeList.size() > 0) { - VideoType type = typeList.get(0); - while (type.getParent() != null) - type = type.getParent(); - info.setVideoType(type); - } + List<VideoType> typeList = classService.getVideoTypeList(info.getId()); + if (typeList != null && typeList.size() > 0) { + VideoType type = typeList.get(0); + while (type.getParent() != null) + type = type.getParent(); + info.setVideoType(type); + } - info.setPlayPicture(VideoPictureUtil.getShowPicture(info, platform, 0 + "")); + info.setPlayPicture(VideoPictureUtil.getShowPicture(info, platform, 0 + "")); - for (VideoDetailInfo vd : info.getVideoDetailList()) { - if (StringUtil.isNullOrEmpty(vd.getExtraId())) - vd.setExtraId(vd.getId() + ""); - } - System.out.println(info.getPlayPicture()); + for (VideoDetailInfo vd : info.getVideoDetailList()) { + if (StringUtil.isNullOrEmpty(vd.getExtraId())) + vd.setExtraId(vd.getId() + ""); + } + System.out.println(info.getPlayPicture()); - // 杩囨护鐗堟潈瑙嗛鍏抽敭瀛� - long count = commentService.getComment2ListCount(videoId, 0 + ""); - if (info != null) - info.setCommentCount((int) count); + // 杩囨护鐗堟潈瑙嗛鍏抽敭瀛� + long count = commentService.getComment2ListCount(videoId, 0 + ""); + if (info != null) + info.setCommentCount((int) count); - JSONObject obj = new JSONObject(); - if (info.getVideoDetailList().size() > 1) {// 澶氶泦,鍙叧娉� - boolean isAttention = false; - if (!StringUtil.isNullOrEmpty(loginUid)) { - isAttention = attentionService.isAddAttention(loginUid, info.getId()); - } - JSONObject attentionInfo = new JSONObject(); - attentionInfo.put("Name", info.getName()); - attentionInfo.put("Picture", info.getPicture()); - attentionInfo.put("UpdateInfo", "鏇存柊:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); - attentionInfo.put("IsAttention", isAttention); - obj.put("Attention", attentionInfo); - } + JSONObject obj = new JSONObject(); + if (info.getVideoDetailList().size() > 1) {// 澶氶泦,鍙叧娉� + boolean isAttention = false; + if (!StringUtil.isNullOrEmpty(loginUid)) { + isAttention = attentionService.isAddAttention(loginUid, info.getId()); + } + JSONObject attentionInfo = new JSONObject(); + attentionInfo.put("Name", info.getName()); + attentionInfo.put("Picture", info.getPicture()); + attentionInfo.put("UpdateInfo", "鏇存柊:" + TimeUtil.getCommentTime(Long.parseLong(info.getUpdatetime()))); + attentionInfo.put("IsAttention", isAttention); + obj.put("Attention", attentionInfo); + } - out.print(JsonUtil.loadTrueJsonWithNoEncry(StringUtil.outPutResultJson(Utils.convertVideo(info)), "", - obj.toString())); + out.print(JsonUtil.loadTrueJsonWithNoEncry(StringUtil.outPutResultJson(Utils.convertVideo(info)), "", + obj.toString())); - } + } - // 鑾峰彇瑙嗛鍒楄〃 - public void getRecommendVideos(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - String videoId = request.getParameter("VideoId"); + // 鑾峰彇瑙嗛鍒楄〃 + public void getRecommendVideos(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + String videoId = request.getParameter("VideoId"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(packageName)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); - return; - } + if (StringUtil.isNullOrEmpty(packageName)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); + return; + } - if (StringUtil.isNullOrEmpty(videoId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); - return; - } + if (StringUtil.isNullOrEmpty(videoId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); + return; + } - List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(platform, 0); + List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(new DetailSystem("44"), 1,null); - DetailSystem ds = systemService.getDetailSystemByPackage(packageName); - // 鐚滀綘鍠滄 - List<VideoInfo> list1 = StringUtil.isNullOrEmpty(videoId) - ? recommendService.guessLikeList(ds.getId(), 10, resourceList, CacheUtil.getMD5Long(resourceList)) - : recommendService.guessLikeList(ds.getId(), 10, videoId, resourceList, - CacheUtil.getMD5Long(resourceList)); - List<VideoInfo> list = new ArrayList<VideoInfo>(); - list.addAll(list1); + DetailSystem ds = systemService.getDetailSystemByPackage(packageName); + // 鐚滀綘鍠滄 + List<VideoInfo> list1 = StringUtil.isNullOrEmpty(videoId) + ? recommendService.guessLikeList(ds.getId(), 10, resourceList, CacheUtil.getMD5Long(resourceList)) + : recommendService.guessLikeList(ds.getId(), 10, videoId, resourceList, + CacheUtil.getMD5Long(resourceList)); + List<VideoInfo> list = new ArrayList<>(); + list.addAll(list1); - // 鐩稿叧瑙嗛 - List<VideoInfo> list2 = recommendService.getRelativeVideoList(ds.getId(), 10, videoId, resourceList, - CacheUtil.getMD5Long(resourceList)); - List<VideoInfo> xlist = new ArrayList<VideoInfo>(); - xlist.addAll(list2); + // 鐩稿叧瑙嗛 + List<VideoInfo> list2 = recommendService.getRelativeVideoList(ds.getId(), 10, videoId, resourceList, + CacheUtil.getMD5Long(resourceList)); + List<VideoInfo> xlist = new ArrayList<>(); + xlist.addAll(list2); - // 澶у閮藉湪鐪� - List<VideoInfo> list3 = recommendService.peopleSee(ds.getId(), 10, videoId, resourceList, - CacheUtil.getMD5Long(resourceList)); - List<VideoInfo> plist = new ArrayList<VideoInfo>(); - plist.addAll(list3); - JSONArray garray = new JSONArray(); - JSONArray xarray = new JSONArray(); - JSONArray parray = new JSONArray(); - for (VideoInfo v : list) { - v.setIntroduction(""); - v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); - garray.add(StringUtil.outPutResultJson(v)); - } + // 澶у閮藉湪鐪� + List<VideoInfo> list3 = recommendService.peopleSee(ds.getId(), 10, videoId, resourceList, + CacheUtil.getMD5Long(resourceList)); + List<VideoInfo> plist = new ArrayList<>(); + plist.addAll(list3); + JSONArray garray = new JSONArray(); + JSONArray xarray = new JSONArray(); + JSONArray parray = new JSONArray(); + for (VideoInfo v : list) { + v.setIntroduction(""); + v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); + garray.add(StringUtil.outPutResultJson(v)); + } - for (VideoInfo v : xlist) { - v.setIntroduction(""); - v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); - xarray.add(StringUtil.outPutResultJson(v)); - } + for (VideoInfo v : xlist) { + v.setIntroduction(""); + v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); + xarray.add(StringUtil.outPutResultJson(v)); + } - for (VideoInfo v : plist) { - v.setIntroduction(""); - v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); - parray.add(StringUtil.outPutResultJson(v)); - } - JSONObject data = new JSONObject(); - data.put("guesslike", garray); - data.put("relative", xarray); - data.put("peoplesee", parray); - out.print(JsonUtil.loadTrueJsonNoencript(data.toString())); - } + for (VideoInfo v : plist) { + v.setIntroduction(""); + v.setPicture(VideoPictureUtil.getShowPicture(v, platform, "0")); + parray.add(StringUtil.outPutResultJson(v)); + } + JSONObject data = new JSONObject(); + data.put("guesslike", garray); + data.put("relative", xarray); + data.put("peoplesee", parray); + out.print(JsonUtil.loadTrueJsonNoencript(data.toString())); + } - // 鑾峰彇瑙嗛鍒楄〃 - public void getPlayUrl(String uid, HttpServletRequest request, PrintWriter out) { - String method = request.getParameter("Method"); - String system = request.getParameter("System"); - String sign = request.getParameter("Sign"); - String platform = request.getParameter("Platform"); - String packageName = request.getParameter("Package"); - String resourceId = request.getParameter("ResourceId"); - String id = request.getParameter("Id"); - String type = request.getParameter("Type"); - String videoId = request.getParameter("VideoId"); + // 鑾峰彇瑙嗛鍒楄〃 + public void getPlayUrl(String uid, HttpServletRequest request, PrintWriter out) { + String method = request.getParameter("Method"); + String system = request.getParameter("System"); + String sign = request.getParameter("Sign"); + String platform = request.getParameter("Platform"); + String packageName = request.getParameter("Package"); + String resourceId = request.getParameter("ResourceId"); + String id = request.getParameter("Id"); + String type = request.getParameter("Type"); + String videoId = request.getParameter("VideoId"); - if (StringUtil.isNullOrEmpty(method)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); - return; - } - if (StringUtil.isNullOrEmpty(uid)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); - return; - } - if (StringUtil.isNullOrEmpty(system)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); - return; - } - if (StringUtil.isNullOrEmpty(sign)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); - return; - } - if (StringUtil.isNullOrEmpty(platform)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); - return; - } + if (StringUtil.isNullOrEmpty(method)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燤ethod")); + return; + } + if (StringUtil.isNullOrEmpty(uid)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燯id")); + return; + } + if (StringUtil.isNullOrEmpty(system)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ystem")); + return; + } + if (StringUtil.isNullOrEmpty(sign)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燬ign")); + return; + } + if (StringUtil.isNullOrEmpty(platform)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩latform")); + return; + } - if (StringUtil.isNullOrEmpty(packageName)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); - return; - } + if (StringUtil.isNullOrEmpty(packageName)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燩ackage")); + return; + } - if (StringUtil.isNullOrEmpty(videoId)) { - out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); - return; - } + if (StringUtil.isNullOrEmpty(videoId)) { + out.print(JsonUtil.loadFalseJson("璇蜂笂浼燰ideoId")); + return; + } - DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); + DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - PlayUrl pu = videoDeailUtil.getPlayUrl(detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + PlayUrl pu = null; + try { + pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + } catch (VideoPlayException e) { + e.printStackTrace(); + } - if (pu != null) { - if (!StringUtil.isNullOrEmpty(pu.getUrl())) - pu.setUrl(pu.getUrl()); - JSONObject object = JSONObject.fromObject(StringUtil.outPutResultJson(pu)); - out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); - } else { - out.print(JsonUtil.loadFalseJsonNoencript("鎵句笉鍒拌瑙嗛")); - } + if (pu != null) { + if (!StringUtil.isNullOrEmpty(pu.getUrl())) + pu.setUrl(pu.getUrl()); + JSONObject object = JSONObject.fromObject(StringUtil.outPutResultJson(pu)); + out.print(JsonUtil.loadTrueJsonNoencript(object.toString())); + } else { + out.print(JsonUtil.loadFalseJsonNoencript("鎵句笉鍒拌瑙嗛")); + } - } + } } -- Gitblit v1.8.0