1d4877c37ac5a9ca4f720faf77a9cb328d6d5e46.svn-base
5.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.io.PrintWriter"%>
<%@ page import="com.espeed.reading.util.ConfigPath"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
if (request.getServerPort() == 443) {
basePath = "https://" + request.getServerName() + ":"
+ request.getServerPort() + path + "/";
}
String t = request.getParameter("t");
String cid = request.getParameter("cid");
String uid = request.getParameter("uid");
String subscribe = request.getParameter("subscribe");
String jsCode = "";
PrintWriter writer = null;
try {
if (subscribe != null && subscribe.equalsIgnoreCase("true")) {//询盘
jsCode = "function ywx_postRequest() { console.log('tongji start...'); var f = new Array(); var c = document.getElementById('ywx_email'), d = document .getElementById('ywx_companyid'); if(c != null && d != null) { var e = new RegExp('"
+ ConfigPath.getEmailPattern()
+ "'); if(e.toLowerCase().test(c.value)) { f.push('ywxType=7'); f.push('ywxTitle=' + encodeURIComponent(document.title)); f.push('ywxReferrer=' + encodeURIComponent(document.referrer)); f.push('ywxCookie=' + navigator.cookieEnabled); f.push('ywxX=' + window.screen.width); f.push('ywxH=' + window.screen.height); f.push('ywxTo=' + encodeURIComponent(location.href)); f.push('ywxUid=0'); f.push('ywxCid=' + d.value); f.push('ywxMid=0'); f.push('ywxMail=' + c.value); f.push('r=' + Math.random()); (new Image()).src = 'RURL/track_recordFromHTML.action?' + f.join('&'); } } }";
} else {
if(t != null && t.equals("8") && uid != null && uid.matches("^[0-9]*$")) {//社交帖子
jsCode = "if(window.addEventListener) { window.addEventListener('load', ywx_loadJs, false); } else { window.attachEvent('onload', ywx_loadJs); } function ywx_loadJs() { console.log('tongji start...'); var f = new Array(); var c = 'RCID'; var u = 'RUID'; if(!isNaN(c)) { f.push('ywxType=8'); f.push('ywxTitle=' + encodeURIComponent(document.title)); f.push('ywxReferrer=' + encodeURIComponent(document.referrer)); f.push('ywxCookie=' + navigator.cookieEnabled); f.push('ywxX=' + window.screen.width); f.push('ywxH=' + window.screen.height); f.push('ywxTo=' + encodeURIComponent(location.href)); f.push('ywxCid=' + c); f.push('ywxUid=' + u); f.push('r=' + Math.random()); if(location.href.indexOf('ywxMark=true') == -1) { (new Image()).src = 'RURL/track_recordFromHTML.action?' + f.join('&') } } }";
jsCode = jsCode.replaceFirst("RCID", cid);
jsCode = jsCode.replaceFirst("RUID", uid);
} else {
if (cid == null) {//营销邮邮件
jsCode = "if(window.addEventListener) { window.addEventListener('load', ywx_loadJs, false); } else { window.attachEvent('onload', ywx_loadJs); } function ywx_loadJs() { console.log('tongji start...'); var f = new Array(); var c = document.getElementsByClassName('submitUser'), d = document.getElementsByClassName('submitCompany'), e = document.getElementsByClassName('submitStencil'); if(c.length > 0 && d.length > 0 && e.length > 0) { f.push('ywxType=1'); f.push('ywxTitle=' + encodeURIComponent(document.title)); f.push('ywxReferrer=' + encodeURIComponent(document.referrer)); f.push('ywxCookie=' + navigator.cookieEnabled); f.push('ywxX=' + window.screen.width); f.push('ywxH=' + window.screen.height); f.push('ywxTo=' + encodeURIComponent(location.href)); f.push('ywxUid=' + c[0].value); f.push('ywxCid=' + d[0].value); f.push('ywxMid=' + e[0].value); f.push('r=' + Math.random()); if(location.href.indexOf('ywxMark=true') == -1) { (new Image()).src = 'RURL/track_recordFromHTML.action?' + f.join('&') } } }";
} else {//官网
if (cid.matches("^[0-9]*$")) {
jsCode = "if(window.addEventListener) { window.addEventListener('load', ywx_loadJs, false); } else { window.attachEvent('onload', ywx_loadJs); } function ywx_loadJs() { console.log('tongji start...'); var f = new Array(); var c = 'RCID'; if(!isNaN(c)) { f.push('ywxType=2'); f.push('ywxTitle=' + encodeURIComponent(document.title)); f.push('ywxReferrer=' + encodeURIComponent(document.referrer)); f.push('ywxCookie=' + navigator.cookieEnabled); f.push('ywxX=' + window.screen.width); f.push('ywxH=' + window.screen.height); f.push('ywxTo=' + encodeURIComponent(location.href)); f.push('ywxCid=' + c); f.push('r=' + Math.random()); if(location.href.indexOf('ywxMark=true') == -1) { (new Image()).src = 'RURL/track_recordFromHTML.action?' + f.join('&') } } }";
jsCode = jsCode.replaceFirst("RCID", cid);
}
}
}
}
jsCode = jsCode.replaceFirst("RURL/", basePath);
response.setCharacterEncoding("UTF-8");
response.setContentType("application/javascript");
writer = response.getWriter();
writer.write(jsCode);
writer.flush();
} catch (Exception e) {
System.err.println("异常:"
+ e.getClass().getName()
+ (e.getMessage() == null ? ""
: ("->" + e.getMessage())));
} finally {
if (writer != null) {
writer.close();
}
}
%>