Authored by ping

update

... ... @@ -144,6 +144,48 @@ public class ClickUnionRest {
String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
log.info("addUnion4Special version={}", version);
}
@RequestMapping("/addUnion4Jump")
public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
bo.setClientIp(RemoteIPInterceptor.getRemoteIP());
String agent = request.getHeader("user-agent");
agent = agent.toLowerCase();
log.info("addUnion4Stream user-agent={}", agent);
String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
try {
if (!StringUtils.isEmpty(agent)) {
if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0) {
String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
bo.setTd("ios_" + version.replaceAll("_", "."));
bo.setClient_type("ios");
bo.setAppid("490655927");
url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
} else {
String version = agent.substring(agent.indexOf("android") + 8, 3);
bo.setTd("android_" + version.replaceAll("_", ""));
bo.setClient_type("android");
bo.setAppid("com.yoho");
}
}
} catch (Exception e) {
log.error("addUnion4Stream error with request={}", bo, e);
}
try {
StringBuffer stringBuffer = new StringBuffer();
String bean = stringBuffer.append("UnionServiceImpl").append("_").append(bo.getUnion_type()).toString();
boolean containsBean = SpringContextUtil.containsBean(bean);
if (containsBean) {
IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
bo = service.clickHttpRequestTOBO(request, bo);
}
unionService.clickUnion(bo);
log.info("addUnion4Stream with request is {}", bo);
response.setStatus(200);
response.sendRedirect(url);
} catch (Exception e) {
log.error("addUnion4Stream error with request={}", bo, e);
}
}
@RequestMapping("/addMonitor")
@ResponseBody
... ...