| | |
| | | de.setWatchCount(info.getWatchCount()); |
| | | de.setYear(info.getYear()); |
| | | de.setShare(info.getShare()); |
| | | de.setCanSave(info.getCanSave()); |
| | | de.setCanSave(info.getCanSave() == null ? false : info.getCanSave()); |
| | | de.setResourceList(info.getResourceList()); |
| | | de.setPlayPicture(info.getPlayPicture()); |
| | | de.setShowType(info.getShowType()); |
| | |
| | | de.setCommentCount(info.getCommentCount()); |
| | | de.setUpdatetime(info.getUpdatetime()); |
| | | de.setArea(info.getArea()); |
| | | de.setPageSize(info.getPageSize()); |
| | | return de; |
| | | } |
| | | |
| | |
| | | public final static int TYPE_DANGER_AREA = 2; |
| | | |
| | | public final static int TYPE_DANGER = 3; |
| | | |
| | | public static int getType(HttpServletRequest request, UserInfo user, String detailSystemId) { |
| | | String ip = getIP(request); |
| | | if (!(ip + "").equalsIgnoreCase(user.getIp())) { |
| | | IPUtil.IPInfo ipInfo = IPUtil.getIPInfo(ip); |
| | | user.setIp(ip); |
| | | |
| | | if (ipInfo != null && !StringUtil.isNullOrEmpty(ipInfo.getCity())) { |
| | | user.setCity(ipInfo.getCity()); |
| | | } |
| | | |
| | | if (ipInfo != null && !StringUtil.isNullOrEmpty(ipInfo.getCountry())) { |
| | | user.setCountry(ipInfo.getCountry()); |
| | | } |
| | | new UserService().updateUserInfo(user); |
| | | } |
| | | |
| | | Map<String, String> map = new DetailSystemConfigService().getConfigAsMap(new DetailSystem(SystemUtil.getDetailSystemId() + ""), SystemUtil.getDefaultVersion()); |
| | | String[] detailsystemIds = new String[]{"1", "2", "3", "4", "5", "6", "14", "12", "20", "11"}; |
| | | for (String d : detailsystemIds) { |
| | | if (detailSystemId.equalsIgnoreCase(d)) { |
| | | String dangers = map.get("danger_city"); |
| | | String[] dangerCitys = dangers.split(","); |
| | | for (String c : dangerCitys) |
| | | if (c.equalsIgnoreCase(user.getCity())) {// 北上广深 |
| | | return TYPE_DANGER_AREA; |
| | | } |
| | | return TYPE_DANGER; |
| | | } |
| | | } |
| | | |
| | | return TYPE_NORMAL; |
| | | } |
| | | |
| | | public static String getIP(HttpServletRequest request) { |
| | | String ip = request.getHeader("x-forwarded-for"); |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("Proxy-Client-IP"); |
| | | } |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("WL-Proxy-Client-IP"); |
| | | } |
| | | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getHeader("X-Real-IP"); |
| | | } |
| | | |
| | | if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { |
| | | ip = request.getRemoteAddr(); |
| | | } |
| | | |
| | | return ip; |
| | | |
| | | } |
| | | |
| | | public static String getCoverImage(VideoInfo info) { |
| | | if (!StringUtil.isNullOrEmpty(info.getLatestHpicture())) |