Showing
1 changed file
with
42 additions
and
0 deletions
@@ -144,6 +144,48 @@ public class ClickUnionRest { | @@ -144,6 +144,48 @@ public class ClickUnionRest { | ||
144 | String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like")); | 144 | String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like")); |
145 | log.info("addUnion4Special version={}", version); | 145 | log.info("addUnion4Special version={}", version); |
146 | } | 146 | } |
147 | + | ||
148 | + @RequestMapping("/addUnion4Jump") | ||
149 | + public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) { | ||
150 | + bo.setClientIp(RemoteIPInterceptor.getRemoteIP()); | ||
151 | + String agent = request.getHeader("user-agent"); | ||
152 | + agent = agent.toLowerCase(); | ||
153 | + log.info("addUnion4Stream user-agent={}", agent); | ||
154 | + String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk"; | ||
155 | + try { | ||
156 | + if (!StringUtils.isEmpty(agent)) { | ||
157 | + if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0) { | ||
158 | + String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like")); | ||
159 | + bo.setTd("ios_" + version.replaceAll("_", ".")); | ||
160 | + bo.setClient_type("ios"); | ||
161 | + bo.setAppid("490655927"); | ||
162 | + url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8"; | ||
163 | + } else { | ||
164 | + String version = agent.substring(agent.indexOf("android") + 8, 3); | ||
165 | + bo.setTd("android_" + version.replaceAll("_", "")); | ||
166 | + bo.setClient_type("android"); | ||
167 | + bo.setAppid("com.yoho"); | ||
168 | + } | ||
169 | + } | ||
170 | + } catch (Exception e) { | ||
171 | + log.error("addUnion4Stream error with request={}", bo, e); | ||
172 | + } | ||
173 | + try { | ||
174 | + StringBuffer stringBuffer = new StringBuffer(); | ||
175 | + String bean = stringBuffer.append("UnionServiceImpl").append("_").append(bo.getUnion_type()).toString(); | ||
176 | + boolean containsBean = SpringContextUtil.containsBean(bean); | ||
177 | + if (containsBean) { | ||
178 | + IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class); | ||
179 | + bo = service.clickHttpRequestTOBO(request, bo); | ||
180 | + } | ||
181 | + unionService.clickUnion(bo); | ||
182 | + log.info("addUnion4Stream with request is {}", bo); | ||
183 | + response.setStatus(200); | ||
184 | + response.sendRedirect(url); | ||
185 | + } catch (Exception e) { | ||
186 | + log.error("addUnion4Stream error with request={}", bo, e); | ||
187 | + } | ||
188 | + } | ||
147 | 189 | ||
148 | @RequestMapping("/addMonitor") | 190 | @RequestMapping("/addMonitor") |
149 | @ResponseBody | 191 | @ResponseBody |
-
Please register or login to post a comment