Authored by zhengwen.ge

now下载上报

@@ -26,6 +26,7 @@ @@ -26,6 +26,7 @@
26 <value>/MobvistaUnionRest/addUnion4Mobvista</value> 26 <value>/MobvistaUnionRest/addUnion4Mobvista</value>
27 <value>/ActivateUnionRest/addActivate</value> 27 <value>/ActivateUnionRest/addActivate</value>
28 <value>/ActivateUnionRest/queryActivateDeviceId</value> 28 <value>/ActivateUnionRest/queryActivateDeviceId</value>
  29 + <value>/UnionRest/addYas</value>
29 <value>/jump</value> 30 <value>/jump</value>
30 <value>/go</value> 31 <value>/go</value>
31 <value>/pushUnionOrders</value> 32 <value>/pushUnionOrders</value>
@@ -85,6 +85,6 @@ public class UnionRest { @@ -85,6 +85,6 @@ public class UnionRest {
85 @ResponseBody 85 @ResponseBody
86 public UnionResponse addYas(ClickUnionRequestBO request){ 86 public UnionResponse addYas(ClickUnionRequestBO request){
87 log.info("Enter addYas UnionType is {}",request.getUnion_type()); 87 log.info("Enter addYas UnionType is {}",request.getUnion_type());
88 - 88 + return dingdangService.addYas(request);
89 } 89 }
90 } 90 }
@@ -2,6 +2,8 @@ package com.yoho.unions.server.service; @@ -2,6 +2,8 @@ package com.yoho.unions.server.service;
2 2
3 import com.yoho.service.model.union.request.ActiveUnionRequestBO; 3 import com.yoho.service.model.union.request.ActiveUnionRequestBO;
4 import com.yoho.service.model.union.request.AddUnionRequestBO; 4 import com.yoho.service.model.union.request.AddUnionRequestBO;
  5 +import com.yoho.service.model.union.request.ClickUnionRequestBO;
  6 +import com.yoho.service.model.union.response.UnionResponse;
