| | |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.dto.log.BaseLog; |
| | | import com.yeshi.buwan.mogotv.MogoTVUtil; |
| | | 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.YouKuService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.tencent.TencentVideoUtil; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | |
| | | |
| | | @Controller |
| | | public class HomeParser { |
| | | |
| | | private Logger logger = LoggerFactory.getLogger(HomeParser.class); |
| | | |
| | | @Resource |
| | | private SystemService systemService; |
| | | @Resource |
| | |
| | | @Resource |
| | | private YouKuUtil youKuUtil; |
| | | |
| | | @Resource |
| | | private MogoTVUtil mogoTVUtil; |
| | | |
| | | @Resource |
| | | private TencentVideoUtil tencentVideoUtil; |
| | | |
| | | |
| | | public void getVideoDetailForInternetSearch(AcceptData acceptData, String videoId, HttpServletRequest request, PrintWriter out) { |
| | | String loginUid = request.getParameter("LoginUid"); |
| | | String from = request.getParameter("From"); |
| | | InternetSearchVideo internetSearchVideo = internetSearchVideoService.selectByPrimaryKey(videoId); |
| | | String resourceId = request.getParameter("ResourceId"); |
| | | if (StringUtil.isNullOrEmpty(resourceId)) { |
| | | resourceId = internetSearchVideo.getResourceIds().split(",")[0]; |
| | | } |
| | | |
| | | VideoInfo info = null; |
| | | if (Integer.parseInt(resourceId) == YouKuUtil.RESOURCE_ID) { |
| | | VideoInfo info = null; |
| | | try { |
| | | info = youKuUtil.getVideoInfo(internetSearchVideo); |
| | | |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | JSONObject obj = new JSONObject(); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } else if (Integer.parseInt(resourceId) == MogoTVUtil.RESOURCE_ID) { |
| | | try { |
| | | info = mogoTVUtil.getVideoInfo(internetSearchVideo); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | } else if (Integer.parseInt(resourceId) == TencentVideoUtil.RESOURCE_ID) { |
| | | try { |
| | | info = tencentVideoUtil.getVideoInfo(internetSearchVideo); |
| | | } catch (Exception e) { |
| | | logger.error("全网搜视频详情出错:" + videoId); |
| | | out.print(JsonUtil.loadFalseAdmin(e.getMessage())); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | LoggerUtil.getUserActiveLogger().info(UserActiveLogFactory.createVideoDetail(new BaseLog(acceptData, loginUid), videoId, info.getName(), from)); |
| | | |
| | | info.setWatchCount("" + (int) (Math.random() * 1000)); |
| | | |
| | | JSONArray array = new JSONArray(); |
| | | JSONObject obj = new JSONObject(); |
| | | out.print(JsonUtil.loadTrueJson(StringUtil.outPutResultJson(Utils.convertVideo(info)), array.toString(), |
| | | obj.toString())); |
| | | } |
| | | |
| | | @RequireUid |