|
@@ -6,6 +6,10 @@ package com.yoho.unions.server.restapi; |
|
@@ -6,6 +6,10 @@ package com.yoho.unions.server.restapi; |
6
|
import java.util.concurrent.ExecutorService;
|
6
|
import java.util.concurrent.ExecutorService;
|
7
|
import java.util.concurrent.Executors;
|
7
|
import java.util.concurrent.Executors;
|
8
|
|
8
|
|
|
|
9
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
10
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
11
|
+
|
|
|
12
|
+import org.apache.commons.lang.StringUtils;
|
9
|
import org.slf4j.Logger;
|
13
|
import org.slf4j.Logger;
|
10
|
import org.slf4j.LoggerFactory;
|
14
|
import org.slf4j.LoggerFactory;
|
11
|
import org.springframework.beans.BeanUtils;
|
15
|
import org.springframework.beans.BeanUtils;
|
|
@@ -44,11 +48,22 @@ public class ActivateUnionRest { |
|
@@ -44,11 +48,22 @@ public class ActivateUnionRest { |
44
|
* @return
|
48
|
* @return
|
45
|
*/
|
49
|
*/
|
46
|
@RequestMapping("/activateUnion")
|
50
|
@RequestMapping("/activateUnion")
|
47
|
- @ResponseBody public ActiveUnionResponseBO activateUnion(ActivateUnionRequestVO vo) {
|
51
|
+ @ResponseBody public ActiveUnionResponseBO activateUnion(ActivateUnionRequestVO vo, HttpServletRequest request, HttpServletResponse response) {
|
48
|
log.info("activateUnion with param is {}", vo);
|
52
|
log.info("activateUnion with param is {}", vo);
|
49
|
if ("iphone".equals(vo.getClient_type())) {
|
53
|
if ("iphone".equals(vo.getClient_type())) {
|
50
|
vo.setClient_type(ClientTypeEnum.IOS.getName());
|
54
|
vo.setClient_type(ClientTypeEnum.IOS.getName());
|
51
|
}
|
55
|
}
|
|
|
56
|
+ String agent = request.getHeader("user-agent");
|
|
|
57
|
+ log.info("addMonitor user-agent={}", agent);
|
|
|
58
|
+ if (StringUtils.isEmpty(vo.getTd()) && StringUtils.isNotEmpty(agent)) {
|
|
|
59
|
+ if (agent.toLowerCase().indexOf("mac os x") >= 0 || agent.toLowerCase().indexOf("iphone") >= 0) {
|
|
|
60
|
+ String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
|
|
|
61
|
+ vo.setTd("ios_" + version.replaceAll("_", "."));
|
|
|
62
|
+ log.info("activateUnion request={}", vo);
|
|
|
63
|
+ }
|
|
|
64
|
+ }
|
|
|
65
|
+
|
|
|
66
|
+
|
52
|
ActivateUnionRequestBO bo = new ActivateUnionRequestBO();
|
67
|
ActivateUnionRequestBO bo = new ActivateUnionRequestBO();
|
53
|
BeanUtils.copyProperties(vo, bo);
|
68
|
BeanUtils.copyProperties(vo, bo);
|
54
|
String clientType = vo.getClient_type();
|
69
|
String clientType = vo.getClient_type();
|