Authored by linlong

update

@@ -15,6 +15,14 @@ public class UnionReqVO{ @@ -15,6 +15,14 @@ public class UnionReqVO{
15 15
16 private String u_id; 16 private String u_id;
17 17
  18 + private String union_type;
  19 +
  20 + private String utm_source;
  21 +
  22 + private String utm_medium;
  23 +
  24 + private String utm_campaign;
  25 +
18 public String getChannel_id() { 26 public String getChannel_id() {
19 return channel_id; 27 return channel_id;
20 } 28 }
@@ -46,5 +54,37 @@ public class UnionReqVO{ @@ -46,5 +54,37 @@ public class UnionReqVO{
46 public void setU_id(String u_id) { 54 public void setU_id(String u_id) {
47 this.u_id = u_id; 55 this.u_id = u_id;
48 } 56 }
  57 +
  58 + public String getUnion_type() {
  59 + return union_type == null ? "" :union_type;
  60 + }
  61 +
  62 + public void setUnion_type(String union_type) {
  63 + this.union_type = union_type;
  64 + }
  65 +
  66 + public String getUtm_source() {
  67 + return utm_source == null ? "" :utm_source ;
  68 + }
  69 +
  70 + public void setUtm_source(String utm_source) {
  71 + this.utm_source = utm_source;
  72 + }
  73 +
  74 + public String getUtm_medium() {
  75 + return utm_medium == null ? "" :utm_medium;
  76 + }
  77 +
  78 + public void setUtm_medium(String utm_medium) {
  79 + this.utm_medium = utm_medium;
  80 + }
  81 +
  82 + public String getUtm_campaign() {
  83 + return utm_campaign == null ? "" : utm_campaign;
  84 + }
  85 +
  86 + public void setUtm_campaign(String utm_campaign) {
  87 + this.utm_campaign = utm_campaign;
  88 + }
49 } 89 }
50 90
@@ -60,10 +60,17 @@ public class RedirectServiceImpl implements IRedirectService{ @@ -60,10 +60,17 @@ public class RedirectServiceImpl implements IRedirectService{
60 60
61 private String builderUrlForPanshi(UnionReqVO uionReqVO){ 61 private String builderUrlForPanshi(UnionReqVO uionReqVO){
62 String param = this.generateReqParam(uionReqVO); 62 String param = this.generateReqParam(uionReqVO);
63 - String targetUrl = uionReqVO.getTarget_url(); 63 + StringBuffer targetUrl = new StringBuffer(uionReqVO.getTarget_url());
  64 + targetUrl = StringUtils.isEmpty(targetUrl) ? new StringBuffer(WAP_URL) : targetUrl;
  65 + if(targetUrl.toString().contains("?")){
  66 + targetUrl.append("&utm_source=").append(uionReqVO.getUtm_source()).append("&utm_medium=").append(uionReqVO.getUtm_medium()).append("&utm_campaign=").append(uionReqVO.getUtm_campaign());
  67 + }else{
  68 + targetUrl.append("?utm_source=").append(uionReqVO.getUtm_source()).append("&utm_medium=").append(uionReqVO.getUtm_medium()).append("&utm_campaign=").append(uionReqVO.getUtm_campaign());
  69 + }
  70 +
64 try { 71 try {
65 param = URLEncoder.encode(param, "UTF-8"); 72 param = URLEncoder.encode(param, "UTF-8");
66 - targetUrl = URLEncoder.encode(targetUrl, "UTF-8"); 73 + targetUrl = new StringBuffer(URLEncoder.encode(targetUrl.toString(), "UTF-8"));
67 } catch (UnsupportedEncodingException e) { 74 } catch (UnsupportedEncodingException e) {
68 logger.warn("builderUrlForPanshi: urlEncode failed: request param is {}", uionReqVO); 75 logger.warn("builderUrlForPanshi: urlEncode failed: request param is {}", uionReqVO);
69 } 76 }