| | |
| | | Map<String, String> map = configService.getConfigAsMap(); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | |
| | | if ("huawei".equalsIgnoreCase(channel) |
| | | && Integer.parseInt(version) >= Integer.parseInt(map.get("huawei_online_version"))) { |
| | | data.put("showAd", false); |
| | | } else |
| | | data.put("showAd", true); |
| | | //分渠道控制 |
| | | String onLiningInfo = map.get("onlining_channel_info"); |
| | | if (!StringUtil.isNullOrEmpty(onLiningInfo)) { |
| | | JSONObject obj = JSONObject.fromObject(onLiningInfo); |
| | | String v = obj.optString(channel.toLowerCase()); |
| | | if (!StringUtil.isNullOrEmpty(v) && Integer.parseInt(version) >= Integer.parseInt(v)) { |
| | | data.put("showAd", false); |
| | | } |
| | | } |
| | | |
| | | out.print(JsonUtil.loadTrueJson(data.toString())); |
| | | } |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | import com.newvideo.vo.AcceptData; |
| | | import org.apache.commons.httpclient.HttpClient; |
| | | import org.apache.commons.httpclient.HttpException; |
| | | import org.apache.commons.httpclient.methods.GetMethod; |
| | |
| | | String type = request.getParameter("Type"); |
| | | String packageName = request.getParameter("Package"); |
| | | String videoId = request.getParameter("VideoId"); |
| | | String channel= request.getParameter("Channel"); |
| | | |
| | | AcceptData acceptData=new AcceptData(); |
| | | acceptData.setChannel(channel); |
| | | acceptData.setMethod(method); |
| | | acceptData.setPackage(packageName); |
| | | acceptData.setPlatform(platform); |
| | | acceptData.setSystem(system); |
| | | acceptData.setVersion(Integer.parseInt(version)); |
| | | |
| | | |
| | | if (StringUtil.isNullOrEmpty(method)) { |
| | | out.print(JsonUtil.loadFalseJson("请上传Method")); |
| | |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(acceptData,detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | |
| | | if (pu != null) { |
| | | if (!StringUtil.isNullOrEmpty(pu.getUrl())) |
| | |
| | | object.put("NoticeContent", map.get("play_notice_content")); |
| | | |
| | | object.put("ShowMoreApp", map.get("show_more_app")); |
| | | |
| | | //广告控制 |
| | | object.put("ShowAd", map.get("show_ad")); |
| | | |
| | | |
| | | |
| | | |
| | | object.put("PPTVSO", map.get("pptvsourl")); |
| | | |
| | | object.put("COMMENT_ALERT", map.get("comment_alert")); |
| | |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(null,detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | |
| | | if (pu != null) { |
| | | if (!StringUtil.isNullOrEmpty(pu.getUrl())) |
| | |
| | | |
| | | DetailSystem detailSystem = systemService.getDetailSystemByPackage(packageName); |
| | | |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | PlayUrl pu = videoDeailUtil.getPlayUrl(null,detailSystem.getId(), id, type, Integer.parseInt(resourceId), videoId); |
| | | |
| | | if (pu != null) { |
| | | if (!StringUtil.isNullOrEmpty(pu.getUrl())) |
| | |
| | | /** |
| | | * @author Administrator |
| | | */ |
| | | @Component |
| | | //@Component |
| | | public class AdJob { |
| | | |
| | | @Resource |
| | |
| | | } |
| | | return map; |
| | | } |
| | | @Cacheable(value = "homeCache", key = "'getConfigByKey-'+#key") |
| | | public Config getConfigByKeyCache(String key) { |
| | | List<Config> list = configDao.list("from Config cf where cf.key=?", new Serializable[] { key }); |
| | | if (list != null && list.size() > 0) |
| | | return list.get(0); |
| | | else |
| | | return null; |
| | | } |
| | | |
| | | public Config getConfigByKey(String key) { |
| | | List<Config> list = configDao.list("from Config cf where cf.key=?", new Serializable[] { key }); |
| | |
| | | import com.newvideo.dao.juhe.funtv.FunTVAlbum2Dao; |
| | | import com.newvideo.dao.juhe.funtv.FunTVVideo2Dao; |
| | | import com.newvideo.dao.juhe.funtv.VideoFunTV2Dao; |
| | | import com.newvideo.domain.Config; |
| | | import com.newvideo.domain.VideoDetailInfo; |
| | | import com.newvideo.domain.VideoInfo; |
| | | import com.newvideo.domain.VideoResource; |
| | |
| | | import com.newvideo.funtv.entity.FunTVAlbum2; |
| | | import com.newvideo.funtv.entity.FunTVVideo2; |
| | | import com.newvideo.funtv.entity.VideoFunTV2; |
| | | import com.newvideo.service.imp.CategoryVideoService; |
| | | import com.newvideo.service.imp.ResourceVideoService; |
| | | import com.newvideo.service.imp.VideoInfoService; |
| | | import com.newvideo.service.imp.VideoResourceService; |
| | | import com.newvideo.service.imp.*; |
| | | import com.newvideo.service.inter.FunTV2Service; |
| | | import com.newvideo.util.JuHe.VideoConstant; |
| | | import com.newvideo.util.StringUtil; |
| | | import com.newvideo.vo.AcceptData; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private ConfigService configService; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PlayUrl getPlayUrl(String detailSystemId, int resourceId, String id, String videoId) { |
| | | public PlayUrl getPlayUrl(AcceptData acceptData, String detailSystemId, int resourceId, String id, String videoId) { |
| | | FunTVVideo2 video2 = funTVVideo2Dao.get(id); |
| | | VideoResource vr = videoResourceService.getResource(resourceId + ""); |
| | | int t = FunTVUtil2.getPlayType(video2); |
| | | int t = FunTVUtil2.PLAY_HTML; |
| | | PlayUrl pu = new PlayUrl(); |
| | | pu.setParams(""); |
| | | Config config = configService.getConfigByKeyCache("funshion_sdk_play_channels"); |
| | | if (config != null && !StringUtil.isNullOrEmpty(config.getValue())) { |
| | | String[] channels = config.getValue().split(","); |
| | | if (Arrays.asList(channels).contains(acceptData.getChannel().toLowerCase())) { |
| | | t = FunTVUtil2.PLAY_SDK; |
| | | } |
| | | } |
| | | |
| | | pu.setPlayType(t); |
| | | pu.setResource(vr); |
| | | pu.setCode(video2.getCeCode()); |
| | |
| | | import com.newvideo.domain.entity.PlayUrl; |
| | | import com.newvideo.funtv.entity.FunTVAlbum2; |
| | | import com.newvideo.funtv.entity.FunTVVideo2; |
| | | import com.newvideo.vo.AcceptData; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | public int getShowType(String videoid) ; |
| | | |
| | | |
| | | public PlayUrl getPlayUrl(String detailSystemId, int resourceId, String id, String videoId); |
| | | public PlayUrl getPlayUrl(AcceptData acceptData,String detailSystemId, int resourceId, String id, String videoId); |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | import com.newvideo.funtv.FunTVUtil2; |
| | | import com.newvideo.service.inter.FunTV2Service; |
| | | import com.newvideo.vo.AcceptData; |
| | | import org.hibernate.HibernateException; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | |
| | | } |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getPlayUrl'+'-'+#detailSystemId+'-'+#id+'-'+#type+'-'+#resourceid") |
| | | public PlayUrl getPlayUrl(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) { |
| | | if (resourceid == 13) {// 爱奇艺 |
| | | return iqiyiUtil.getPlayUrl(detailSystemId, resourceid + "", type, id); |
| | | } else if (resourceid == 14) {// 搜狐 |
| | |
| | | else if (resourceid == 19)// 乐视 |
| | | return funTVService.getPlayUrl(detailSystemId, id, type, resourceid, videoid); |
| | | else if (resourceid == FunTVUtil2.RESOURCE_ID)// 风行 |
| | | return funTV2Service.getPlayUrl(detailSystemId, resourceid, id, videoid); |
| | | return funTV2Service.getPlayUrl(acceptData, detailSystemId, resourceid, id, videoid); |
| | | return null; |
| | | } |
| | | } |
New file |
| | |
| | | package com.newvideo.vo; |
| | | |
| | | public class AcceptData { |
| | | |
| | | private String method; |
| | | private String device; |
| | | private String system; |
| | | private String sign; |
| | | private String platform; |
| | | private String channel; |
| | | private Integer version; |
| | | private String Package; |
| | | |
| | | public String getMethod() { |
| | | return method; |
| | | } |
| | | |
| | | public void setMethod(String method) { |
| | | this.method = method; |
| | | } |
| | | |
| | | public String getDevice() { |
| | | return device; |
| | | } |
| | | |
| | | public void setDevice(String device) { |
| | | this.device = device; |
| | | } |
| | | |
| | | public String getSystem() { |
| | | return system; |
| | | } |
| | | |
| | | public void setSystem(String system) { |
| | | this.system = system; |
| | | } |
| | | |
| | | public String getSign() { |
| | | return sign; |
| | | } |
| | | |
| | | public void setSign(String sign) { |
| | | this.sign = sign; |
| | | } |
| | | |
| | | public String getPlatform() { |
| | | return platform; |
| | | } |
| | | |
| | | public void setPlatform(String platform) { |
| | | this.platform = platform; |
| | | } |
| | | |
| | | public String getChannel() { |
| | | return channel; |
| | | } |
| | | |
| | | public void setChannel(String channel) { |
| | | this.channel = channel; |
| | | } |
| | | |
| | | public Integer getVersion() { |
| | | return version; |
| | | } |
| | | |
| | | public void setVersion(Integer version) { |
| | | this.version = version; |
| | | } |
| | | |
| | | public String getPackage() { |
| | | return Package; |
| | | } |
| | | |
| | | public void setPackage(String aPackage) { |
| | | Package = aPackage; |
| | | } |
| | | } |
| | |
| | | ### |
| | | ###debug,stdout,D,E off,file |
| | | log4j.rootLogger = info,stdout,I,E |
| | | log4j.rootLogger = INFO,stdout,I,E |
| | | |
| | | ### |
| | | log4j.appender.stdout = org.apache.log4j.ConsoleAppender |