diff --git a/contact-center/app/src/main/java/com/chatopera/cc/controller/ApplicationController.java b/contact-center/app/src/main/java/com/chatopera/cc/controller/ApplicationController.java index 433cb239..5d360147 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/controller/ApplicationController.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/controller/ApplicationController.java @@ -54,6 +54,10 @@ public class ApplicationController extends Handler { @Autowired private Cache cache; + @Value("${tongji.baidu.sitekey}") + private String tongjiBaiduSiteKey; + + @RequestMapping("/") public ModelAndView admin(HttpServletRequest request) { // logger.info("[admin] path {} queryString {}", request.getPathInfo(),request.getQueryString()); @@ -85,6 +89,12 @@ public class ApplicationController extends Handler { } } view.addObject("agentStatus", cache.findOneAgentStatusByAgentnoAndOrig(logined.getId(), logined.getOrgi())); + + if (StringUtils.isNotBlank(tongjiBaiduSiteKey) && !StringUtils.equalsIgnoreCase(tongjiBaiduSiteKey, "placeholder")) { + logger.info("tongjiBaiduSiteKey: {}", tongjiBaiduSiteKey); + view.addObject("tongjiBaiduSiteKey", tongjiBaiduSiteKey); + } + return view; } diff --git a/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java b/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java index af59ee0f..eac6588c 100644 --- a/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java +++ b/contact-center/app/src/main/java/com/chatopera/cc/controller/LoginController.java @@ -39,6 +39,7 @@ import org.jasypt.exceptions.EncryptionOperationNotPossibleException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; @@ -90,6 +91,9 @@ public class LoginController extends Handler { @Autowired private ACDWorkMonitor acdWorkMonitor; + @Value("${tongji.baidu.sitekey}") + private String tongjiBaiduSiteKey; + /** * 登录页面 * @@ -149,6 +153,12 @@ public class LoginController extends Handler { if (systemConfig != null) { view.addObject("systemConfig", systemConfig); } + + if (StringUtils.isNotBlank(tongjiBaiduSiteKey) && !StringUtils.equalsIgnoreCase(tongjiBaiduSiteKey, "placeholder")) { + logger.info("tongjiBaiduSiteKey: {}", tongjiBaiduSiteKey); + view.addObject("tongjiBaiduSiteKey", tongjiBaiduSiteKey); + } + return view; } @@ -211,14 +221,14 @@ public class LoginController extends Handler { // 工作状态记录 acdWorkMonitor.recordAgentStatus(agentStatus.getAgentno(), - agentStatus.getUsername(), - agentStatus.getAgentno(), - user.isAdmin(), // 0代表admin - agentStatus.getAgentno(), - MainContext.AgentStatusEnum.OFFLINE.toString(), - MainContext.AgentStatusEnum.READY.toString(), - MainContext.AgentWorkType.MEIDIACHAT.toString(), - orgi, null); + agentStatus.getUsername(), + agentStatus.getAgentno(), + user.isAdmin(), // 0代表admin + agentStatus.getAgentno(), + MainContext.AgentStatusEnum.OFFLINE.toString(), + MainContext.AgentStatusEnum.READY.toString(), + MainContext.AgentWorkType.MEIDIACHAT.toString(), + orgi, null); } catch (Exception e) { logger.error("[login] set agent status", e); diff --git a/contact-center/app/src/main/resources/application.properties b/contact-center/app/src/main/resources/application.properties index e85e7ef3..a80fc153 100644 --- a/contact-center/app/src/main/resources/application.properties +++ b/contact-center/app/src/main/resources/application.properties @@ -228,4 +228,14 @@ endpoints.loggers.enabled=false endpoints.configprops.enabled=false endpoints.mappings.enabled=false endpoints.shutdown.enabled=false -endpoints.trace.enabled=false \ No newline at end of file +endpoints.trace.enabled=false + +############################################## +# 百度统计 Key +# https://tongji.baidu.com/ +# 汇总使用情况:登录,打开页面,etc. +# 登录 -> 管理 -> 新增网站 -> 代码获取 -> 拷贝SiteKey +# hm.src = "https://hm.baidu.com/hm.js?YOUR_SITE_KEY"; +# 加入后在百度统计内点击:代码安装检查,代码检查成功表示安装成功;注意网站域名等一致,数据收集有延迟。 +############################################## +tongji.baidu.sitekey= \ No newline at end of file diff --git a/contact-center/app/src/main/resources/templates/apps/index.html b/contact-center/app/src/main/resources/templates/apps/index.html index b5b626e4..4a3f1e74 100644 --- a/contact-center/app/src/main/resources/templates/apps/index.html +++ b/contact-center/app/src/main/resources/templates/apps/index.html @@ -143,6 +143,15 @@ } } + <#if tongjiBaiduSiteKey??> + var _hmt = _hmt || []; + (function() { + var hm = document.createElement("script"); + hm.src = "https://hm.baidu.com/hm.js?${tongjiBaiduSiteKey}"; + var s = document.getElementsByTagName("script")[0]; + s.parentNode.insertBefore(hm, s); + })(); + #if> diff --git a/contact-center/app/src/main/resources/templates/login.html b/contact-center/app/src/main/resources/templates/login.html index 7db37601..8192e0f9 100644 --- a/contact-center/app/src/main/resources/templates/login.html +++ b/contact-center/app/src/main/resources/templates/login.html @@ -1,7 +1,5 @@ - -
@@ -14,6 +12,7 @@ +