5 import com.yoho.service.model.union.response.UnionResponseBO; 7 import com.yoho.service.model.union.response.UnionResponseBO;
6 8
7 /** 9 /**
@@ -30,5 +32,7 @@ public interface DingdangService { @@ -30,5 +32,7 @@ public interface DingdangService {
30 32
31 public UnionResponseBO activeUnion(ActiveUnionRequestBO request) throws Exception; 33 public UnionResponseBO activeUnion(ActiveUnionRequestBO request) throws Exception;
32 34
33 - UnionResponseBO addBigData(int beginTime,int endTime); 35 + UnionResponseBO addBigData(int beginTime,int endTime);
  36 +
  37 + UnionResponse addYas(ClickUnionRequestBO request);
34 } 38 }
@@ -14,6 +14,7 @@ import com.yoho.unions.common.enums.SourceEnum; @@ -14,6 +14,7 @@ import com.yoho.unions.common.enums.SourceEnum;
14 import com.yoho.unions.common.redis.RedisValueCache; 14 import com.yoho.unions.common.redis.RedisValueCache;
15 import com.yoho.unions.common.utils.DateUtil; 15 import com.yoho.unions.common.utils.DateUtil;
16 import com.yoho.unions.common.utils.HttpUtils; 16 import com.yoho.unions.common.utils.HttpUtils;
  17 +import com.yoho.unions.common.utils.RandomUtil;
17 import com.yoho.unions.dal.IMktMarketingUrlDAO; 18 import com.yoho.unions.dal.IMktMarketingUrlDAO;
18 import com.yoho.unions.dal.IUnionActivityLogsDAO; 19 import com.yoho.unions.dal.IUnionActivityLogsDAO;
19 import com.yoho.unions.dal.IUnionClickLogsDAO; 20 import com.yoho.unions.dal.IUnionClickLogsDAO;
@@ -341,17 +342,34 @@ public class DingdangServiceImpl implements DingdangService { @@ -341,17 +342,34 @@ public class DingdangServiceImpl implements DingdangService {
341 return response; 342 return response;
342 } 343 }
343 344
  345 + @Override
344 public UnionResponse addYas(ClickUnionRequestBO request){ 346 public UnionResponse addYas(ClickUnionRequestBO request){
345 347
346 String unionType = request.getUnion_type(); 348 String unionType = request.getUnion_type();
347 String ak = "yohoboys_m"; 349 String ak = "yohoboys_m";
348 - String cd = unionType; 350 + String random = RandomUtil.getRandom(5);
  351 + int ts = DateUtil.getCurrentTimeSecond();
  352 + //唯一标示;与大数据产品确认用时间戳+5
  353 + String cd = ts+random;
  354 +
349 String ckf="Y"; 355 String ckf="Y";
350 String op = "YN_DOWNLOAD_C"; 356 String op = "YN_DOWNLOAD_C";
351 - int ts = DateUtil.getCurrentTimeSecond(); 357 +
352 StringBuffer sf = new StringBuffer(); 358 StringBuffer sf = new StringBuffer();
353 -// sf.append(yasUrl).append("?h=").append()  
354 - return null; 359 + String url = sf.append(yasUrl).append("?h==m.yohobuy.com")
  360 + .append("&p=&u=/&ft=117&fst=410&sv=2.1.1&ab=&apf=N")
  361 + .append("&ak=").append(ak).append("&cd=").append(cd)
  362 + .append("&vd=14839465348061412675814&ud=&rf=").append("&ckf=").append(ckf)
  363 + .append("&ts=").append(ts).append("&mktc=").append(unionType)
  364 + .append("&op=").append(op)
  365 + .append("&sr=360x640&wr=360x640&sd=32&ln=zh-CN&sy=Linux%20aarch64&ce=true&fv=0").toString();
  366 + Pair<Integer, String> pair = HttpUtils.httpGet(url);
  367 + log.info("addYas sendUrl union success url={}, and result={}", url, pair);
  368 + if (pair.getLeft() != 200) {
  369 + log.warn("addYas callback error with request={}", url);
  370 + return new UnionResponse(204, "callback error");
  371 + }
  372 + return new UnionResponse();
355 } 373 }
356 374
357 } 375 }
@@ -13,20 +13,6 @@ @@ -13,20 +13,6 @@
13 13
14 var jumpTypes = [110]; 14 var jumpTypes = [110];
15 15
16 - (function (w, d, s, j, f) {  
17 - w['YohoAcquisitionObject'] = f;  
18 - w[f] = function () {  
19 - w[f].p = arguments;  
20 - };  
21 - var a = d.createElement(s);  
22 - var m = d.getElementsByTagName(s)[0];  
23 - a.async = 1;  
24 - a.src = j;  
25 - m.parentNode.insertBefore(a, m);  
26 - })(window, document, 'script', '//cdn.yoho.cn/yas-jssdk/1.0.16/yas.js', '_yas');  
27 - _yas(1 * new Date(), '1.0.16', 'yohoboys_m', '', '');  
28 -  
29 -  
30 function isInJump(unionType) { 16 function isInJump(unionType) {
31 for (var i = 0 ;i < jumpTypes.length; i++) { 17 for (var i = 0 ;i < jumpTypes.length; i++) {
32 if (unionType == jumpTypes[i]) { 18 if (unionType == jumpTypes[i]) {
@@ -49,11 +35,26 @@ @@ -49,11 +35,26 @@
49 } 35 }
50 return vars; 36 return vars;
51 } 37 }
  38 + downUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=cn.yoho.magazine';
  39 + queryString = getQueryString();
  40 + $.ajax({
  41 + method: 'POST',
  42 +// url: 'http://union.yoho.cn/union/UnionRest/addYas',
  43 + url: 'http://127.0.0.1:8088/union/UnionRest/addYas',
  44 + data: {
  45 + union_type: queryString.union_type,
  46 +
  47 + },
  48 + complete: function(){
  49 + window.location.href = downUrl;
  50 + window.setTimeout(function(){
  51 + window.location.href = "http://m.yohobuy.com";
  52 + }, 2000);
  53 + }});
  54 +
52 55
53 - queryString = getQueryString();  
54 - downUrl = 'http://a.app.qq.com/o/simple.jsp?pkgname=cn.yoho.magazine';  
55 //downUrl = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8"; 56 //downUrl = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
56 - window.location.href = downUrl; 57 +// window.location.href = downUrl;
57 58
58 59
59 60