| | |
| | | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.xxl.rpc.util.ThreadPoolUtil; |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.domain.*; |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import com.yeshi.buwan.domain.entity.PlayUrl; |
| | |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | @Resource |
| | | private ConfigService configService; |
| | | private DetailSystemConfigService configService; |
| | | @Resource |
| | | private AdService adService; |
| | | @Resource |
| | |
| | | @Resource |
| | | private VideoWatchHistoryService videoWatchHistoryService; |
| | | |
| | | @Resource |
| | | private HomeRecommendSpecialService homeRecommendSpecialService; |
| | | |
| | | private final Logger userPlayLogger = LoggerFactory.getLogger("videoPlayUser"); |
| | | |
| | | @RequireUid |
| | | public void getHomeAd(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String vtid = request.getParameter("Vtid"); |
| | | if (!"310".equals(vtid)) { |
| | | HomeRecommendSpecial special = homeRecommendSpecialService.getSpecial(vtid); |
| | | //兼容新版本 |
| | | if (special != null) { |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | List<HomeAd> list = homeAdService.getHomeAdList(detailSystem); |
| | | List<HomeAd> list = homeAdService.getHomeAdList(detailSystem, special != null ? special.getDataKey() : null); |
| | | |
| | | if (acceptData.getPlatform().equalsIgnoreCase("ios"))// IOS测试 |
| | | { |
| | |
| | | for (int i = 0; i < list.size(); i++) |
| | | array.add(StringUtil.outPutResultJson(list.get(i))); |
| | | object.put("data", array); |
| | | |
| | | } else { |
| | | for (HomeAd ad : list) { |
| | | if (ad.getVideo() != null) { |
| | |
| | | if (!StringUtil.isNullOrEmpty(ad.getParams())) { |
| | | ad.setParams(ad.getParams().replace("\"", "\\" + "\"")); |
| | | } |
| | | |
| | | // 3.4.7以上的版本才可以用 |
| | | // com.weikou.beibeivideo.ui.mine.FXBrowserActivity |
| | | if ("com.weikou.beibeivideo.ui.mine.FXBrowserActivity".equalsIgnoreCase(ad.getClazz()) |
| | | && acceptData.getVersion() < 71) |
| | | ad.setClazz("com.weikou.beibeivideo.ui.mine.BrowserActivity"); |
| | | else |
| | | ad.setClazz("com.weikou.beibeivideo.ui.mine.FXBrowserActivity"); |
| | | } |
| | | object.put("count", (new StringBuilder(String.valueOf(list.size()))).toString()); |
| | | JSONArray array = new JSONArray(); |
| | |
| | | |
| | | object.put("data", array); |
| | | } |
| | | object.put("bannerSizeRate", special.getBannerSizeRate()); |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | } else { |
| | | classParser.getRecommendCategoryVideoBanner(acceptData, request, out); |
| | |
| | | if (StringUtil.isNullOrEmpty(vtid)) { |
| | | vtid = "309"; // 为了兼容以前的推荐 |
| | | } |
| | | |
| | | HomeRecommendSpecial special = homeRecommendSpecialService.getSpecial(vtid); |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | JSONObject object = new JSONObject(); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | List<HomeType> list1 = homeTypeService.getHomeType(detailSystem.getId(), resourceList, |
| | | CacheUtil.getMD5Long(resourceList), -1, Long.parseLong(vtid)); |
| | | CacheUtil.getMD5Long(resourceList), -1, special != null ? special.getDataKey() : null); |
| | | List<HomeType> list = new ArrayList<>(); |
| | | for (HomeType ht : list1) |
| | | list.add(ht); |
| | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | 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()); |
| | | if (adContent != null && adPosition != null) { |
| | | HomeType.HomeTypeAd ad = new Gson().fromJson(adContent.getValue(), HomeType.HomeTypeAd.class); |
| | | int adP = Integer.parseInt(adPosition.getValue()); |
| | | if (adP < list.size() && adP > -1) { |
| | | HomeType homeType = new HomeType(); |
| | | homeType.setAd(ad); |
| | | list.add(adP, homeType); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | JSONArray array = new JSONArray(); |
| | | |
| | | for (HomeType ht : list) { |
| | | for (int i = 0; i < ht.getHomeVideoList().size(); i++) { |
| | | //改变图片 |
| | | if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) { |
| | | ht.getHomeVideoList().remove(i); |
| | | i--; |
| | | if (ht.getHomeVideoList() != null) |
| | | for (int i = 0; i < ht.getHomeVideoList().size(); i++) { |
| | | //改变图片 |
| | | if (JuheVideoUtil.isNeedDelete(ht.getHomeVideoList().get(i).getVideo(), detailSystem.getId())) { |
| | | ht.getHomeVideoList().remove(i); |
| | | i--; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) |
| | |
| | | String thirdType = request.getParameter("Type"); |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String position = request.getParameter("Position"); |
| | | String from = request.getParameter("From"); |
| | | |
| | | if (StringUtil.isNullOrEmpty(videoId)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传VideoId")); |
| | |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getPlatform(), acceptData.getVersion()); |
| | | List<Long> resourceList = videoResouceUtil.getAvailableResourceIds(acceptData.getDetailSystem(), acceptData.getVersion()); |
| | | |
| | | //获取优先展示的渠道 |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | |
| | | } |
| | | }); |
| | | |
| | | userPlayLogger.info(VideoLogFactory.createUserVideoDetailLog(acceptData.getDevice(), acceptData.getUtdId(), loginUid, acceptData.getDetailSystem().getId(), videoId, resourceId, from)); |
| | | |
| | | |
| | | //PPTV网页播放 |
| | | if (resourceId != null && Integer.parseInt(resourceId) == PPTVUtil.RESOURCE_ID) { |
| | |
| | | int p = 0; |
| | | if (!StringUtil.isNullOrEmpty(position)) { |
| | | p = Integer.parseInt(position); |
| | | } else { |
| | | //取播放记录 |
| | | VideoWatchHistory history = videoWatchHistoryService.getWatchHistory(acceptData.getDevice(), videoId); |
| | | if (history != null && history.getPosition() != null) { |
| | | p = history.getPosition(); |
| | | } |
| | | } |
| | | |
| | | p = p >= series.getSeries().size() ? 0 : p; |
| | |
| | | String playUrl = PPTVUtil.getPlayUrl(series, series.getSeries().get(p)); |
| | | data.put("videoId", videoId); |
| | | data.put("playUrl", playUrl); |
| | | data.put("name", series.getName()); |
| | | data.put("pptv", true); |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | return; |
| | |
| | | |
| | | public void isPraise(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(acceptData.getPackageName()); |
| | | Config config = configService.getConfigByKey("banner_praise", detailSystem, acceptData.getVersion()); |
| | | DetailSystemConfig config = configService.getConfigByKey("banner_praise", detailSystem, acceptData.getVersion()); |
| | | if ("是".equals(config.getValue())) { |
| | | out.print(JsonUtil.loadTrueJson("1")); |
| | | } else { |