| | |
| | | |
| | | 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.AdRecommendRight; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.SystemInfo; |
| | | import com.yeshi.buwan.videos.funtv.FunTVNewApi; |
| | | import com.yeshi.buwan.service.imp.*; |
| | | import com.yeshi.buwan.service.imp.recommend.AdRecommendRightService; |
| | | import com.yeshi.buwan.service.inter.jump.JumpDetailService; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.annotation.RequireUid; |
| | | import com.yeshi.buwan.util.log.VideoLogFactory; |
| | | import com.yeshi.buwan.util.zhibo.MeiNvZhiBoUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Controller |
| | | public class OtherParser { |
| | | private final Logger playLogger = LoggerFactory.getLogger("videoPlay"); |
| | | private String[] sdks = {"4.0.1", "4.0.2", "4.1.0", "4.2.2", "4.2.4", "4.4.2", "4.4.4", "5.0.1", "5.1.0"}; |
| | | private String[] fbl = {"720x1280", "480x800", "480x854", "640x960", "1080x1920"}; |
| | | @Resource |
| | |
| | | private MeiNvZhiBoUtil meiNvZhiBoUtil; |
| | | @Resource |
| | | private AdRecommendRightService adRecommendRightService; |
| | | @Resource |
| | | private JumpDetailService jumpDetailService; |
| | | @Resource |
| | | private RedisManager redisManager; |
| | | |
| | | @RequireUid |
| | | public void advice(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | |
| | | List<HomeNotice> list = homeNoticeService.getHomeNoticeList(detailSystem.getId()); |
| | | String content = ""; |
| | | String url = ""; |
| | | HomeNotice notice = null; |
| | | if (list != null && list.size() > 0) { |
| | | int position = (int) ((list.size() + 1) * Math.random()); |
| | | if (position == 0) |
| | | position = 1; |
| | | if (position > list.size()) |
| | | position = list.size(); |
| | | HomeNotice notice = list.get(position - 1); |
| | | notice = list.get(position - 1); |
| | | long now = System.currentTimeMillis(); |
| | | if (TimeUtil.convertAllTimeToTemp(notice.getStarttime()) < now |
| | | && now < TimeUtil.convertAllTimeToTemp(notice.getEndtime())) {// 在显示时间内 |
| | | content = notice.getContent(); |
| | | url = notice.getUrl(); |
| | | |
| | | } else { |
| | | notice = null; |
| | | } |
| | | } |
| | | |
| | | JumpDetail jumpDetail = null; |
| | | |
| | | if (notice != null && acceptData.getVersion() >= 98 && "android".equalsIgnoreCase(acceptData.getPlatform())) { |
| | | content = notice.getContent(); |
| | | url = notice.getUrl().split("\\?")[1].replace("url=", "").trim(); |
| | | jumpDetail = jumpDetailService.selectByTypeCache(JumpTypeEnum.baichuan); |
| | | } |
| | | |
| | | JSONObject params = new JSONObject(); |
| | | params.put("url", url); |
| | | |
| | | JSONObject object = new JSONObject(); |
| | | object.put("Content", content);// content |
| | | object.put("Url", url);// url |
| | | object.put("ShowAd", "0");// 广告显示 |
| | | object.put("Params", params);// 跳转参数 |
| | | object.put("jumpDetail", new Gson().toJson(jumpDetail)); |
| | | |
| | | out.print(JsonUtil.loadTrueJson(object.toString())); |
| | | out.flush(); |
| | |
| | | } |
| | | return; |
| | | } |
| | | |
| | | public void playStatistic(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String videoId = request.getParameter("VideoId"); |
| | | String resourceId = request.getParameter("ResourceId"); |
| | | playLogger.info(VideoLogFactory.createStatisticLog("", Integer.parseInt(resourceId), videoId)); |
| | | |
| | | out.print(JsonUtil.loadTrueJson("")); |
| | | return; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取风行授权码 |
| | | * |
| | | * @param acceptData |
| | | * @param request |
| | | * @param out |
| | | */ |
| | | public void getFuntvAuthCode(AcceptData acceptData, HttpServletRequest request, PrintWriter out) { |
| | | String authCode = null; |
| | | // try { |
| | | // authCode = redisManager.getCommonString("funtv_authcode"); |
| | | // } catch (Exception e) { |
| | | // } |
| | | // |
| | | // if (!StringUtil.isNullOrEmpty(authCode)) { |
| | | // out.print(JsonUtil.loadTrueJson(authCode)); |
| | | // } else { |
| | | authCode = FunTVNewApi.getAuthCode(); |
| | | // if (!StringUtil.isNullOrEmpty(authCode)) { |
| | | // redisManager.cacheCommonString("funtv_authcode", authCode, 60 * 5);//缓存5分钟 |
| | | // } |
| | | out.print(JsonUtil.loadTrueJson(authCode)); |
| | | } |
| | | // } |
| | | } |