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/SearchParser.java | 2 src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java | 167 +++ src/main/webapp/admin/new/js/navsetting.xml | 1 src/main/webapp/admin/new/tvlive_channel_add.html | 110 ++ src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java | 2 src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java | 7 src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java | 25 src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java | 43 src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java | 42 src/main/java/com/yeshi/buwan/service/imp/SearchService.java | 38 src/main/java/com/yeshi/buwan/util/DouBanUtil.java | 429 +++++-- src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java | 103 ++ src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java | 5 src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java | 22 src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java | 8 src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java | 18 src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java | 31 src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java | 50 + src/main/java/com/yeshi/buwan/controller/TestController.java | 4 src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java | 48 src/main/webapp/admin/new/tvlive_category_channel_list.html | 2 src/main/java/com/yeshi/buwan/aspect/SignAspect.java | 23 src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java | 6 src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java | 2 src/main/java/com/yeshi/buwan/controller/parser/web/WebVideosParser.java | 8 src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java | 13 src/test/java/com/hxh/spring/test/VideoTest.java | 9 src/main/webapp/admin/new/tvlive_category_add.html | 2 src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java | 34 src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java | 113 ++ src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java | 97 + src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java | 6 src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java | 44 src/main/webapp/admin/new/tvlive_channel_list.html | 16 src/main/java/com/yeshi/buwan/domain/video/StarInfo.java | 72 + src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java | 3 src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java | 38 src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java | 2 src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java | 29 src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java | 15 src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java | 63 + src/test/java/com/hxh/spring/test/GeneralTest.java | 99 + src/main/java/com/yeshi/buwan/job/LiveJob.java | 104 ++ src/main/resources/script/tvlive/dianshimao_program.js | 30 src/test/java/com/hxh/spring/test/live/TVLiveTest.java | 107 ++ src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java | 16 src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java | 54 + src/main/webapp/admin/new/tvlive_channel_resource.html | 235 ++++ src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java | 207 ++- src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java | 5 src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java | 3 src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java | 7 src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java | 2 src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java | 81 + src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java | 2 src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java | 70 + src/main/java/com/yeshi/buwan/controller/parser/UserParser.java | 4 src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java | 12 src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java | 109 ++ src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java | 2 src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java | 19 61 files changed, 2,597 insertions(+), 323 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java index 224f430..4daac39 100644 --- a/src/main/java/com/yeshi/buwan/aspect/SignAspect.java +++ b/src/main/java/com/yeshi/buwan/aspect/SignAspect.java @@ -48,13 +48,13 @@ //濡傛灉鏄疉ndroid鏂扮増鏈垯璋冪敤鏂扮殑绛惧悕鏂规硶 //甯冧父3.8.7涔嬪悗璋冪敤鏂扮殑绛惧悕鏂规硶 - if (acceptData != null && "android" .equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { + if (acceptData != null && "android".equalsIgnoreCase(acceptData.getPlatform()) && acceptData.getVersion() >= 105) { Map<String, String[]> params = request.getParameterMap(); //绛惧悕 List<String> list = new ArrayList<>(); for (Iterator<String> its = params.keySet().iterator(); its.hasNext(); ) { String key = its.next(); - if ("sign" .equalsIgnoreCase(key)) + if ("sign".equalsIgnoreCase(key)) continue; list.add(key + "=" + params.get(key)[0]); } @@ -79,19 +79,26 @@ if (acceptData != null) { - if ("ios" .equalsIgnoreCase(acceptData.getPlatform())) { + if ("ios".equalsIgnoreCase(acceptData.getPlatform())) { acceptData.setChannel("appstore"); } - if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite")) - acceptData.setPackageName("com.doudou.ysvideo"); + if (acceptData.getPackageName().equalsIgnoreCase("com.doudou.ysvideo.lite")) { + //灏忕背涓婃灦浣跨敤 + if (!"xiaomi".equalsIgnoreCase(acceptData.getChannel())) { + acceptData.setPackageName("com.doudou.ysvideo"); + acceptData.setChildPackage("com.doudou.ysvideo.lite"); + } else { + acceptData.setChildPackage("com.doudou.ysvideo.lite"); + } + } else { + acceptData.setChildPackage(acceptData.getPackage()); + } //娉ㄥ叆detailSystem DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); acceptData.setDetailSystem(detailSystem); - acceptData.setChildPackage(acceptData.getPackage()); - detailSystem = systemService.getDetailSystemByPackage(acceptData.getChildPackage()); - + acceptData.setChildDetailSystem(detailSystem); } diff --git a/src/main/java/com/yeshi/buwan/controller/TestController.java b/src/main/java/com/yeshi/buwan/controller/TestController.java index e95efb2..8160426 100644 --- a/src/main/java/com/yeshi/buwan/controller/TestController.java +++ b/src/main/java/com/yeshi/buwan/controller/TestController.java @@ -53,11 +53,11 @@ logger.error("娴嬭瘯"); out.print("success"); } - + @RequestMapping("searchAlbum") public void searchAlbum(String key, PrintWriter out) { - SearchService.SearchResult result = searchService.searchAlbum(0, key, null,1, 20); + SearchService.SearchResult result = searchService.searchAlbum(0, key, null, 1, 20, false); out.print(JsonUtil.loadTrueResult(result)); } diff --git a/src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java b/src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java index bcb966e..c1fa332 100644 --- a/src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java +++ b/src/main/java/com/yeshi/buwan/controller/admin/api/TVLiveChannelAdminController.java @@ -1,16 +1,16 @@ package com.yeshi.buwan.controller.admin.api; import com.google.gson.*; -import com.yeshi.buwan.domain.live.SuperTVLiveCategory; -import com.yeshi.buwan.domain.live.TVLiveCategory; -import com.yeshi.buwan.domain.live.TVLiveCategoryChannelMap; -import com.yeshi.buwan.domain.live.TVLiveChannel; +import com.google.gson.reflect.TypeToken; +import com.yeshi.buwan.domain.live.*; import com.yeshi.buwan.domain.web.DetailSystemSelect; import com.yeshi.buwan.exception.live.TVLiveCategoryException; import com.yeshi.buwan.service.imp.SystemService; import com.yeshi.buwan.service.inter.live.TVLiveCategoryChannelService; +import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; import com.yeshi.buwan.service.inter.live.TVLiveChannelService; import com.yeshi.buwan.util.*; +import com.yeshi.buwan.vo.tvlive.TVLiveChannelResourceMapAdminVO; import com.yeshi.buwan.web.tag.PageEntity; import net.sf.json.JSONObject; import org.springframework.stereotype.Controller; @@ -39,6 +39,9 @@ @Resource private SystemService systemService; + @Resource + private TVLiveChannelResourceService tvLiveChannelResourceService; + private Gson gson = new GsonBuilder().registerTypeAdapter(Date.class, new JsonSerializer<Date>() { @Override @@ -63,6 +66,24 @@ data.put("pageEntity", new PageEntity(page, Constant.pageCount, (int) count)); data.put("data", gson.toJson(channelList)); out.print(JsonUtil.loadTrueAdmin(data.toString())); + } + + @RequestMapping(value = "/addChannel", method = RequestMethod.POST) + public void addChannel(TVLiveChannel channel, HttpSession session, PrintWriter out) { + if (StringUtil.isNullOrEmpty(channel.getName()) || StringUtil.isNullOrEmpty(channel.gethPicture())) { + out.print(JsonUtil.loadFalseAdmin("鏁版嵁涓嶅畬鏁�")); + return; + } + channel.setState(TVLiveChannel.STATE_NORMAL); + try { + tvLiveChannelService.addChannel(channel); + out.print(JsonUtil.loadTrueAdmin("")); + } catch (Exception e) { + out.print(JsonUtil.loadFalseAdmin(e.getMessage())); + return; + } + + } @@ -119,92 +140,100 @@ out.print(JsonUtil.loadTrueAdmin("")); } + //鑾峰彇棰戦亾璧勬簮 -// @RequestMapping(value = "/addCategory", method = RequestMethod.POST) -// public void addCategory(TVLiveCategory category, String detailsystemids, HttpSession session, PrintWriter out) { -// -// if (StringUtil.isNullOrEmpty(category.getName())) { -// out.print(JsonUtil.loadFalseAdmin("鏁版嵁涓嶅畬鏁�")); -// return; -// } -// -// category.setSystemId(SystemUtil.getAdminSelectedSystem(session).getId()); -// -// List<String> detailSystemList = new ArrayList<>(); -// if (!StringUtil.isNullOrEmpty(detailsystemids)) { -// String[] sps = detailsystemids.split(","); -// for (String sp : sps) { -// detailSystemList.add(sp); -// } -// } -// -// try { -// tvLiveCategoryService.addCategory(category, detailSystemList); -// out.print(JsonUtil.loadTrueAdmin("")); -// } catch (TVLiveCategoryException e) { -// out.print(JsonUtil.loadFalseAdmin(e.getMsg())); -// } -// } -// -// -// @RequestMapping(value = "/updateCategory", method = RequestMethod.POST) -// public void updateCategory(TVLiveCategory category, PrintWriter out) { -// -// if (StringUtil.isNullOrEmpty(category.getName())) { -// out.print(JsonUtil.loadFalseAdmin("鏁版嵁涓嶅畬鏁�")); -// return; -// } -// tvLiveCategoryService.updateCategory(category); -// out.print(JsonUtil.loadTrueAdmin("")); -// } -// -// -// @RequestMapping(value = "/getCategory", method = RequestMethod.POST) -// public void getCategory(String id, PrintWriter out) { -// TVLiveCategory category = tvLiveCategoryService.selectCategoryBuPrimaryKey(id); -// out.print(JsonUtil.loadTrueAdmin(new Gson().toJson(category))); -// } -// -// -// /** -// * 鍒犻櫎鍒嗙被 -// * -// * @param ids -// * @param out -// */ -// @RequestMapping(value = "/deleteCategory", method = RequestMethod.POST) -// public void deleteCategory(String ids, PrintWriter out) { -// if (StringUtil.isNullOrEmpty(ids)) { -// out.print(JsonUtil.loadFalseAdmin("ids涓嶈兘涓虹┖")); -// return; -// } -// tvLiveCategoryService.deleteCateogry(Arrays.asList(ids.split(","))); -// out.print(JsonUtil.loadTrueAdmin("")); -// } -// -// -// @RequestMapping(value = "/deleteSuperCategory", method = RequestMethod.POST) -// public void deleteSuperCategory(String cid, String detailSystemId, PrintWriter out) { -// if (StringUtil.isNullOrEmpty(cid) || StringUtil.isNullOrEmpty(detailSystemId)) { -// out.print(JsonUtil.loadFalseAdmin("淇℃伅涓嶅畬鏁�")); -// return; -// } -// tvLiveCategoryService.deleteSuperCategory(cid, detailSystemId); -// out.print(JsonUtil.loadTrueAdmin("")); -// } -// -// -// @RequestMapping(value = "/addSuperCategory", method = RequestMethod.POST) -// public void addSuperCategory(String cid, String detailSystemId, Integer weight, String icon, PrintWriter out) { -// -// SuperTVLiveCategory superTVLiveCategory = new SuperTVLiveCategory(); -// superTVLiveCategory.setCid(cid); -// superTVLiveCategory.setDetailSystemId(detailSystemId); -// superTVLiveCategory.setWeight(weight); -// superTVLiveCategory.setIcon(icon); -// tvLiveCategoryService.addSuperCategory(superTVLiveCategory); -// out.print(JsonUtil.loadTrueAdmin("")); -// } + /** + * 鑾峰彇棰戦亾鐨勬挱鏀捐祫婧� + * + * @param session + * @param id + * @param out + */ + @RequestMapping(value = "/getChannelResourceList", method = RequestMethod.POST) + public void getChannelResourceList(HttpSession session, String id, PrintWriter out) { + + if (StringUtil.isNullOrEmpty(id)) { + out.print(JsonUtil.loadFalseAdmin("棰戦亾ID涓嶈兘涓虹┖")); + return; + } + + + List<TVLiveChannelResourceMap> mapList = tvLiveChannelResourceService.listByChannelId(id); + List<TVLiveChannelResourceMapAdminVO> voList = new ArrayList<>(); + if (mapList != null) + for (TVLiveChannelResourceMap map : mapList) { + voList.add(TVLiveChannelResourceMapAdminVO.create(map)); + } + + JSONObject data = new JSONObject(); + data.put("data", gson.toJson(voList)); + data.put("channelId", id); + out.print(JsonUtil.loadTrueAdmin(data.toString())); + } + + + /** + * 鏇存柊棰戦亾鎾斁璧勬簮 + * + * @param session + * @param id + * @param resources + * @param out + */ + @RequestMapping(value = "/updateChannelResources", method = RequestMethod.POST) + public void updateChannelResources(HttpSession session, String id, String resources, PrintWriter out) { + + if (StringUtil.isNullOrEmpty(id)) { + out.print(JsonUtil.loadFalseAdmin("棰戦亾ID涓嶈兘涓虹┖")); + return; + } + + Type type = new TypeToken<List<TVLiveChannelResourceMapAdminVO>>() { + }.getType(); + + List<TVLiveChannelResourceMapAdminVO> voList = gson.fromJson(resources, type); + + List<TVLiveChannelResourceMap> list = new ArrayList<>(); + + for (TVLiveChannelResourceMapAdminVO vo : voList) { + TVLiveChannelResourceMap map = new TVLiveChannelResourceMap(); + map.setId(vo.getId()); + map.setWeight(vo.getWeight()); + map.setChannelId(id); + map.setPlayUrl(vo.getPlayUrl()); + map.setSubResourceName(vo.getName()); + list.add(map); + } + List<TVLiveChannelResourceMap> originMapList = tvLiveChannelResourceService.listByChannelId(id); + if (originMapList == null) + originMapList = new ArrayList<>(); + + List<String> originMapIds = new ArrayList<>(); + for (TVLiveChannelResourceMap map : originMapList) { + originMapIds.add(map.getId()); + } + + //鏇存柊闇�瑕佹洿鏂扮殑 + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getId() != null && originMapIds.contains(list.get(i).getId())) { + originMapIds.remove(list.get(i).getId()); + tvLiveChannelResourceService.update(list.get(i)); + list.remove(i--); + } + } + //鍒犻櫎涓嶉渶瑕佹洿鏂扮殑 + for (String mid : originMapIds) { + tvLiveChannelResourceService.delete(mid); + } + + //娣诲姞鏂扮殑 + for (TVLiveChannelResourceMap map : list) { + //鍜挄涓嶈兘鎵嬪姩娣诲姞 + map.setResource(TVLiveResource.other); + tvLiveChannelResourceService.add(map); + } + out.print(JsonUtil.loadTrueAdmin("")); + } } diff --git a/src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java b/src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java index 2363f14..e93c43e 100644 --- a/src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java +++ b/src/main/java/com/yeshi/buwan/controller/api/TVLiveController.java @@ -127,7 +127,7 @@ MiGuLiveListInfo info = miGuLiveService.selectByPrimaryKey(map.getRid()); playUrl = MiguLiveApiUtil.getPlayUrl(info.getPID()); } else if (map.getResource() == TVLiveResource.other) { - + playUrl = map.getPlayUrl(); } JSONObject root = new JSONObject(); root.put("playUrl", playUrl); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java index 209dcbf..513e9d3 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/ClassParser.java @@ -330,7 +330,7 @@ } //IOS瀹℃牳鐗堟湰 - DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", detailSystem, acceptData.getVersion()); + DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion()); if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) { typelist.clear(); } diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java index 290010b..0d343ff 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/ConfigParser.java @@ -160,7 +160,7 @@ public void getConfig(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createAppSplash(new BaseLog(acceptData, ""))); DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); + Map<String, String> map = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion()); JSONObject data = new JSONObject(); JSONObject ad = new JSONObject(); JSONObject adNew = new JSONObject(); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java b/src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java index b5a5fff..5ae3289 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/FoundParser.java @@ -170,7 +170,7 @@ DetailSystem ds = systemService.getDetailSystemByPackage(acceptData.getPackageName()); //IOS瀹℃牳鐗堟湰 - DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", ds, acceptData.getVersion()); + DetailSystemConfig onLineVersion = detailSystemConfigService.getConfigByKey("ios_online_version", acceptData.getDetailSystem(), acceptData.getVersion()); if (onLineVersion != null && Integer.parseInt(onLineVersion.getValue()) <= acceptData.getVersion()) { SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""})); diff --git a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java index f6e89d9..cc8d534 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/HomeParser.java @@ -12,6 +12,7 @@ import com.yeshi.buwan.domain.video.VideoWatchHistory; import com.yeshi.buwan.dto.log.BaseLog; import com.yeshi.buwan.dto.statistic.video.VideoDetailStatisticData; +import com.yeshi.buwan.exception.video.VideoPlayException; import com.yeshi.buwan.videos.mogotv.MogoTVUtil; import com.yeshi.buwan.videos.pptv.PPTVApiUtil; import com.yeshi.buwan.videos.pptv.PPTVUtil; @@ -205,7 +206,7 @@ list.add(ht); if ("309" .equals(vtid)) { if (!"ios" .equalsIgnoreCase(acceptData.getPlatform())) { - Map<String, String> confMap = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); + Map<String, String> confMap = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion()); String mm = confMap.get("meinv_mm_count"); int count = Integer.parseInt(mm); if (count > 0) { @@ -234,8 +235,8 @@ } if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion())) { - DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); - DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getChildDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (adContent != null && adPosition != null) { HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); int adP = Integer.parseInt(adPosition.getValue()); @@ -335,8 +336,8 @@ try { if (VersionUtil.isGraterThan387(acceptData.getPlatform(), acceptData.getVersion()) && dataKey.equalsIgnoreCase("recommend")) { - DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getDetailSystem(), acceptData.getVersion()); - DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adContent = configService.getConfigByKey("home_banner_ad_content", acceptData.getChildDetailSystem(), acceptData.getVersion()); + DetailSystemConfig adPosition = configService.getConfigByKey("home_banner_ad_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (adContent != null && adPosition != null) { HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); int adP = Integer.parseInt(adPosition.getValue()); @@ -976,7 +977,12 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - PlayUrl pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + PlayUrl pu = null; + try { + pu = videoDeailUtil.getPlayUrl(acceptData, detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); + } catch (VideoPlayException e) { + e.printStackTrace(); + } if (pu != null) { if (!StringUtil.isNullOrEmpty(pu.getUrl())) @@ -1030,7 +1036,7 @@ public void isPraise(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); - DetailSystemConfig config = configService.getConfigByKey("banner_praise", detailSystem, acceptData.getVersion()); + DetailSystemConfig config = configService.getConfigByKey("banner_praise", acceptData.getChildDetailSystem(), acceptData.getVersion()); if ("鏄�" .equals(config.getValue())) { out.print(JsonUtil.loadTrueJson("1")); } else { @@ -1052,7 +1058,7 @@ public void getRecommendSearchSpecial(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); //鎺ㄨ崘鎼滅储涓撻 - DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", detailSystem, acceptData.getVersion()); + DetailSystemConfig config = configService.getConfigByKey("recommend_search_special_position", acceptData.getChildDetailSystem(), acceptData.getVersion()); if (config == null) { out.print(JsonUtil.loadFalseAdmin("浣嶇疆涓虹┖")); return; diff --git a/src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java b/src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java index 08beec1..bf11303 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/SearchParser.java @@ -196,7 +196,7 @@ item.put("icon", map.getIcon()); String name = item.optString("name"); //榄呮棌鍜屽皬绫充笉娣诲姞 - if (("xiaomi" .equalsIgnoreCase(acceptData.getChannel()) || "meizu" .equalsIgnoreCase(acceptData.getChannel())) && "hanju-video-types" .equalsIgnoreCase(pid)) { + if (("xiaomi" .equalsIgnoreCase(acceptData.getChannel())) && "hanju-video-types" .equalsIgnoreCase(pid)) { if (name.contains("鐢佃鍓�") || name.contains("鐢靛奖") || name.contains("缁艰壓") || name.contains("灏戝効")) { array.add(item); } 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 59e6af2..9598bf3 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/UserParser.java @@ -105,7 +105,7 @@ out.print(JsonUtil.loadFalseJson("鑾峰彇uid澶辫触")); return; } else { - Map<String, String> map = configService.getConfigAsMap(detailSystem, acceptData.getVersion()); + Map<String, String> map = configService.getConfigAsMap(acceptData.getChildDetailSystem(), acceptData.getVersion()); ShareContent share = shareService.getShareContent(detailSystem.getId()); JSONObject object = new JSONObject(); object.put("Uid", uid); @@ -721,7 +721,7 @@ //鏂扮増鐑棬鎼滅储 public void getHotSearchNew(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { - DetailSystemConfig config = configService.getConfigByKey("hot_search", acceptData.getDetailSystem(), acceptData.getVersion()); + DetailSystemConfig config = configService.getConfigByKey("hot_search", acceptData.getDetailSystem(), acceptData.getVersion()); if (config == null) { out.print(JsonUtil.loadFalseJson("鏃犲唴瀹�")); return; diff --git a/src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java b/src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java index 0312d0a..c9870ab 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/ZhiBoParser.java @@ -114,10 +114,11 @@ List<LiveType> typelist = new ArrayList<LiveType>(); String value = ""; if ("IOS".equalsIgnoreCase(acceptData.getPlatform())) { - DetailSystemConfig config = configService.getConfigByKey("open_huajiao_IOS", detailSystem, acceptData.getVersion()); + DetailSystemConfig config = configService.getConfigByKey("open_huajiao_IOS", acceptData.getDetailSystem(), acceptData.getVersion()); value = config.getValue(); } else { - DetailSystemConfig config = configService.getConfigByKey("open_huajiao_Android", detailSystem, acceptData.getVersion()); + + DetailSystemConfig config = configService.getConfigByKey("open_huajiao_Android", acceptData.getDetailSystem(), acceptData.getVersion()); value = config.getValue(); } if ("鏄�".equals(value)) { diff --git a/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java b/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java index 9ce1d9d..47afac2 100644 --- a/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java +++ b/src/main/java/com/yeshi/buwan/controller/parser/web/WebHomeParser.java @@ -8,6 +8,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.yeshi.buwan.exception.video.VideoPlayException; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.methods.GetMethod; @@ -934,7 +935,12 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - PlayUrl pu = videoDeailUtil.getPlayUrl(null, 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())) 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 965711a..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,6 +7,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import com.yeshi.buwan.exception.video.VideoPlayException; import org.springframework.stereotype.Controller; import com.yeshi.buwan.domain.CategoryContry; @@ -378,7 +379,12 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); - PlayUrl pu = videoDeailUtil.getPlayUrl(null, 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())) diff --git a/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java b/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java index 5b638da..d3cac8c 100644 --- a/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java +++ b/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelDao.java @@ -45,6 +45,9 @@ if (bean.getState() != null) { update.set("state", bean.getState()); } + if (bean.getProgramList() != null) { + update.set("programList", bean.getProgramList()); + } if (bean.getCreateTime() != null) { update.set("createTime", bean.getCreateTime()); } diff --git a/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java b/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java index a2443b6..47ed3a0 100644 --- a/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java +++ b/src/main/java/com/yeshi/buwan/dao/live/TVLiveChannelResourceMapDao.java @@ -37,6 +37,19 @@ if (bean.getCreateTime() != null) { update.set("createTime", bean.getCreateTime()); } + + if (bean.getPlayUrl() != null) { + update.set("playUrl", bean.getPlayUrl()); + } + + if (bean.getSubResourceName() != null) { + update.set("subResourceName", bean.getSubResourceName()); + } + + if (bean.getCreateTime() != null) { + update.set("createTime", bean.getCreateTime()); + } + update.set("updateTime", new Date()); update(query, update); } diff --git a/src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java b/src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java new file mode 100644 index 0000000..3e20b33 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/dao/live/TVLiveProgramResourceDao.java @@ -0,0 +1,97 @@ +package com.yeshi.buwan.dao.live; + +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Repository; + +import java.util.List; + +import com.yeshi.buwan.domain.live.TVLiveProgramResource; +import com.yeshi.buwan.dao.base.MongodbBaseDao; + +import java.util.Date; + +import com.yeshi.buwan.domain.live.TVLiveProgramResource.TVLiveProgramResourceType; + +import java.lang.String; +import java.util.ArrayList; + + +@Repository +public class TVLiveProgramResourceDao extends MongodbBaseDao<TVLiveProgramResource> { + + public void updateSelective(TVLiveProgramResource bean) { + Query query = new Query(); + Update update = new Update(); + query.addCriteria(Criteria.where("id").is(bean.getId())); + if (bean.getChannelId() != null) { + update.set("channelId", bean.getChannelId()); + } + if (bean.getUrl() != null) { + update.set("url", bean.getUrl()); + } + if (bean.getType() != null) { + update.set("type", bean.getType()); + } + if (bean.getCreateTime() != null) { + update.set("createTime", bean.getCreateTime()); + } + update.set("updateTime", new Date()); + update(query, update); + } + + + public List<TVLiveProgramResource> list(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { + query.with(new Sort(daoQuery.sortList)); + } + query.skip(daoQuery.start); + query.limit(daoQuery.count); + return findList(query); + } + + public long count(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + return count(query); + } + + private Query getQuery(DaoQuery daoQuery) { + List<Criteria> andList = new ArrayList<>(); + if (daoQuery.channelId != null) { + andList.add(Criteria.where("channelId").is(daoQuery.channelId)); + } + if (daoQuery.url != null) { + andList.add(Criteria.where("url").is(daoQuery.url)); + } + if (daoQuery.type != null) { + andList.add(Criteria.where("type").is(daoQuery.type)); + } + if (daoQuery.minCreateTime != null) { + andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); + } + if (daoQuery.maxCreateTime != null) { + andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); + } + Query query = new Query(); + Criteria[] ands = new Criteria[andList.size()]; + andList.toArray(ands); + if (ands.length > 0) { + query.addCriteria(new Criteria().andOperator(ands)); + } + return query; + } + + public static class DaoQuery { + public String channelId; + public String url; + public TVLiveProgramResource.TVLiveProgramResourceType type; + public Date minCreateTime; + public Date maxCreateTime; + public int start; + public int count; + public List<Sort.Order> sortList; + } +} diff --git a/src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java b/src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java new file mode 100644 index 0000000..a7d57b1 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/dao/video/StarInfoDao.java @@ -0,0 +1,103 @@ +package com.yeshi.buwan.dao.video; + +import javafx.animation.KeyValue; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.data.domain.Sort; +import org.springframework.stereotype.Repository; + +import com.yeshi.buwan.domain.video.StarInfo; + +import java.util.List; + +import com.yeshi.buwan.dao.base.MongodbBaseDao; + +import java.util.Date; +import java.lang.String; +import java.util.ArrayList; + + +@Repository +public class StarInfoDao extends MongodbBaseDao<StarInfo> { + + public void updateSelective(StarInfo bean) { + Query query = new Query(); + Update update = new Update(); + query.addCriteria(Criteria.where("id").is(bean.getId())); + if (bean.getChineseName() != null) { + update.set("chineseName", bean.getChineseName()); + } + if (bean.getEnglishName() != null) { + update.set("englishName", bean.getEnglishName()); + } + if (bean.getAvatar() != null) { + update.set("avatar", bean.getAvatar()); + } + if (bean.getDetailUrl() != null) { + update.set("detailUrl", bean.getDetailUrl()); + } + if (bean.getCreateTime() != null) { + update.set("createTime", bean.getCreateTime()); + } + update.set("updateTime", new Date()); + update(query, update); + } + + + public List<StarInfo> list(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { + query.with(new Sort(daoQuery.sortList)); + } + query.skip(daoQuery.start); + query.limit(daoQuery.count); + return findList(query); + } + + public long count(DaoQuery daoQuery) { + Query query = getQuery(daoQuery); + return count(query); + } + + private Query getQuery(DaoQuery daoQuery) { + List<Criteria> andList = new ArrayList<>(); + if (daoQuery.chineseName != null) { + andList.add(Criteria.where("chineseName").is(daoQuery.chineseName)); + } + if (daoQuery.englishName != null) { + andList.add(Criteria.where("englishName").is(daoQuery.englishName)); + } + if (daoQuery.avatar != null) { + andList.add(Criteria.where("avatar").is(daoQuery.avatar)); + } + if (daoQuery.detailUrl != null) { + andList.add(Criteria.where("detailUrl").is(daoQuery.detailUrl)); + } + if (daoQuery.minCreateTime != null) { + andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); + } + if (daoQuery.maxCreateTime != null) { + andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); + } + Query query = new Query(); + Criteria[] ands = new Criteria[andList.size()]; + andList.toArray(ands); + if (ands.length > 0) { + query.addCriteria(new Criteria().andOperator(ands)); + } + return query; + } + + public static class DaoQuery { + public String chineseName; + public String englishName; + public String avatar; + public String detailUrl; + public Date minCreateTime; + public Date maxCreateTime; + public int start; + public int count; + public List<Sort.Order> sortList; + } +} diff --git a/src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java b/src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java new file mode 100644 index 0000000..596387c --- /dev/null +++ b/src/main/java/com/yeshi/buwan/dao/video/VideoResourcePlayVersionMapDao.java @@ -0,0 +1,70 @@ +package com.yeshi.buwan.dao.video; + +import com.yeshi.buwan.dao.base.MongodbBaseDao; +import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; +import org.springframework.data.mongodb.core.query.Criteria; +import org.springframework.data.mongodb.core.query.Query; +import org.springframework.data.mongodb.core.query.Update; +import org.springframework.stereotype.Repository; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Repository +public class VideoResourcePlayVersionMapDao extends MongodbBaseDao<VideoResourcePlayVersionMap> { + + public void updateSelective(VideoResourcePlayVersionMap bean) { + Query query = new Query(); + Update update = new Update(); + query.addCriteria(Criteria.where("id").is(bean.getId())); + if (bean.getDetailSystemId() != null) { + update.set("detailSystemId", bean.getDetailSystemId()); + } + if (bean.getVersion() != null) { + update.set("version", bean.getVersion()); + } + if (bean.getResourceId() != null) { + update.set("resourceId", bean.getResourceId()); + } + if (bean.getRemarks() != null) { + update.set("remarks", bean.getRemarks()); + } + if (bean.getCreateTime() != null) { + update.set("createTime", bean.getCreateTime()); + } + update.set("updateTime", new Date()); + update(query, update); + } + + + /** + * 鑾峰彇鏈夋晥鐨勬潵婧� + * + * @param detailSystemId + * @param version + * @return + */ + public List<VideoResourcePlayVersionMap> listValid(String detailSystemId, Integer version, String channel) { + Query query = new Query(); + + List<Criteria> andList = new ArrayList<>(); + andList.add(Criteria.where("detailSystemId").is(detailSystemId)); + andList.add(Criteria.where("version").lte(version)); + if (channel != null) { + Query childQuery = new Query(); + childQuery.addCriteria(new Criteria().andOperator(Criteria.where("detailSystemId").is(detailSystemId),Criteria.where("version").lte(version), Criteria.where("channel").is(channel.toLowerCase()))); + if (count(childQuery) > 0) { + andList.add(Criteria.where("channel").is(channel)); + } else { + andList.add(Criteria.where("channel").is(null)); + } + } else { + andList.add(Criteria.where("channel").is(null)); + } + Criteria[] cts = new Criteria[andList.size()]; + andList.toArray(cts); + query.addCriteria(new Criteria().andOperator(cts)); + return findList(query); + } +} diff --git a/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java b/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java index ac4717f..aa22e17 100644 --- a/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java +++ b/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannel.java @@ -5,6 +5,7 @@ import org.springframework.data.mongodb.core.mapping.Document; import java.util.Date; +import java.util.List; /** * 鐢佃鐩存挱娓犻亾 @@ -31,6 +32,8 @@ private Integer state; private Date createTime; private Date updateTime; + //鑺傜洰鍒楄〃 + private List<TVLiveProgram> programList; public String getId() { @@ -120,4 +123,43 @@ public void setState(Integer state) { this.state = state; } + + + public List<TVLiveProgram> getProgramList() { + return programList; + } + + public void setProgramList(List<TVLiveProgram> programList) { + this.programList = programList; + } + + + /** + * 鐩存挱鑺傜洰 + */ + public static class TVLiveProgram { + private String time; + private String name; + + public TVLiveProgram(String time, String name) { + this.time = time; + this.name = name; + } + + public String getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + } } diff --git a/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java b/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java index b4ea40c..b86ae66 100644 --- a/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java +++ b/src/main/java/com/yeshi/buwan/domain/live/TVLiveChannelResourceMap.java @@ -1,5 +1,6 @@ package com.yeshi.buwan.domain.live; +import com.yeshi.buwan.util.StringUtil; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @@ -17,6 +18,11 @@ private Integer weight; private Date createTime; + //瀛愭潵婧愬悕绉� + private String subResourceName; + //鎾斁閾炬帴 + private String playUrl; + public String getId() { return id; @@ -26,8 +32,12 @@ this.id = id; } - public static String createId(String channelId, TVLiveResource resource) { - return channelId + "-" + resource.name(); + public static String createId(String channelId, TVLiveResource resource, String subResourceName) { + String id = channelId + "-" + resource.name(); + if (!StringUtil.isNullOrEmpty(subResourceName)) { + id += "-" + subResourceName; + } + return id; } public String getChannelId() { @@ -69,4 +79,21 @@ public void setCreateTime(Date createTime) { this.createTime = createTime; } + + public String getSubResourceName() { + return subResourceName; + } + + public void setSubResourceName(String subResourceName) { + this.subResourceName = subResourceName; + } + + public String getPlayUrl() { + return playUrl; + } + + public void setPlayUrl(String playUrl) { + this.playUrl = playUrl; + } + } diff --git a/src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java b/src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java new file mode 100644 index 0000000..948ff55 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/domain/live/TVLiveProgramResource.java @@ -0,0 +1,81 @@ +package com.yeshi.buwan.domain.live; + +import org.springframework.data.annotation.Id; + +import java.util.Date; + +/** + * 鐢佃鑺傜洰婧� + */ +public class TVLiveProgramResource { + + public enum TVLiveProgramResourceType { + //鐢佃鐚� + dianshimao, + //鎼滆缃� + tvsou + } + + @Id + private String id; + + private String channelId; + //婧愰摼鎺� + private String url; + + private TVLiveProgramResourceType type; + private Date createTime; + private Date updateTime; + + public static String createId(String channelId, TVLiveProgramResourceType type) { + return channelId + "-" + type.name(); + } + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public TVLiveProgramResourceType getType() { + return type; + } + + public void setType(TVLiveProgramResourceType type) { + this.type = type; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/src/main/java/com/yeshi/buwan/domain/video/StarInfo.java b/src/main/java/com/yeshi/buwan/domain/video/StarInfo.java new file mode 100644 index 0000000..676f134 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/domain/video/StarInfo.java @@ -0,0 +1,72 @@ +package com.yeshi.buwan.domain.video; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Date; + +/** + * @author Administrator + * @title: StarInfo + * @description: 鏄庢槦淇℃伅 + * @date 2021/9/23 10:11 + */ +@Document(collection = "starInfo") +public class StarInfo { + //douban鐨勬槑鏄烮D + @Id + private String id; + private String chineseName; + private String englishName; + private String avatar; + private String detailUrl; + private Date createTime; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getChineseName() { + return chineseName; + } + + public void setChineseName(String chineseName) { + this.chineseName = chineseName; + } + + public String getEnglishName() { + return englishName; + } + + public void setEnglishName(String englishName) { + this.englishName = englishName; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getDetailUrl() { + return detailUrl; + } + + public void setDetailUrl(String detailUrl) { + this.detailUrl = detailUrl; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } +} diff --git a/src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java b/src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java new file mode 100644 index 0000000..cdff352 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/domain/video/VideoResourcePlayVersionMap.java @@ -0,0 +1,109 @@ +package com.yeshi.buwan.domain.video; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.index.Indexed; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.util.Date; + +/** + * 瑙嗛鏉ユ簮鎾斁鐨勭増鏈槧灏� + */ +@Document(collection = "videoResourcePlayVersionMap") +public class VideoResourcePlayVersionMap { + @Id + private String id; + @Indexed + private String detailSystemId; + @Indexed + private Integer version; + private String resourceId; + private String remarks; + private Date createTime; + private Date updateTime; + private String channel; + + + public VideoResourcePlayVersionMap() { + + } + + public VideoResourcePlayVersionMap(String detailSystemId, Integer version, String resourceId, String channel) { + this.detailSystemId = detailSystemId; + this.version = version; + this.resourceId = resourceId; + this.channel = channel; + } + + public static String createId(String detailSystemId, Integer version, String resourceId, String channel) { + String id = detailSystemId + "-" + version + "-" + resourceId; + if (channel != null) { + id += "-" + channel; + } + return id; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getDetailSystemId() { + return detailSystemId; + } + + public void setDetailSystemId(String detailSystemId) { + this.detailSystemId = detailSystemId; + } + + public Integer getVersion() { + return version; + } + + public void setVersion(Integer version) { + this.version = version; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getRemarks() { + return remarks; + } + + public void setRemarks(String remarks) { + this.remarks = remarks; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + public String getChannel() { + return channel; + } + + public void setChannel(String channel) { + this.channel = channel; + } +} diff --git a/src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java b/src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java new file mode 100644 index 0000000..61193ee --- /dev/null +++ b/src/main/java/com/yeshi/buwan/exception/video/VideoPlayException.java @@ -0,0 +1,34 @@ +package com.yeshi.buwan.exception.video; + +/** + * 鐖卞鑹烘悳绱㈠紩鎿庡紓甯� + */ +public class VideoPlayException extends Exception { + + + private int code; + private String msg; + + public VideoPlayException(int code, String msg) { + this.code = code; + this.msg = msg; + } + + + public VideoPlayException(String msg) { + this.msg = msg; + } + + public String getMsg() { + return msg; + } + + public int getCode() { + return code; + } + + @Override + public String getMessage() { + return msg; + } +} diff --git a/src/main/java/com/yeshi/buwan/job/LiveJob.java b/src/main/java/com/yeshi/buwan/job/LiveJob.java index 8441240..22f8794 100644 --- a/src/main/java/com/yeshi/buwan/job/LiveJob.java +++ b/src/main/java/com/yeshi/buwan/job/LiveJob.java @@ -4,14 +4,19 @@ import com.xxl.job.core.handler.annotation.XxlJob; import com.yeshi.buwan.domain.live.TVLiveChannel; import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; +import com.yeshi.buwan.domain.live.TVLiveProgramResource; import com.yeshi.buwan.domain.live.TVLiveResource; import com.yeshi.buwan.live.migu.MiGuLiveListInfo; import com.yeshi.buwan.live.migu.MiguLiveApiUtil; import com.yeshi.buwan.service.inter.live.MiGuLiveService; import com.yeshi.buwan.service.inter.live.TVLiveChannelResourceService; import com.yeshi.buwan.service.inter.live.TVLiveChannelService; +import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService; import com.yeshi.buwan.service.inter.system.SystemConfigService; +import com.yeshi.buwan.util.StringUtil; import com.yeshi.buwan.util.factory.live.TVLiveChannelFactory; +import com.yeshi.buwan.util.tvlive.DianShiMaoUtil; +import com.yeshi.buwan.util.tvlive.TVSOUUtil; import net.sf.json.JSONArray; import org.springframework.stereotype.Component; @@ -44,12 +49,17 @@ for (MiGuLiveListInfo info : mList) { miGuLiveService.saveChannelInfo(info); TVLiveChannel channel = TVLiveChannelFactory.create(info); - //娣诲姞鍒伴閬� - tvLiveService.save(channel); + TVLiveChannel old = tvLiveService.selectByPrimaryKey(channel.getId()); + if (old == null) { + //娣诲姞鍒伴閬� + tvLiveService.save(channel); + } else { + tvLiveService.update(channel); + } TVLiveChannelResourceMap map = new TVLiveChannelResourceMap(); map.setChannelId(channel.getId()); - map.setId(TVLiveChannelResourceMap.createId(channel.getId(), TVLiveResource.migu)); + map.setId(TVLiveChannelResourceMap.createId(channel.getId(), TVLiveResource.migu, null)); map.setResource(TVLiveResource.migu); map.setRid(info.getId()); map.setWeight(1); @@ -62,4 +72,92 @@ } + @Resource + private TVLiveProgramResourceService tvLiveProgramResourceService; + + @Resource + private TVLiveChannelService tvLiveChannelService; + + /** + * 鏇存柊鑺傜洰鍗� + * + * @param params + * @return + * @throws Exception + */ + @XxlJob("live-updateprograms") + public ReturnT<String> updatePrograms(String params) throws Exception { + updatePrograms_TVSOU(params); + return ReturnT.SUCCESS; + } + + + /** + * 鐢佃鐚� + * + * @param params + * @throws Exception + */ + public void updatePrograms_DianshiMao(String params) throws Exception { + if (StringUtil.isNullOrEmpty(params)) { + List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByType(TVLiveProgramResource.TVLiveProgramResourceType.dianshimao, 1, 1000); + int count = 0; + for (TVLiveProgramResource resource : list) { + count++; + List<TVLiveChannel.TVLiveProgram> plist = DianShiMaoUtil.getProgramList(resource.getUrl()); + System.out.println(count); + Thread.sleep(1000); + if (plist != null && plist.size() > 0) { + tvLiveChannelService.savePrograms(resource.getChannelId(), plist); + } + } + } else { + //鏇存柊鍗曚釜鑺傜洰鍗� + List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByChannelId(params, 1, 10); + for (TVLiveProgramResource resource : list) { + if (resource.getType() != TVLiveProgramResource.TVLiveProgramResourceType.dianshimao) + continue; + List<TVLiveChannel.TVLiveProgram> plist = DianShiMaoUtil.getProgramList(resource.getUrl()); + if (plist != null && plist.size() > 0) { + tvLiveChannelService.savePrograms(resource.getChannelId(), plist); + } + } + } + } + + + /** + * 鎼滆缃� + * + * @param params + * @throws Exception + */ + public void updatePrograms_TVSOU(String params) throws Exception { + if (StringUtil.isNullOrEmpty(params)) { + List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByType(TVLiveProgramResource.TVLiveProgramResourceType.tvsou, 1, 1000); + int count = 0; + for (TVLiveProgramResource resource : list) { + count++; + List<TVLiveChannel.TVLiveProgram> plist = TVSOUUtil.getProgramList(resource.getUrl()); + System.out.println(count); + Thread.sleep(1000); + if (plist != null && plist.size() > 0) { + tvLiveChannelService.savePrograms(resource.getChannelId(), plist); + } + } + } else { + //鏇存柊鍗曚釜鑺傜洰鍗� + List<TVLiveProgramResource> list = tvLiveProgramResourceService.listByChannelId(params, 1, 10); + for (TVLiveProgramResource resource : list) { + if (resource.getType() != TVLiveProgramResource.TVLiveProgramResourceType.tvsou) + continue; + List<TVLiveChannel.TVLiveProgram> plist = TVSOUUtil.getProgramList(resource.getUrl()); + if (plist != null && plist.size() > 0) { + tvLiveChannelService.savePrograms(resource.getChannelId(), plist); + } + } + } + } + + } diff --git a/src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java b/src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java index ff7b068..88a8f48 100644 --- a/src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java +++ b/src/main/java/com/yeshi/buwan/live/migu/MiguLiveApiUtil.java @@ -21,7 +21,7 @@ * @return */ public static String getPlayUrl(String pid) { - return "https://m.miguvideo.com/mgs/msite/prd/detail.html?cid=" + pid; + return "https://m.miguvideo.com/mgs/msite/prd/liveDetail.html?cId=" + pid; } diff --git a/src/main/java/com/yeshi/buwan/service/imp/SearchService.java b/src/main/java/com/yeshi/buwan/service/imp/SearchService.java index 8d765cd..011d7d2 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/SearchService.java +++ b/src/main/java/com/yeshi/buwan/service/imp/SearchService.java @@ -290,18 +290,18 @@ } - public SearchResult searchAlbum(int videoType, String key, List<Long> resourceIds, int page, int pageSize) { + public SearchResult searchAlbum(int videoType, String key, List<Long> resourceIds, int page, int pageSize, boolean fuzzy) { List<VideoInfo> localList = new ArrayList<>(); //涓撹緫瑙嗛闆嗗悎 Set<String> solrAlbumVids = new HashSet<>(); SolrVideoSearchFilter filter = new SolrVideoSearchFilter(); + filter.setFuzzy(fuzzy); filter.setKey(key); if (videoType == Constant.SEARCH_RESULT_TYPE_HIGH_DEFINITION) { filter.setResourceIds(Arrays.asList(new String[]{PPTVUtil.RESOURCE_ID + ""})); logger.info("楂樻竻鎼滅储# key锛歿}", key); } else { - List<String> rids = new ArrayList<>(); for (Long rid : resourceIds) { rids.add(rid + ""); @@ -318,7 +318,7 @@ albumCount = solrResultDTO.getTotalCount(); for (SolrAlbumVideo sv : (List<SolrAlbumVideo>) solrResultDTO.getVideoList()) { VideoInfo video = VideoInfoFactory.create(sv); - albumSet.add(video.getName() + "#" + video.getVideoType().getId()); + albumSet.add(video.getName() + "#" + video.getVideoType().getId() + "#" + video.getYear()); video = loadAlbumData(video); localList.add(video); solrAlbumVids.add(video.getId()); @@ -342,14 +342,25 @@ i--; } } - for (InternetSearchVideo sv : isvList) { - VideoInfo video = VideoInfoFactory.create(sv); - video = loadAlbumData(video); - if (albumCount < 3) { - localList.add(video); - } else { - if (video.getName().equalsIgnoreCase(key)) + + //绮剧‘鍖归厤锛屼笉鍒嗚瘝 + if (!fuzzy) { + for (InternetSearchVideo sv : isvList) { + VideoInfo video = VideoInfoFactory.create(sv); + video = loadAlbumData(video); + //绗竴涓笓杈戞暟閲� + if (albumCount < 3) { localList.add(video); + } else { + if (video.getName().equalsIgnoreCase(key)) + localList.add(video); + } + } + } else { + for (InternetSearchVideo sv : isvList) { + VideoInfo video = VideoInfoFactory.create(sv); + video = loadAlbumData(video); + localList.add(video); } } } @@ -451,7 +462,12 @@ localList = new ArrayList<>(); //鍏堟悳绱笓杈� int pageSize = 20; - SearchResult searchResult = searchAlbum(videoType, key, resourceList, page, pageSize); + SearchResult searchResult = searchAlbum(videoType, key, resourceList, page, pageSize, false); + + if (page == 1 && (searchResult == null || searchResult.videoInfoList == null || searchResult.videoInfoList.size() == 0)) { + searchResult = searchAlbum(videoType, key, resourceList, page, pageSize, true); + } + if (searchResult != null && searchResult.videoInfoList != null) { localList.addAll(searchResult.videoInfoList); } diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java index a5692ac..d88b82b 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/live/MiGuLiveServiceImpl.java @@ -3,6 +3,7 @@ import com.yeshi.buwan.dao.live.migu.MiGuLiveListInfoDao; import com.yeshi.buwan.live.migu.MiGuLiveListInfo; import com.yeshi.buwan.service.inter.live.MiGuLiveService; +import com.yeshi.buwan.util.StringUtil; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -17,7 +18,7 @@ @Override public void saveChannelInfo(MiGuLiveListInfo info) { if (info.getId() == null) { - info.setId(info.getpID()); + info.setId(StringUtil.Md5(info.getName())); } if (info.getCreateTime() == null) { diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java index 238eabb..b7bf6dd 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveCategoryChannelServiceImpl.java @@ -49,7 +49,7 @@ @Override public List<TVLiveChannel> listChannelByCid(String cid, String nameKey, int page, int pageSize) { //鏌ヨMap - List<TVLiveCategoryChannelMap> mapList = tvLiveCategoryChannelMapDao.listByCid(cid, (page-1)*pageSize, pageSize); + List<TVLiveCategoryChannelMap> mapList = tvLiveCategoryChannelMapDao.listByCid(cid, (page - 1) * pageSize, pageSize); if (mapList == null || mapList.size() == 0) return null; List<String> cids = new ArrayList<>(); @@ -66,7 +66,8 @@ List<TVLiveChannel> resultList = new ArrayList<>(); for (TVLiveCategoryChannelMap sc : mapList) { - resultList.add(map.get(sc.getChannelId())); + if (map.get(sc.getChannelId()) != null) + resultList.add(map.get(sc.getChannelId())); } return resultList; } diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java index 519bf92..6149f23 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelResourceServiceImpl.java @@ -43,7 +43,7 @@ if (map == null) return; if (map.getId() == null) { - map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource())); + map.setId(TVLiveChannelResourceMap.createId(map.getChannelId(), map.getResource(),map.getSubResourceName())); } if (tvLiveChannelResourceMapDao.get(map.getId()) != null) return; diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java index 91567f7..ff9a4b3 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java @@ -43,8 +43,36 @@ channel.setUpdateTime(new Date()); } + tvLiveChannelDao.save(channel); return channel; + } + + @Override + public TVLiveChannel addChannel(TVLiveChannel channel) throws ParamsException, Exception { + if (channel == null || StringUtil.isNullOrEmpty(channel.getName())) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "鍚嶇О涓嶈兘涓虹┖"); + } + + if (StringUtil.isNullOrEmpty(channel.gethPicture())) { + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "妯浘涓嶈兘涓虹┖"); + } + + if (channel.getId() == null) { + channel.setId(StringUtil.Md5(channel.getName())); + } + + if (channel.getState() == null) { + channel.setState(TVLiveChannel.STATE_NORMAL); + } + + + if (tvLiveChannelDao.get(channel.getId()) != null) { + throw new Exception("棰戦亾宸茬粡瀛樺湪"); + } + + + return save(channel); } @Override @@ -88,5 +116,18 @@ daoQuery.name = name; return tvLiveChannelDao.count(daoQuery); } - + + @Override + public TVLiveChannel selectByPrimaryKey(String id) { + return tvLiveChannelDao.get(id); + } + + @Override + public void savePrograms(String id, List<TVLiveChannel.TVLiveProgram> tvLivePrograms) { + TVLiveChannel channel = new TVLiveChannel(); + channel.setId(id); + channel.setProgramList(tvLivePrograms); + tvLiveChannelDao.updateSelective(channel); + } + } diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java new file mode 100644 index 0000000..6ee67be --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveProgramResourceServiceImpl.java @@ -0,0 +1,50 @@ +package com.yeshi.buwan.service.imp.live; + +import com.yeshi.buwan.domain.live.TVLiveProgramResource; +import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao; +import com.yeshi.buwan.exception.ParamsException; +import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService; + +import javax.annotation.Resource; + +import com.yeshi.buwan.util.StringUtil; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class TVLiveProgramResourceServiceImpl implements TVLiveProgramResourceService { + + @Resource + private TVLiveProgramResourceDao tVLiveProgramResourceDao; + + @Override + public void add(TVLiveProgramResource resource) throws ParamsException { + if (StringUtil.isNullOrEmpty(resource.getChannelId()) || StringUtil.isNullOrEmpty(resource.getUrl()) || resource.getType() == null) + throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "鍙傛暟涓嶅畬鏁�"); + if (resource.getId() == null) + resource.setId(TVLiveProgramResource.createId(resource.getChannelId(), resource.getType())); + if (resource.getCreateTime() == null) + resource.setCreateTime(new Date()); + tVLiveProgramResourceDao.save(resource); + } + + @Override + public List<TVLiveProgramResource> listByChannelId(String channelId, int page, int pageSize) { + TVLiveProgramResourceDao.DaoQuery daoQuery = new TVLiveProgramResourceDao.DaoQuery(); + daoQuery.channelId = channelId; + daoQuery.start = (page - 1) * pageSize; + daoQuery.count = pageSize; + return tVLiveProgramResourceDao.list(daoQuery); + } + + @Override + public List<TVLiveProgramResource> listByType(TVLiveProgramResource.TVLiveProgramResourceType type, int page, int pageSize) { + TVLiveProgramResourceDao.DaoQuery daoQuery = new TVLiveProgramResourceDao.DaoQuery(); + daoQuery.type = type; + daoQuery.start = (page - 1) * pageSize; + daoQuery.count = pageSize; + return tVLiveProgramResourceDao.list(daoQuery); + } +} \ No newline at end of file diff --git a/src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java new file mode 100644 index 0000000..74d3db5 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/imp/video/StarInfoServiceImpl.java @@ -0,0 +1,16 @@ +package com.yeshi.buwan.service.imp.video; + +import com.yeshi.buwan.domain.video.StarInfo; +import com.yeshi.buwan.dao.video.StarInfoDao; +import com.yeshi.buwan.service.inter.video.StarInfoService; +import javax.annotation.Resource; +import org.springframework.stereotype.Service; +import java.util.Date; + +@Service +public class StarInfoServiceImpl implements StarInfoService{ + + @Resource + private StarInfoDao starInfoDao; + +} \ No newline at end of file diff --git a/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java new file mode 100644 index 0000000..889cfad --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourcePlayVersionMapServiceImpl.java @@ -0,0 +1,48 @@ +package com.yeshi.buwan.service.imp.video; + +import com.yeshi.buwan.dao.video.VideoResourcePlayVersionMapDao; +import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Service +public class VideoResourcePlayVersionMapServiceImpl implements VideoResourcePlayVersionMapService { + + @Resource + private VideoResourcePlayVersionMapDao videoResourcePlayVersionMapDao; + + @Override + public void add(VideoResourcePlayVersionMap map) throws Exception { + if (map == null || map.getDetailSystemId() == null || map.getResourceId() == null || map.getVersion() == null) { + throw new Exception("鍙傛暟涓嶅畬鏁�"); + } + map.setId(VideoResourcePlayVersionMap.createId(map.getDetailSystemId(), map.getVersion(), map.getResourceId(), map.getChannel())); + if (map.getCreateTime() == null) { + map.setCreateTime(new Date()); + } + videoResourcePlayVersionMapDao.save(map); + } + + @Override + public List<VideoResourcePlayVersionMap> list(String detailSystemId, Integer version, String channel) { + + return videoResourcePlayVersionMapDao.listValid(detailSystemId, version, channel); + } + + @Override + public List<String> listResourceId(String detailSystemId, Integer version, String channel) { + List<VideoResourcePlayVersionMap> mapList = list(detailSystemId, version, channel); + List<String> ids = new ArrayList<>(); + if (mapList != null) { + for (VideoResourcePlayVersionMap map : mapList) { + ids.add(map.getResourceId()); + } + } + return ids; + } +} \ No newline at end of file diff --git a/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java index 7ff4bf7..10b36ed 100644 --- a/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java +++ b/src/main/java/com/yeshi/buwan/service/imp/video/VideoResourceVersionMapServiceImpl.java @@ -6,6 +6,7 @@ import javax.annotation.Resource; +import org.springframework.data.mongodb.core.query.Query; import org.springframework.stereotype.Service; import java.util.ArrayList; @@ -47,4 +48,10 @@ } return ids; } + + @Override + public List<VideoResourceVersionMap> listAll() { + Query query = new Query(); + return videoResourceVersionMapDao.findList(query); + } } \ No newline at end of file diff --git a/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java b/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java index c243034..08c2678 100644 --- a/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java +++ b/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveChannelService.java @@ -17,6 +17,8 @@ public TVLiveChannel save(@Valid TVLiveChannel channel) throws ParamsException; + public TVLiveChannel addChannel(@Valid TVLiveChannel channel) throws ParamsException,Exception; + public void delete(String id); public void update(TVLiveChannel channel); @@ -25,5 +27,9 @@ public long count(String name, Integer state); + public TVLiveChannel selectByPrimaryKey(String id); + + public void savePrograms(String id, List<TVLiveChannel.TVLiveProgram> tvLivePrograms); + } diff --git a/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java b/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java new file mode 100644 index 0000000..e22f930 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/inter/live/TVLiveProgramResourceService.java @@ -0,0 +1,29 @@ +package com.yeshi.buwan.service.inter.live; + +import com.yeshi.buwan.domain.live.TVLiveProgramResource; +import com.yeshi.buwan.exception.ParamsException; + +import javax.validation.Valid; +import java.util.List; + +public interface TVLiveProgramResourceService { + + /** + * 鏂板 + * + * @param resource + * @throws ParamsException + */ + public void add(@Valid TVLiveProgramResource resource) throws ParamsException; + + /** + * + * @param channelId + * @return + */ + public List<TVLiveProgramResource> listByChannelId(String channelId,int page, int pageSize); + + + public List<TVLiveProgramResource> listByType(TVLiveProgramResource.TVLiveProgramResourceType type,int page,int pageSize); + +} diff --git a/src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java b/src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java new file mode 100644 index 0000000..067044c --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/inter/video/StarInfoService.java @@ -0,0 +1,7 @@ +package com.yeshi.buwan.service.inter.video; + +import com.yeshi.buwan.domain.video.StarInfo; + +public interface StarInfoService { + +} diff --git a/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java b/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java new file mode 100644 index 0000000..8557a70 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourcePlayVersionMapService.java @@ -0,0 +1,44 @@ +package com.yeshi.buwan.service.inter.video; + +import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; + +import java.util.List; + +/** + * @author HXH + * @title: 瑙嗛鎾斁婧愮鐞嗘湇鍔� + * @projectName BuWan + * @description: 鐢ㄤ簬绠$悊瑙嗛鑾峰彇鎾斁閾炬帴鏃惰兘澶熸挱鏀惧摢浜涙挱鏀炬簮锛� + * 涓嶸ideoResourceVersionMapService涓嶅悓鐨勬槸锛� + * 鍓嶈�呭彧鑳藉鐞嗘槸鍚︽樉绀虹殑闂锛屽悗鑰呭鐞嗙殑鏄槸鍚﹀彲浠ユ挱鏀� + * @date + */ +public interface VideoResourcePlayVersionMapService { + + /** + * 娣诲姞 + * + * @param map + * @throws Exception + */ + public void add(VideoResourcePlayVersionMap map) throws Exception; + + /** + * 鏍规嵁绯荤粺鍜岀増鏈煡璇� + * + * @param detailSystemId + * @param version + * @return + */ + public List<VideoResourcePlayVersionMap> list(String detailSystemId, Integer version, String channel); + + /** + * 鏍规嵁绯荤粺鍜岀増鏈煡璇esourceId + * + * @param detailSystemId + * @param version + * @return + */ + public List<String> listResourceId(String detailSystemId, Integer version, String channel); + +} diff --git a/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java b/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java index 9fc99e3..aaf721d 100644 --- a/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java +++ b/src/main/java/com/yeshi/buwan/service/inter/video/VideoResourceVersionMapService.java @@ -32,4 +32,10 @@ */ public List<String> listResourceId(String detailSystemId, Integer version,String channel); + + + public List<VideoResourceVersionMap> listAll(); + + + } diff --git a/src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java b/src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java index dd8a86c..bdb969c 100644 --- a/src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java +++ b/src/main/java/com/yeshi/buwan/service/manager/search/SolrInternetSearchVideoDataManager.java @@ -99,10 +99,14 @@ Query query = null; if (!StringUtil.isNullOrEmpty(filter.getKey())) { //solr绮惧噯妫�绱㈤渶瑕佸甫寮曞彿 - try { - query = new SimpleQuery(new Criteria("nameStr").startsWith(key).or("actors").expression("\"" + key + "\"")); - } catch (InvalidDataAccessApiUsageException e) { - query = new SimpleQuery(new Criteria("name").expression("\"" + key + "\"")); + if (filter.isFuzzy()) { + query = new SimpleQuery(new Criteria("name").expression(filter.getKey())); + } else { + try { + query = new SimpleQuery(new Criteria("nameStr").startsWith(key).or("actors").expression("\"" + key + "\"")); + } catch (InvalidDataAccessApiUsageException e) { + query = new SimpleQuery(new Criteria("name").expression("\"" + key + "\"")); + } } } else if (!StringUtil.isNullOrEmpty(filter.getActor())) { diff --git a/src/main/java/com/yeshi/buwan/util/DouBanUtil.java b/src/main/java/com/yeshi/buwan/util/DouBanUtil.java index 47b17c5..3fdb58d 100644 --- a/src/main/java/com/yeshi/buwan/util/DouBanUtil.java +++ b/src/main/java/com/yeshi/buwan/util/DouBanUtil.java @@ -18,162 +18,305 @@ @Entity public class DouBanUtil { - public static String baseUrl = "https://movie.douban.com/subject_search?cat=102&"; - public static int maxCount = 1; + public static String baseUrl = "https://movie.douban.com/subject_search?cat=102&"; + public static int maxCount = 1; - public static List<VideoInfo> startSearch(String st) throws IOException { - Document doc = Jsoup - .connect( - baseUrl + "search_text=" - + URLEncoder.encode(st, "UTF-8")) - .userAgent( - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") - .timeout(20000).get(); - Element el = doc.getElementById("content"); - Elements els = el.getElementsByTag("table"); - List<VideoInfo> list = new ArrayList<VideoInfo>(); - int count = els.size() >= maxCount ? maxCount : els.size(); + /** + * @title: + * @description: 鎼滅储 + * @author Administrator + * @date 2021/9/22 17:46 + */ + public static List<VideoInfo> startSearch(String st) throws IOException { + Document doc = Jsoup + .connect( + baseUrl + "search_text=" + + URLEncoder.encode(st, "UTF-8")) + .userAgent( + "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") + .timeout(20000).get(); + Element el = doc.getElementById("content"); + Elements els = el.getElementsByTag("table"); + List<VideoInfo> list = new ArrayList<VideoInfo>(); + int count = els.size() >= maxCount ? maxCount : els.size(); - for (int i = 0; i < count; i++) { - try { - String url = els.get(i).getElementsByTag("a").get(0) - .attr("href"); - LogUtil.i(url); - Document detailDoc = Jsoup - .connect(url) - .timeout(20000) - .userAgent( - "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") - .get(); - Element detail = detailDoc.getElementById("content"); - Element vinfo = detailDoc.getElementById("info"); + for (int i = 0; i < count; i++) { + try { + String url = els.get(i).getElementsByTag("a").get(0) + .attr("href"); + LogUtil.i(url); + Document detailDoc = Jsoup + .connect(url) + .timeout(20000) + .userAgent( + "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36") + .get(); + Element detail = detailDoc.getElementById("content"); + Element vinfo = detailDoc.getElementById("info"); - String name = detail.getElementsByTag("h1").get(0) - .getElementsByTag("span").get(0).text(); + String name = detail.getElementsByTag("h1").get(0) + .getElementsByTag("span").get(0).text(); - String year = ""; - String picture = detail.getElementById("mainpic") - .getElementsByTag("img").get(0).attr("src") - .replace("/spst/", "/lpst/"); - String actor = ""; - try { - Elements actors = detail - .getElementsByAttributeValue("class", "actor") - .get(0) - .getElementsByAttributeValue("class", "attrs") - .get(0).getElementsByTag("span").get(0) - .getElementsByTag("a"); + String year = ""; + String picture = detail.getElementById("mainpic") + .getElementsByTag("img").get(0).attr("src") + .replace("/spst/", "/lpst/"); + String actor = ""; + try { + Elements actors = detail + .getElementsByAttributeValue("class", "actor") + .get(0) + .getElementsByAttributeValue("class", "attrs") + .get(0).getElementsByTag("span").get(0) + .getElementsByTag("a"); - for (Element w : actors) { - actor += w.text() + " "; - } - } catch (Exception e) { - // e.printStackTrace(); - } - Elements beiz = detail.getElementsByAttributeValue("property", - "v:genre"); - String beizhu = ""; - for (Element e : beiz) { - beizhu += e.text() + " "; - } + for (Element w : actors) { + actor += w.text() + " "; + } + } catch (Exception e) { + // e.printStackTrace(); + } + Elements beiz = detail.getElementsByAttributeValue("property", + "v:genre"); + String beizhu = ""; + for (Element e : beiz) { + beizhu += e.text() + " "; + } - String duration = "0"; - try { - detail.getElementsByAttributeValue("property", "v:runtime") - .get(0).attr("content"); - } catch (Exception e) { + String duration = "0"; + try { + detail.getElementsByAttributeValue("property", "v:runtime") + .get(0).attr("content"); + } catch (Exception e) { - } - String introduction = ""; - try { - introduction = detailDoc - .getElementsByAttributeValue("property", - "v:summary").get(0).text(); - } catch (Exception e) { + } + String introduction = ""; + try { + introduction = detailDoc + .getElementsByAttributeValue("property", + "v:summary").get(0).text(); + } catch (Exception e) { - } - String score = detailDoc - .getElementsByAttributeValue("property", "v:average") - .get(0).text(); + } + String score = detailDoc + .getElementsByAttributeValue("property", "v:average") + .get(0).text(); - String data = ""; - try { - data = detailDoc - .getElementsByAttributeValue("property", - "v:initialReleaseDate").get(0).text(); - } catch (Exception e) { + String data = ""; + try { + data = detailDoc + .getElementsByAttributeValue("property", + "v:initialReleaseDate").get(0).text(); + } catch (Exception e) { - } - try { - score = detail - .getElementsByAttributeValue("property", - "v:average").get(0).text(); - } catch (Exception e) { + } + try { + score = detail + .getElementsByAttributeValue("property", + "v:average").get(0).text(); + } catch (Exception e) { - } - String director = ""; - try { - Elements directors = detail.getElementsByAttributeValue( - "rel", "v:directedBy"); - for (int n = 0; n < directors.size(); n++) { - director += directors.get(n).text() + " "; - } + } + String director = ""; + try { + Elements directors = detail.getElementsByAttributeValue( + "rel", "v:directedBy"); + for (int n = 0; n < directors.size(); n++) { + director += directors.get(n).text() + " "; + } - } catch (Exception e) { + } catch (Exception e) { - } + } - if (director.endsWith(" ")) - director = director.substring(0, director.length() - 1); - Pattern pattern = Pattern - .compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}"); - Matcher matcher = pattern.matcher(data); - String dateStr = null; - if (matcher.find()) { - dateStr = matcher.group(0); - } - String month = "0"; - String day = "0"; - if (dateStr != null) { - year = dateStr.split("-")[0]; - month = dateStr.split("-")[1]; - day = dateStr.split("-")[2]; - } - String area =""; - String[] infoSt = vinfo.toString().split("<br />"); - for (String ist : infoSt) { - if (ist.contains("锟斤拷片锟斤拷锟�")) { - try{ - int start = ist.indexOf("</span>"); - area = ist.substring(start + 7, ist.length()) - .replace("\"", "").trim(); - System.out.println(area); - }catch(Exception e) - { - e.printStackTrace(); - } - break; - } - } + if (director.endsWith(" ")) + director = director.substring(0, director.length() - 1); + Pattern pattern = Pattern + .compile("[0-9]{4}[-][0-9]{1,2}[-][0-9]{1,2}"); + Matcher matcher = pattern.matcher(data); + String dateStr = null; + if (matcher.find()) { + dateStr = matcher.group(0); + } + String month = "0"; + String day = "0"; + if (dateStr != null) { + year = dateStr.split("-")[0]; + month = dateStr.split("-")[1]; + day = dateStr.split("-")[2]; + } + String area = ""; + String[] infoSt = vinfo.toString().split("<br />"); + for (String ist : infoSt) { + if (ist.contains("锟斤拷片锟斤拷锟�")) { + try { + int start = ist.indexOf("</span>"); + area = ist.substring(start + 7, ist.length()) + .replace("\"", "").trim(); + System.out.println(area); + } catch (Exception e) { + e.printStackTrace(); + } + break; + } + } - VideoInfo info = new VideoInfo(); - info.setName(name); - info.setBeizhu(beizhu); - info.setDuration(duration); - info.setIntroduction(introduction); - info.setMainActor(actor); - info.setPicture(picture); - info.setScore(score); - info.setYear(year); - info.setDay(day); - info.setMonth(month); - info.setDirector(director); - info.setArea(area); - list.add(info); - } catch (Exception e) { - e.printStackTrace(); - } - } - return list; - } + VideoInfo info = new VideoInfo(); + info.setName(name); + info.setBeizhu(beizhu); + info.setDuration(duration); + info.setIntroduction(introduction); + info.setMainActor(actor); + info.setPicture(picture); + info.setScore(score); + info.setYear(year); + info.setDay(day); + info.setMonth(month); + info.setDirector(director); + info.setArea(area); + list.add(info); + } catch (Exception e) { + e.printStackTrace(); + } + } + return list; + } + + private static DouBanStar getStarInfo(Element item) { + DouBanStar star = new DouBanStar(); + String avatarStyle = item.getElementsByClass("avatar").get(0).attr("style"); + String avatar = avatarStyle.replace("background-image: url(", "").replace(")", "").trim(); + String name = item.getElementsByTag("a").get(0).attr("title"); + if (name.contains(" ")) { + String chaineseName = name.split(" ")[0].trim(); + String englishName = name.substring(chaineseName.length()).trim(); + star.setChineseName(chaineseName); + star.setEnglishName(englishName); + } + + String href = item.getElementsByTag("a").get(0).attr("href"); + if (href.endsWith("/")) + href = href.substring(0, href.length() - 1); + String[] sts = href.split("/"); + String id = sts[sts.length - 1]; + if (!avatar.contains("default")) + star.setAvatar(avatar); + star.setId(id); + star.setUrl(href); + return star; + } + + private static List<DouBanStar> getStarList(Element root) { + Elements items = root.getElementsByTag("li"); + List<DouBanStar> list = new ArrayList<>(); + for (int i = 0; i < items.size(); i++) { + Element item = items.get(i); + DouBanStar star = getStarInfo(item); + if (star != null) { + list.add(star); + } + } + return list; + } + + //鑾峰彇鐢靛奖鐨勫奖浜轰俊鎭� + public static Celebrities getMovieStars(String movieId) throws IOException { + String url = String.format("https://movie.douban.com/subject/%s/celebrities", movieId); + Document doc = Jsoup.connect(url).timeout(60000).userAgent("Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.81 Safari/537.36").get(); + + Elements eles = doc.getElementById("celebrities").getElementsByClass("list-wrapper"); + + Celebrities celebrities = new Celebrities(); + + for (int i = 0; i < eles.size(); i++) { + String type = eles.get(i).getElementsByTag("h2").get(0).ownText(); + if (type.contains("瀵兼紨")) { + List<DouBanStar> list = getStarList(eles.get(i)); + celebrities.setDirectors(list); + } else if (type.contains("婕斿憳")) { + List<DouBanStar> list = getStarList(eles.get(i)); + celebrities.setStars(list); + } + } + return celebrities; + } + + + static class Celebrities { + + private List<DouBanStar> directors; + private List<DouBanStar> stars; + + public List<DouBanStar> getDirectors() { + return directors; + } + + public void setDirectors(List<DouBanStar> directors) { + this.directors = directors; + } + + public List<DouBanStar> getStars() { + return stars; + } + + public void setStars(List<DouBanStar> stars) { + this.stars = stars; + } + } + + + static class DouBanStar { + + private String id; + private String chineseName; + private String englishName; + private String avatar; + private String url; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getChineseName() { + return chineseName; + } + + public void setChineseName(String chineseName) { + this.chineseName = chineseName; + } + + public String getEnglishName() { + return englishName; + } + + public void setEnglishName(String englishName) { + this.englishName = englishName; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + } + + + public static void main(String[] args) throws IOException { + getMovieStars("26309788"); + } + } diff --git a/src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java b/src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java index de21a4b..05f11d1 100644 --- a/src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java +++ b/src/main/java/com/yeshi/buwan/util/JuHe/VideoResourceUtil.java @@ -1,6 +1,7 @@ package com.yeshi.buwan.util.JuHe; import com.yeshi.buwan.domain.system.DetailSystem; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Component; @@ -14,6 +15,9 @@ @Resource private VideoResourceVersionMapService videoResourceVersionMapService; + @Resource + private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService; + @Cacheable(value = "homeCache", key = "'getAvailableResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel") public List<Long> getAvailableResourceIds(DetailSystem detailSystem, int versionCode,String channel) { List<String> ridList = videoResourceVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel); @@ -34,4 +38,18 @@ } + @Cacheable(value = "homeCache", key = "'getAvailablePlayResourceIds-'+'-'+#detailSystem.id+'-'+#versionCode+'-'+#channel") + public List<Long> getAvailablePlayResourceIds(DetailSystem detailSystem, int versionCode,String channel) { + List<String> ridList = videoResourcePlayVersionMapService.listResourceId(detailSystem.getId(), versionCode,channel); + List<Long> ids = new ArrayList<>(); + if (ridList != null) { + for (String id : ridList) { + ids.add(Long.parseLong(id)); + } + } + + return ids; + } + + } diff --git a/src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java b/src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java new file mode 100644 index 0000000..5102008 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/util/tvlive/DianShiMaoUtil.java @@ -0,0 +1,113 @@ +package com.yeshi.buwan.util.tvlive; + +import com.yeshi.buwan.domain.live.TVLiveChannel; +import com.yeshi.buwan.util.NumberUtil; +import com.yeshi.buwan.util.StringUtil; +import net.sf.json.JSONArray; +import org.apache.commons.io.IOUtils; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; +import org.yeshi.utils.HttpUtil; + +import javax.script.Invocable; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鐢佃鐚府鍔╃被 + */ +public class DianShiMaoUtil { + + private static ScriptEngine jsEngine; + + static { + ScriptEngineManager manager = new ScriptEngineManager(); + jsEngine = manager.getEngineByName("javascript"); + InputStream scriptStream = DianShiMaoUtil.class.getClassLoader().getResourceAsStream("script\\tvlive\\dianshimao_program.js"); + try { + String script = IOUtils.toString(scriptStream); + jsEngine.eval(script); + } catch (ScriptException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + + /** + * 鑾峰彇褰撴棩鐢佃鑺傜洰琛ㄥ崟 + * + * @param url 濡傦細https://www.tvmao.com/program/CCTV-CCTV1-w4.html + * @return + */ + public static List<TVLiveChannel.TVLiveProgram> getProgramList(String url) throws Exception { + String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"; + Document doc = Jsoup.connect(url).userAgent(userAgent).referrer(url).timeout(60000).get(); + List<TVLiveChannel.TVLiveProgram> list = new ArrayList<>(); + Element pgrow = doc.getElementById("pgrow"); + Elements items = pgrow.getElementsByClass("over_hide"); + for (int i = 0; i < items.size(); i++) { + list.add(parseProgram(items.get(i))); + } + + //涓嬩竴椤电殑鏁版嵁 + Element form = doc.getElementsByTag("form").get(0); + String q = form.attr("q"); + String a = form.attr("a"); + String id = form.getElementsByTag("button").get(0).attr("id"); + //璁$畻涓嬩竴椤佃姹傞摼鎺ヤ腑鐨刾鍙傛暟 + Invocable in = (Invocable) jsEngine; + Object data = in.invokeFunction("f", q, a, id); + String p = data.toString(); + String nextUrl = "https://www.tvmao.com/api/pg?p=" + URLEncoder.encode(p, "UTF-8"); + Map<String, String> headers = new HashMap<>(); + headers.put("User-Agent",userAgent); + headers.put("Referer", url); + String result = HttpUtil.get(nextUrl, headers); + //瑙f瀽涓嬩竴椤电殑缁撴灉 + JSONArray array = JSONArray.fromObject(result); + String script = array.optString(1); + doc = Jsoup.parse(script); + items = doc.getElementsByClass("over_hide"); + if(items==null||items.size()<=0){ + throw new Exception("鑾峰彇涓嬩竴椤佃祫婧愬嚭閿�"); + } + for (int i = 0; i < items.size(); i++) { + list.add(parseProgram(items.get(i))); + } + return list; + } + + private static TVLiveChannel.TVLiveProgram parseProgram(Element item) throws Exception { + String name = item.getElementsByClass("p_show").get(0).text().trim(); + String time = item.getElementsByTag("span").get(0).text().trim(); + + if (StringUtil.isNullOrEmpty(name)) { + throw new Exception("鑺傜洰鍚嶇О涓虹┖"); + } + if (!time.contains(":") || !NumberUtil.isNumeric(time.replace(":", ""))) { + throw new Exception("鏃堕棿鏍煎紡閿欒"); + } + return new TVLiveChannel.TVLiveProgram(time, name); + } + + public static void main(String[] args) throws Exception { + + getProgramList("https://www.tvmao.com/program/CCTV-CCTV2-w4.html"); + + + } + + +} diff --git a/src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java b/src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java new file mode 100644 index 0000000..7682ea4 --- /dev/null +++ b/src/main/java/com/yeshi/buwan/util/tvlive/TVChannelUtil.java @@ -0,0 +1,38 @@ +package com.yeshi.buwan.util.tvlive; + +import com.yeshi.buwan.domain.live.TVLiveChannel; +import com.yeshi.buwan.util.TimeUtil; + +import java.util.Date; +import java.util.List; + +public class TVChannelUtil { + + public static TVLiveChannel.TVLiveProgram[] getNowProgram(Date nowTime, List<TVLiveChannel.TVLiveProgram> programList) { + + if (programList == null || programList.size() <= 1) + return null; + + String today = TimeUtil.getGernalTime(nowTime.getTime(), "yyyyMMdd"); + String tomorrow = TimeUtil.getGernalTime(nowTime.getTime() + 1000 * 60 * 60 * 24L, "yyyyMMdd"); + for (int i = 0; i < programList.size(); i++) { + Date d1 = new Date(TimeUtil.convertGernalTime(today + programList.get(i).getTime(), "yyyyMMddHH:mm")); + Date d2 = null; + if (i + 1 >= programList.size()) { + d2 = new Date(TimeUtil.convertGernalTime(tomorrow + programList.get(0).getTime(), "yyyyMMddHH:mm")); + } else { + d2 = new Date(TimeUtil.convertGernalTime(today + programList.get(i + 1).getTime(), "yyyyMMddHH:mm")); + } + if (nowTime.getTime() >= d1.getTime() && nowTime.getTime() < d2.getTime()) { + if (i < programList.size() - 1) { + return new TVLiveChannel.TVLiveProgram[]{programList.get(i), programList.get(i + 1)}; + } else { + return new TVLiveChannel.TVLiveProgram[]{programList.get(i)}; + } + } + } + + return null; + } + +} diff --git a/src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java b/src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java new file mode 100644 index 0000000..7f1c4bb --- /dev/null +++ b/src/main/java/com/yeshi/buwan/util/tvlive/TVSOUUtil.java @@ -0,0 +1,54 @@ +package com.yeshi.buwan.util.tvlive; + +import com.yeshi.buwan.domain.live.TVLiveChannel; +import com.yeshi.buwan.util.NumberUtil; +import com.yeshi.buwan.util.StringUtil; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.select.Elements; + +import java.util.ArrayList; +import java.util.List; + +/** + * 鎼滆缃� + */ +public class TVSOUUtil { + + public static List<TVLiveChannel.TVLiveProgram> getProgramList(String url) throws Exception { + String userAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36"; + Document doc = Jsoup.connect(url).userAgent(userAgent).referrer(url).timeout(60000).get(); + List<TVLiveChannel.TVLiveProgram> list = new ArrayList<>(); + Element pgrow = doc.getElementsByClass("c_main_section").get(0).getElementsByClass("tab_nav").get(0).getElementsByTag("table").get(0); + Elements items = pgrow.getElementsByTag("tr"); + for (int i = 0; i < items.size(); i++) { + list.add(parseProgram(items.get(i))); + } + + return list; + } + + + private static TVLiveChannel.TVLiveProgram parseProgram(Element item) throws Exception { + String name = item.getElementsByTag("td").get(1).text().trim(); + String time = item.getElementsByTag("td").get(0).text().trim(); + + if (StringUtil.isNullOrEmpty(name)) { + throw new Exception("鑺傜洰鍚嶇О涓虹┖"); + } + if (!time.contains(":") || !NumberUtil.isNumeric(time.replace(":", ""))) { + throw new Exception("鏃堕棿鏍煎紡閿欒"); + } + return new TVLiveChannel.TVLiveProgram(time, name); + } + + public static void main(String[] args) throws Exception { + + getProgramList("https://www.tvsou.com/epg/yangshi/"); + + + } + + +} diff --git a/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java b/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java index e070f78..720e677 100644 --- a/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java +++ b/src/main/java/com/yeshi/buwan/util/video/VideoDetailUtil.java @@ -1,5 +1,9 @@ package com.yeshi.buwan.util.video; +import com.yeshi.buwan.domain.system.DetailSystem; +import com.yeshi.buwan.exception.video.VideoPlayException; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; +import com.yeshi.buwan.util.JuHe.VideoResourceUtil; import com.yeshi.buwan.videos.acFun.AcFunUtil; import com.yeshi.buwan.dao.VideoInfoDao; import com.yeshi.buwan.domain.*; @@ -296,10 +300,21 @@ @Resource private VideoResourceService videoResourceService; + @Resource + private VideoResourceUtil videoResourceUtil; + @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") - public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) { + public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, String id, String type, int resourceid, String videoid) throws VideoPlayException { playLogger.info(VideoLogFactory.createPlayUrlLog(detailSystemId, id, type, resourceid, videoid)); + //鍒ゆ柇resourceId鏄惁鍦ㄥ厑璁告挱鏀剧殑鏉ユ簮鍒楄〃涓� + + List<Long> resourceIds = videoResourceUtil.getAvailablePlayResourceIds(new DetailSystem(detailSystemId), acceptData.getVersion(), acceptData.getChannel()); + if (resourceIds == null || !resourceIds.contains(Long.parseLong(resourceid + ""))) { + throw new VideoPlayException(1, "鎸囧畾鎾斁婧愭棤娉曟挱鏀�"); + } + + if (VideoUtil.getVideoFromType(id) == HomeVideo.FROM_TYPE_SHORT) { VideoResource vr = videoResourceService.getResource(resourceid + ""); return solrShortVideoDataManager.getPlayUrl(id, vr); @@ -329,7 +344,7 @@ case HanmiUtil.RESOURCE_ID: return hanmiService.getPlayUrl(detailSystemId, resourceid, id, videoid); default: - return null; + throw new VideoPlayException(2, "鏈煡鎾斁婧�"); } } diff --git a/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java b/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java new file mode 100644 index 0000000..3f6106b --- /dev/null +++ b/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelResourceMapAdminVO.java @@ -0,0 +1,63 @@ +package com.yeshi.buwan.vo.tvlive; + +import com.yeshi.buwan.domain.live.TVLiveChannelResourceMap; +import com.yeshi.buwan.domain.live.TVLiveResource; + +/** + * 鐢佃棰戦亾璧勬簮 + */ +public class TVLiveChannelResourceMapAdminVO { + + private String id; + private String playUrl; + private String name; + private int weight; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPlayUrl() { + return playUrl; + } + + public void setPlayUrl(String playUrl) { + this.playUrl = playUrl; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getWeight() { + return weight; + } + + public void setWeight(int weight) { + this.weight = weight; + } + + public static TVLiveChannelResourceMapAdminVO create(TVLiveChannelResourceMap map) { + if (map == null) { + return null; + } + TVLiveChannelResourceMapAdminVO vo = new TVLiveChannelResourceMapAdminVO(); + if (map.getResource() == TVLiveResource.migu) { + vo.setName("鍜挄"); + } else { + vo.setName(map.getSubResourceName()); + } + vo.setId(map.getId()); + vo.setPlayUrl(map.getPlayUrl()); + vo.setWeight(map.getWeight()); + return vo; + } +} diff --git a/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java b/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java index a5fdde2..adf0beb 100644 --- a/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java +++ b/src/main/java/com/yeshi/buwan/vo/tvlive/TVLiveChannelVO.java @@ -2,6 +2,9 @@ import com.yeshi.buwan.domain.live.TVLiveChannel; import com.yeshi.buwan.util.StringUtil; +import com.yeshi.buwan.util.tvlive.TVChannelUtil; + +import java.util.Date; public class TVLiveChannelVO { @@ -17,17 +20,19 @@ vo.setName(tvLiveChannel.getName()); vo.setPicture(tvLiveChannel.gethPicture()); - if (!StringUtil.isNullOrEmpty(tvLiveChannel.getNowProgram()) && !StringUtil.isNullOrEmpty(tvLiveChannel.getNowProgramTime())) { - vo.setNowProgram(tvLiveChannel.getNowProgramTime() + " " + tvLiveChannel.getNowProgram()); + TVLiveChannel.TVLiveProgram[] programs = TVChannelUtil.getNowProgram(new Date(), tvLiveChannel.getProgramList()); + + if (programs != null && programs.length > 0) { + vo.setNowProgram(programs[0].getTime() + " " + programs[0].getName()); } else { vo.setNowProgram("鏆傛棤鑺傜洰淇℃伅"); } - if (!StringUtil.isNullOrEmpty(tvLiveChannel.getNextProgram()) && !StringUtil.isNullOrEmpty(tvLiveChannel.getNextProgramTime())) { - vo.setNowProgram(tvLiveChannel.getNextProgramTime() + " " + tvLiveChannel.getNextProgram()); + if (programs != null && programs.length > 1) { + vo.setNextProgram(programs[1].getTime() + " " + programs[1].getName()); } else { - vo.setNowProgram("鏆傛棤鑺傜洰淇℃伅"); + vo.setNextProgram("鏆傛棤鑺傜洰淇℃伅"); } return vo; } diff --git a/src/main/resources/script/tvlive/dianshimao_program.js b/src/main/resources/script/tvlive/dianshimao_program.js new file mode 100644 index 0000000..d736c10 --- /dev/null +++ b/src/main/resources/script/tvlive/dianshimao_program.js @@ -0,0 +1,30 @@ +var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + +function J(a) { + var b = '', + i = 0, + c, chr2, chr3, enc1, enc2, enc3, enc4; + while (i < a.length) { + c = a.charCodeAt(i++); + chr2 = a.charCodeAt(i++); + chr3 = a.charCodeAt(i++); + enc1 = c >> 2; + enc2 = ((c & 3) << 4) | (chr2 >> 4); + enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); + enc4 = chr3 & 63; + if (isNaN(chr2)) { + enc3 = enc4 = 64 + } else if (isNaN(chr3)) { + enc4 = 64 + } + b = b + keyStr.charAt(enc1) + keyStr.charAt(enc2) + keyStr.charAt(enc3) + keyStr.charAt(enc4) + } + return b +}; + +function f(q, a, id) { + var b = new Date(); + var d = b.getDay(); + var w = d == 0 ? 7 : d; + return keyStr.charAt(w * w) + J(id + '|' + a) + J('|' + q) +} \ No newline at end of file diff --git a/src/main/webapp/admin/new/js/navsetting.xml b/src/main/webapp/admin/new/js/navsetting.xml index 8335250..a840a48 100644 --- a/src/main/webapp/admin/new/js/navsetting.xml +++ b/src/main/webapp/admin/new/js/navsetting.xml @@ -137,6 +137,7 @@ <secondNav url="tvlive_channel_list.html" name="棰戦亾鍒楄〃"> <!-- 缃戦〉閾炬帴 --> <url>tvlive_channel_add.html</url> + <url>tvlive_channel_resource.html</url> </secondNav> </topNav> diff --git a/src/main/webapp/admin/new/tvlive_category_add.html b/src/main/webapp/admin/new/tvlive_category_add.html index 56fa655..45910bc 100644 --- a/src/main/webapp/admin/new/tvlive_category_add.html +++ b/src/main/webapp/admin/new/tvlive_category_add.html @@ -5,7 +5,7 @@ <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="referrer" content="never"> - <title>娣诲姞椤堕儴鏍囩</title> + <title>娣诲姞鐩存挱棰戦亾</title> <link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/maincontent.css" rel="stylesheet"> <link href="css/tablestyle.css" rel="stylesheet"> diff --git a/src/main/webapp/admin/new/tvlive_category_channel_list.html b/src/main/webapp/admin/new/tvlive_category_channel_list.html index 297cb72..526d7ee 100644 --- a/src/main/webapp/admin/new/tvlive_category_channel_list.html +++ b/src/main/webapp/admin/new/tvlive_category_channel_list.html @@ -120,7 +120,7 @@ </td> <td> <div class="bianhao name"> - <a href="#">{{item.name}}</a> + <a v-bind:href="'tvlive_channel_resource.html?id='+item.id">{{item.name}}</a> </div> </td> diff --git a/src/main/webapp/admin/new/tvlive_channel_add.html b/src/main/webapp/admin/new/tvlive_channel_add.html new file mode 100644 index 0000000..338690c --- /dev/null +++ b/src/main/webapp/admin/new/tvlive_channel_add.html @@ -0,0 +1,110 @@ +<html lang="zh-cn"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>娣诲姞椤堕儴鏍囩</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <link href="css/tablestyle.css" rel="stylesheet"> + <style> + .form-group { + margin-bottom: 30px; + } + + .checkbox input[type=checkbox] { + top: 6px; + } + </style> +</head> + +<body> +<nav class="navbar navbar-default navbar-fixed-top"> +</nav> +<div id="mainbody"> + <div id="sidebar"> + <dl> + </dl> + </div> + <div id="neirong"> + <div class="erjidh"> + <ol class="breadcrumb"> + <li> + <a href="tvlive_channel_list.html">鐢佃鐩存挱棰戦亾</a> + </li> + <li class="active">娣诲姞棰戦亾</li> + </ol> + </div> + <form class="form-horizontal" role="form"> + <div class="form-group"> + <label for="input1" class="changdu1 control-label">鍚嶇О</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="name" placeholder="蹇呴』濉啓"> + </div> + </div> + + + <div class="form-group"> + <label for="input1" class="changdu1 control-label">妯浘</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="hPicture" placeholder="蹇呴』濉啓"> + </div> + </div> + + <div class="form-group"> + <label for="input1" class="changdu1 control-label">绔栧浘</label> + <div class="col-sm-7"> + <input type="text" class="form-control" id="vPicture" placeholder="鍙笉濉�"> + </div> + </div> + + <div class="button0"> + <div class="button"> + <button type="button" class="btn btn-primary save">淇濆瓨</button> + </div> + <div class="button"> + <input type="reset" class="btn btn-default" value="閲嶇疆"/> + </div> + </div> + </form> + + </div> +</div> + +<script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> +<script src="js/bootstrap.min.js"></script> +<script src="js/nav.js"></script> +<script src="js/common.js"></script> +<script src="layer/layer.js"></script> +<script> + $(function () { + $(".save").click(function () { + var index = layer.load(0, { + 'shade': false + }); + $.post('api/tvlive/channel/addChannel', { + 'name': $("#name").val(), + 'hPicture': $("#hPicture").val(), + 'vPicture': $("#vPicture").val(), + }, function (data) { + layer.close(index); + if (data.code == 0) { + layer.msg("娣诲姞鎴愬姛"); + } else { + layer.msg(data.msg); + } + + doResponse(data, function () { + + }); + }, 'json'); + + }); + + }); +</script> +</body> + +</html> \ No newline at end of file diff --git a/src/main/webapp/admin/new/tvlive_channel_list.html b/src/main/webapp/admin/new/tvlive_channel_list.html index ea9db5a..abf6ff2 100644 --- a/src/main/webapp/admin/new/tvlive_channel_list.html +++ b/src/main/webapp/admin/new/tvlive_channel_list.html @@ -59,7 +59,7 @@ <button type="button" class="btn btn-default search-button">鎼滅储</button> <div class="tianjia" class="search"> - <a href="add-tuijian-home-labels.html" class="btn btn-primary" role="button">娣诲姞鏍囩 +</a> + <a href="tvlive_channel_add.html" class="btn btn-primary" role="button">娣诲姞棰戦亾 +</a> </div> </div> @@ -168,7 +168,19 @@ <td class=""> - <div class="btn btn-primary" v-on:click="showCategorySelect(item.id)">娣诲姞鍒板垎绫�</div> + <!--<div class="btn btn-primary" v-on:click="showCategorySelect(item.id)">娣诲姞鍒板垎绫�</div>--> + <!--<div class="btn btn-primary" style="margin-top: 10px;" v-on:click="showCategorySelect(item.id)">鏉ユ簮绠$悊</div>--> + <!-- Single button --> + <div class="btn-group"> + <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + 鎿嶄綔 <span class="caret"></span> + </button> + <ul class="dropdown-menu"> + <li><a href="#" v-on:click="showCategorySelect(item.id)">娣诲姞鍒板垎绫�</a></li> + <li><a v-bind:href="'tvlive_channel_resource.html?id='+item.id">鏉ユ簮绠$悊</a></li> + </ul> + </div> + </td> <td> diff --git a/src/main/webapp/admin/new/tvlive_channel_resource.html b/src/main/webapp/admin/new/tvlive_channel_resource.html new file mode 100644 index 0000000..f355816 --- /dev/null +++ b/src/main/webapp/admin/new/tvlive_channel_resource.html @@ -0,0 +1,235 @@ +<html lang="zh-cn"> + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="referrer" content="never"> + <title>鐢佃鐩存挱-棰戦亾鍒楄〃</title> + <link href="css/bootstrap.min.css" rel="stylesheet"> + <link href="css/maincontent.css" rel="stylesheet"> + <style> + + .content-container .container { + min-height: 200px; + background: white; + padding-top: 10px; + + } + + .btn-delete { + float: left; + margin-bottom: 0; + margin-left: 20px; + } + + .form-item { + margin-bottom: 10px; + display: block !important; + } + + .btn-sure { + margin-top: 10px; + } + + + </style> + +</head> + +<body> +<nav class="navbar navbar-default navbar-fixed-top"> + +</nav> +<div id="mainbody"> + <div id="sidebar"> + + </div> + <div id="neirong"> + + <ul class="nav nav-tabs"> + <li v-for="item,index in list" role="presentation" v-bind:class="{active:selectIndex==index}" + v-on:click="selectResource(index)"><a href="#">{{item.name}}</a> + </li> + <a href="#"> + <button class="btn btn-primary" v-on:click="addResource"> + <span class="glyphicon glyphicon-plus"></span> + 娣诲姞 + </button> + </a> + + </ul> + + + <div class="content-container"> + + <div v-for="item,index in list" class="container" + v-bind:style="{'display':selectIndex==index?'block':'none'}"> + + <div class="col-lg-6 form-item"> + <div class="input-group"> + <span class="input-group-btn"> + <button class="btn btn-default" type="button">鎾斁閾炬帴</button> + </span> + <input type="text" :readonly="item.name=='鍜挄'?true:false" v-model="item.playUrl" + class="form-control" + placeholder="璇疯緭鍏ュ畬鏁寸殑鎾斁閾炬帴"> + </div> + </div> + + <div class="col-lg-3 form-item"> + <div class="input-group"> + <span class="input-group-btn"> + <button class="btn btn-default" type="button">鏉冮噸</button> + </span> + <input type="text" v-model="item.weight" + class="form-control" + placeholder="璇疯緭鍏ユ帓搴忔潈閲嶏紙姝f暣鏁帮級"> + </div> + </div> + + <div style="clear: both;"></div> + + <button class="btn btn-danger btn-delete" v-on:click="deleteResource(index)">鍒犻櫎</button> + + </div> + + <button class="btn btn-primary btn-sure" v-on:click="sure">纭畾</button> + </div> + + + </div> + + + <script src="//cdn.bootcss.com/jquery/1.10.1/jquery.min.js"></script> + <script src="js/bootstrap.min.js"></script> + <script src="js/page.js"></script> + <script src="js/nav.js"></script> + <script src="js/common.js"></script> + <script src="js/vue.min.js"></script> + <script src="layer/layer.js"></script> + <script> + $(function () { + + function getQueryString(name) { + var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); + var r = window.location.search.substr(1).match(reg); + if (r != null) return unescape(r[2]); + return null; + }; + + const channelId = getQueryString("id"); + + var app = new Vue({ + el: "#neirong", + data: { + list: [], + selectIndex: 0, + }, + methods: { + resourceList: function () { + var index = layer.load(1, { + shade: false + }) + + $.post('api/tvlive/channel/getChannelResourceList', {id: channelId}, function (data) { + layer.close(index); + if (data.code != 0) + return; + app.list = data.data.data; + }, 'json'); + }, + addResource: function () { + layer.prompt({title: '璇疯緭鍏ユ潵婧愬悕绉�', formType: 3}, function (text, index) { + layer.close(index); + if (text && text.length > 0) { + app.list.push({name: text}); + if (app.selectIndex < 0) { + app.selectIndex = 0; + } + } + }); + }, + selectResource: function (index) { + app.selectIndex = index; + }, + + deleteResource: function (index) { + app.list.splice(index, 1); + console.log(app.selectIndex + ":" + app.list.length); + if (app.selectIndex >= app.list.length) { + app.selectIndex = app.list.length - 1; + } + }, + sure: function () { + layer.confirm('鏄惁纭畾鏇存敼锛�', { + btn: ['纭畾', '鍙栨秷'] //鎸夐挳 + }, function () { + var index = layer.load(1, { + shade: false + }) + $.post('api/tvlive/channel/updateChannelResources', { + id: channelId, + resources: JSON.stringify(app.list) + }, function (data) { + layer.close(index); + if (data.code != 0) { + layer.msg(data.msg); + } else { + layer.alert("鏇存敼鎴愬姛"); + window.refresh(); + } + + }, 'json'); + }, function () { + + }); + + + }, + + deleteSpecial: function (id, index) { + var indexDialog = layer.confirm('鏄惁鍒犻櫎璇ユ潯鐩紵', { + btn: ['鏄�', '鍚�'] //鎸夐挳 + }, function () { + $.post('api/homerecommend/deleteSpcial', { + 'ids': id + }, function (data) { + layer.close(indexDialog); + if (data.code == 0) { + if (index > -1) { + app.list.splice(index, 1); + } else { + var ids = id.split(","); + console.log(ids); + for (var i = 0; i < ids.length; i++) { + for (var j = 0; j < app.list.length; j++) { + console.log(app.list[j].special.id + ":" + ids[i]) + if (app.list[j].special.id == ids[i]) { + app.list.splice(j, 1); + break; + } + } + } + } + layer.msg("鍒犻櫎鎴愬姛"); + } else { + layer.msg(data.msg); + } + }, 'json'); + }, function () { + + }); + }, + edit: function (id) { + window.location.href = "edit-tuijian-home-labels.html?id=" + id; + }, + } + }); + app.resourceList(); + }); + </script> + +</body> + +</html> \ No newline at end of file diff --git a/src/test/java/com/hxh/spring/test/GeneralTest.java b/src/test/java/com/hxh/spring/test/GeneralTest.java index bef7fc7..0206dc2 100644 --- a/src/test/java/com/hxh/spring/test/GeneralTest.java +++ b/src/test/java/com/hxh/spring/test/GeneralTest.java @@ -1,35 +1,94 @@ package com.hxh.spring.test; import com.yeshi.buwan.dao.base.MongodbBaseDao; -import com.yeshi.buwan.dao.goldcorn.GoldCornTaskActionDetailDao; +import com.yeshi.buwan.dao.live.TVLiveProgramResourceDao; import com.yeshi.buwan.dao.video.VideoResourceVersionMapDao; -import com.yeshi.buwan.domain.goldcorn.GoldCornTaskActionDetail; -import com.yeshi.buwan.domain.live.*; -import com.yeshi.buwan.domain.pptv.PPTVPlayProcessRecord; -import com.yeshi.buwan.domain.special.SearchSpecial; -import com.yeshi.buwan.domain.special.SearchSpecialPosition; -import com.yeshi.buwan.domain.special.SearchSpecialPositionMap; -import com.yeshi.buwan.domain.tb.YouZhiHaoHuoGoods; +import com.yeshi.buwan.domain.live.TVLiveProgramResource; +import com.yeshi.buwan.domain.video.StarInfo; import com.yeshi.buwan.domain.video.VideoResourceVersionMap; -import com.yeshi.buwan.domain.vip.VideoBuyRecord; -import com.yeshi.buwan.live.migu.MiGuLiveListInfo; import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; -import com.yeshi.buwan.videos.bilibili.entity.BilibiliEpInfo; -import com.yeshi.buwan.videos.bilibili.entity.BilibiliMediaInfo; -import com.yeshi.buwan.videos.bilibili.entity.BilibiliSearchVideoMap; -import com.yeshi.buwan.videos.bilibili.entity.BilibiliVideo; +import org.junit.Test; import org.yeshi.utils.generater.SpringComponentGenerater; import org.yeshi.utils.generater.entity.MongoDBDaoData; import org.yeshi.utils.generater.entity.ServiceData; +import java.io.File; + public class GeneralTest { + + private String packageBaseName = "com.yeshi.buwan"; + private Class mongoBaseDao = MongodbBaseDao.class; + private String PROJECT_PATH = "D:\\workspace\\BuWan"; + + + @Test + public void generalMongoDaoAndService() throws ClassNotFoundException { + /************鍙洿鏀瑰尯鍩熷紑濮�*************/ + Class entityClass = StarInfo.class; + //dao鐨勭浉瀵瑰寘鍚� + String daoRelativePackageName = "dao.video"; + String serviceRelativePackageName = "service.inter.video"; + String serviceImplRelativePackageName = "service.imp.video"; + /************鍙洿鏀瑰尯缁撴潫*************/ + + + String daoPackageName = packageBaseName + "." + daoRelativePackageName; + String daoClassName = daoPackageName + "." + entityClass.getSimpleName() + "Dao"; + + //鐢熸垚dao + MongoDBDaoData.Builder daoBuilder = new MongoDBDaoData.Builder(); + daoBuilder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(daoPackageName); + daoBuilder.setEntityClass(entityClass); + try { + String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + daoPackageName.replace(".", "\\") + "\\"; + if (!new File(targetDir).exists()) + new File(targetDir).mkdirs(); + SpringComponentGenerater.createMongoDao(daoBuilder.create(), targetDir); + } catch (Exception e) { + e.printStackTrace(); + } + + //鐢熸垚鏈嶅姟鎺ュ彛 + String servicePackageName = packageBaseName + "." + serviceRelativePackageName; + String serviceClassName = servicePackageName + "." + entityClass.getSimpleName() + "Service"; + ServiceData.Builder builder = new ServiceData.Builder(); + builder.setPackageName(servicePackageName); + builder.setDaoClass(Class.forName(daoClassName)); + builder.setEntityClass(entityClass); + try { + String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + servicePackageName.replace(".", "\\") + "\\"; + if (!new File(targetDir).exists()) + new File(targetDir).mkdirs(); + SpringComponentGenerater.createService(builder.build(), targetDir); + } catch (Exception e) { + e.printStackTrace(); + } + + //鐢熸垚鏈嶅姟瀹炵幇鎺ュ彛 + String serviceImplPackageName = packageBaseName + "." + serviceImplRelativePackageName; + builder = new ServiceData.Builder(); + builder.setPackageName(serviceImplPackageName).setServiceClass(Class.forName(serviceClassName)).setDaoClass(Class.forName(daoClassName)).setEntityClass(entityClass); + + try { + String targetDir = PROJECT_PATH + "\\src\\main\\java\\" + serviceImplPackageName.replace(".", "\\") + "\\"; + if (!new File(targetDir).exists()) + new File(targetDir).mkdirs(); + SpringComponentGenerater.createServiceImpl(builder.build(), targetDir); + } catch (Exception e) { + e.printStackTrace(); + } + + + } + @org.junit.Test public void createDao() { + MongoDBDaoData.Builder builder = new MongoDBDaoData.Builder(); + builder.setBaseDaoClass(mongoBaseDao).setDaoPackageName(packageBaseName + ".dao.live"); + builder.setEntityClass(TVLiveProgramResource.class); try { - SpringComponentGenerater.createMongoDao(new MongoDBDaoData.Builder().setBaseDaoClass(MongodbBaseDao.class).setDaoPackageName("com.yeshi.buwan.dao.search").setEntityClass(SearchSpecialPosition.class).create(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\dao\\search\\"); - - + SpringComponentGenerater.createMongoDao(builder.create(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\dao\\live\\"); } catch (Exception e) { e.printStackTrace(); } @@ -38,8 +97,12 @@ // @org.junit.Test public void createService() { + ServiceData.Builder builder = new ServiceData.Builder(); + builder.setPackageName(packageBaseName + ".service.inter.live"); + builder.setDaoClass(TVLiveProgramResourceDao.class); + builder.setEntityClass(TVLiveProgramResource.class); try { - SpringComponentGenerater.createService(new ServiceData.Builder().setPackageName("com.yeshi.buwan.service.inter.goldcorn").setDaoClass(GoldCornTaskActionDetailDao.class).setEntityClass(GoldCornTaskActionDetail.class).build(), "D:\\workspace\\BuWan\\src\\main\\java\\com\\yeshi\\buwan\\service\\inter\\goldcorn\\"); + SpringComponentGenerater.createService(builder.build(), PROJECT_PATH + "\\src\\main\\java\\com\\yeshi\\buwan\\service\\inter\\goldcorn\\"); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/test/java/com/hxh/spring/test/VideoTest.java b/src/test/java/com/hxh/spring/test/VideoTest.java index c2bcea6..b528e73 100644 --- a/src/test/java/com/hxh/spring/test/VideoTest.java +++ b/src/test/java/com/hxh/spring/test/VideoTest.java @@ -4,6 +4,7 @@ import com.yeshi.buwan.domain.system.DetailSystem; import com.yeshi.buwan.domain.VideoInfo; import com.yeshi.buwan.domain.entity.PlayUrl; +import com.yeshi.buwan.exception.video.VideoPlayException; import com.yeshi.buwan.videos.iqiyi.IqiYiNewAPI; import com.yeshi.buwan.videos.iqiyi.entity.IqiyiUpdateQueue; import com.yeshi.buwan.videos.iqiyi.util.IqiyiUtil; @@ -97,8 +98,12 @@ DetailSystem detailSystem = systemService.getDetailSystemByPackage("com.doudou.ysvideo"); - PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), 3357160 + "", "acFunVideo", - Integer.parseInt(21 + ""), 3357160 + ""); + try { + PlayUrl pu = videoDeailUtil.getPlayUrl(null, detailSystem.getId(), 3357160 + "", "acFunVideo", + Integer.parseInt(21 + ""), 3357160 + ""); + } catch (VideoPlayException e) { + e.printStackTrace(); + } } @org.junit.Test diff --git a/src/test/java/com/hxh/spring/test/live/TVLiveTest.java b/src/test/java/com/hxh/spring/test/live/TVLiveTest.java index e009326..26c5f66 100644 --- a/src/test/java/com/hxh/spring/test/live/TVLiveTest.java +++ b/src/test/java/com/hxh/spring/test/live/TVLiveTest.java @@ -1,6 +1,15 @@ package com.hxh.spring.test.live; +import com.yeshi.buwan.dao.live.TVLiveChannelDao; +import com.yeshi.buwan.domain.live.TVLiveChannel; +import com.yeshi.buwan.domain.live.TVLiveProgramResource; +import com.yeshi.buwan.exception.ParamsException; import com.yeshi.buwan.job.LiveJob; +import com.yeshi.buwan.service.inter.live.TVLiveProgramResourceService; +import com.yeshi.buwan.util.StringUtil; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.select.Elements; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; @@ -8,6 +17,10 @@ import org.springframework.test.context.web.WebAppConfiguration; import javax.annotation.Resource; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.Scanner; @RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 @ContextConfiguration(locations = {"classpath:spring.xml"}) @@ -17,10 +30,104 @@ @Resource private LiveJob liveJob; + @Resource + private TVLiveChannelDao tvLiveChannelDao; + @Resource + private TVLiveProgramResourceService tvLiveProgramResourceService; + @Test public void syncMiGu() throws Exception { liveJob.updateMiGu(""); } + /** + * 鏇存柊鑺傜洰鍗� + */ + @Test + public void updatePrigrams() throws Exception { + liveJob.updatePrograms(null); + } + + @Test + public void getDianShiMaoChannels() throws IOException { + Document doc = Jsoup.connect("https://www.tvmao.com/program_satellite/AHTV1-w4.html").userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36").get(); + Elements els = doc.getElementsByClass("chlsnav").get(0).getElementsByTag("ul").get(0).getElementsByTag("a"); + for (int i = 0; i < els.size(); i++) { + System.out.println(els.get(i).text() + "#https://www.tvmao.com" + + els.get(i).attr("href")); + } + } + + @Test + public void getTVSOUChannels() throws IOException { + Document doc = Jsoup.connect("https://www.tvsou.com/epg/yangshi/").userAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36").get(); + Elements els = doc.getElementsByClass("c_list_main").get(0).getElementsByTag("a"); + for (int i = 0; i < els.size(); i++) { + System.out.println(els.get(i).text() + "#https://www.tvsou.com/" + + els.get(i).attr("href")); + } + } + + @Test + public void addProgramResource() throws FileNotFoundException { + Scanner scanner = new Scanner(new File("C:\\Users\\Administrator\\Desktop\\鏂板缓鏂囨湰鏂囨。 (2).txt")); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + String[] sts = line.split("#"); + if (sts.length > 1) { + String name = sts[0]; + String link = sts[1].trim(); + String id = StringUtil.Md5(name); + TVLiveChannel channel = tvLiveChannelDao.get(id); + if (channel != null) { + TVLiveProgramResource resource = new TVLiveProgramResource(); + resource.setChannelId(channel.getId()); + resource.setType(TVLiveProgramResource.TVLiveProgramResourceType.dianshimao); + resource.setUrl(link); + try { + tvLiveProgramResourceService.add(resource); + } catch (ParamsException e) { + e.printStackTrace(); + } + } + } + } + + scanner.close(); + } + + + /** + * 鎼滆缃� + * @throws FileNotFoundException + */ + @Test + public void addProgramResourceTVSOU() throws FileNotFoundException { + Scanner scanner = new Scanner(new File("C:\\Users\\Administrator\\Desktop\\鎼滆缃�.txt")); + while (scanner.hasNextLine()) { + String line = scanner.nextLine(); + String[] sts = line.split("#"); + if (sts.length > 1) { + String name = sts[0]; + String link = sts[1].trim(); + String id = StringUtil.Md5(name); + TVLiveChannel channel = tvLiveChannelDao.get(id); + if (channel != null) { + TVLiveProgramResource resource = new TVLiveProgramResource(); + resource.setChannelId(channel.getId()); + resource.setType(TVLiveProgramResource.TVLiveProgramResourceType.tvsou); + resource.setUrl(link); + try { + tvLiveProgramResourceService.add(resource); + } catch (ParamsException e) { + e.printStackTrace(); + } + } + } + } + + scanner.close(); + } + } diff --git a/src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java b/src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java new file mode 100644 index 0000000..cb6ae3b --- /dev/null +++ b/src/test/java/com/hxh/spring/test/video/VideoResourcePlayVersionTest.java @@ -0,0 +1,167 @@ +package com.hxh.spring.test.video; + +import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; +import com.yeshi.buwan.domain.video.VideoResourceVersionMap; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; +import com.yeshi.buwan.service.inter.video.VideoResourcePlayVersionMapService; +import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.web.WebAppConfiguration; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * @author Administrator + * @title: + * @description: + * @date 2021/9/10 14:46 + */ +@RunWith(SpringJUnit4ClassRunner.class) //浣跨敤junit4杩涜娴嬭瘯 +@ContextConfiguration(locations = {"classpath:spring.xml"}) +@WebAppConfiguration +public class VideoResourcePlayVersionTest { + + @Resource + private VideoResourcePlayVersionMapService videoResourcePlayVersionMapService; + + + @Resource + private VideoResourceVersionMapService videoResourceVersionMapService; + + @Test + public void addBuWanAndroid() { + String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("44", 1, rid, null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + resourceIds = new String[]{"25"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("44", 105, rid, null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + + @Test + public void addMGAndroid() { + String[] resourceIds = null; + resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("47", 1, rid, null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + +// resourceIds = new String[]{"25"}; +// for (String rid : resourceIds) { +// try { +// videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("47", 1, rid, "meizu")); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + + } + + @Test + public void addHJAndroid() { + String[] resourceIds = null; + resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27", "25", "28"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("48", 1, rid, "meizu")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Test + public void addHJMZ() { + String[] resourceIds = null; + resourceIds = new String[]{"25", "28"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("48", 1, rid, "meizu")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + @Test + public void addBuwanLite() { + String[] resourceIds = null; + resourceIds = new String[]{"25"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("49", 1, rid, "xiaomi")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Test + public void addBuWanIOS() { + String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; + for (String rid : resourceIds) { + try { + videoResourcePlayVersionMapService.add(new VideoResourcePlayVersionMap("43", 1, rid, null)); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + @Test + public void listValid() { + List<String> resourceIds = videoResourcePlayVersionMapService.listResourceId("43", 105, null); + System.out.println(resourceIds); + + resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 1, null); + System.out.println(resourceIds); + + resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 2, null); + System.out.println(resourceIds); + + resourceIds = videoResourcePlayVersionMapService.listResourceId("44", 106, null); + System.out.println(resourceIds); + } + + @Test + public void copy() throws Exception { + List<VideoResourceVersionMap> mapList = videoResourceVersionMapService.listAll(); + for (VideoResourceVersionMap map : mapList) { + VideoResourcePlayVersionMap pm = new VideoResourcePlayVersionMap(); + pm.setId(map.getId()); + pm.setChannel(map.getChannel()); + pm.setDetailSystemId(map.getDetailSystemId()); + pm.setRemarks(map.getRemarks()); + pm.setVersion(map.getVersion()); + pm.setUpdateTime(new Date()); + pm.setResourceId(map.getResourceId()); + pm.setCreateTime(new Date()); + videoResourcePlayVersionMapService.add(pm); + } + } + +} diff --git a/src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java b/src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java index 2be2be6..2fc6ff8 100644 --- a/src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java +++ b/src/test/java/com/hxh/spring/test/video/VideoResourceVersionTest.java @@ -1,5 +1,6 @@ package com.hxh.spring.test.video; +import com.yeshi.buwan.domain.video.VideoResourcePlayVersionMap; import com.yeshi.buwan.domain.video.VideoResourceVersionMap; import com.yeshi.buwan.service.inter.video.VideoResourceVersionMapService; import org.junit.Test; @@ -21,7 +22,7 @@ @Test public void addBuWanAndroid() { - String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"}; + String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; for (String rid : resourceIds) { try { videoResourceVersionMapService.add(new VideoResourceVersionMap("44", 1, rid, null)); @@ -45,7 +46,7 @@ @Test public void addMGAndroid() { String[] resourceIds = null; - resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"}; + resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; for (String rid : resourceIds) { try { videoResourceVersionMapService.add(new VideoResourceVersionMap("47", 1, rid, null)); @@ -68,7 +69,7 @@ @Test public void addHJAndroid() { String[] resourceIds = null; - resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27", "25","28"}; + resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27", "25", "28"}; for (String rid : resourceIds) { try { videoResourceVersionMapService.add(new VideoResourceVersionMap("48", 1, rid, "meizu")); @@ -79,9 +80,23 @@ } @Test + public void addBuwanLite() { + String[] resourceIds = null; + resourceIds = new String[]{"25"}; + for (String rid : resourceIds) { + try { + videoResourceVersionMapService.add(new VideoResourceVersionMap("49", 1, rid, "xiaomi")); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + + @Test public void addHJMZ() { String[] resourceIds = null; - resourceIds = new String[]{ "25","28"}; + resourceIds = new String[]{"25", "28"}; for (String rid : resourceIds) { try { videoResourceVersionMapService.add(new VideoResourceVersionMap("48", 1, rid, "meizu")); @@ -93,7 +108,7 @@ @Test public void addBuWanIOS() { - String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24","26", "27"}; + String[] resourceIds = new String[]{"13", "20", "17", "19", "21", "22", "24", "26", "27"}; for (String rid : resourceIds) { try { videoResourceVersionMapService.add(new VideoResourceVersionMap("43", 1, rid, null)); -- Gitblit v1.8.0