Explorar o código

加入百度统计

chao %!s(int64=4) %!d(string=hai) anos
pai
achega
698f521435

+ 5 - 0
src/main/java/com/caimei/www/controller/BaseController.java

@@ -23,6 +23,9 @@ public class BaseController {
 	@Value("${caimei.spiServer}")
     private String spiServer;
     /** 打包时间 */
+    @Value("${caimei.siteEnv}")
+    private String siteEnv;
+    /** 打包时间 */
     @Value("${spring.application.build-time}")
     private String buildTime;
     /** 错误页面 */
@@ -42,6 +45,8 @@ public class BaseController {
 	 */
 	@ModelAttribute
 	public Model init(final Model model, ServerHttpRequest request) {
+		// 环境变量,(2:正式环境,1:测试环境,0:开发环境)
+	    model.addAttribute("siteEnv", siteEnv);
 		// 判断请求设备
 		List<String> strings = request.getHeaders().get("User-Agent");
 		String agent = strings!=null ? strings.get(0) : "";

+ 1 - 0
src/main/resources/config/beta/application-beta.yml

@@ -48,6 +48,7 @@ logging:
 
 # 服务域名
 caimei:
+  siteEnv: 1 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
   spiServer: https://spi-b.caimei365.com
   imageDomain: https://img-b.caimei365.com
   wwwDomain: https://www-b.caimei365.com

+ 1 - 0
src/main/resources/config/dev/application-dev.yml

@@ -52,6 +52,7 @@ logging:
 
 # 服务域名
 caimei:
+  siteEnv: 0 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
   spiServer: http://192.168.2.68:8008
   imageDomain: https://img-b.caimei365.com
   wwwDomain: https://www-b.caimei365.com

+ 1 - 0
src/main/resources/config/prod/application-prod.yml

@@ -48,6 +48,7 @@ logging:
 
 # 服务域名
 caimei:
+  siteEnv: 2 #网站环境,(2:正式环境,1:测试环境,0:开发环境)
   spiServer: https://spi.caimei365.com
   imageDomain: https://img.caimei365.com
   wwwDomain: https://www.caimei365.com

+ 1 - 0
src/main/resources/templates/components/head-link.html

@@ -13,3 +13,4 @@
     <link th:href="@{/css/base/init.css(v=${version})}" rel="stylesheet" type="text/css">
     <link th:href="@{/css/base/base.h5.css(v=${version})}" media="screen and (max-width:768px)" rel="stylesheet" type="text/css">
     <link th:href="@{/css/base/base.pc.css(v=${version})}" media="screen and (min-width:768px)" rel="stylesheet" type="text/css">
+    <script th:if="${siteEnv}==2">var _hmt=_hmt||[];(function(){var hm=document.createElement("script");hm.src = "https://hm.baidu.com/hm.js?ccdb07ae255aa2a1d68c7c725a40d99c";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(hm,s);})();</script>

+ 1 - 0
src/main/resources/templates/index.html

@@ -3,6 +3,7 @@
       xsi:schemaLocation="https://www.thymeleaf.org ">
 <head>
     <title>采美365网-中国美业全方位线上交易服务互动平台,做美业,上采美</title>
+    <meta name="baidu-site-verification" content="KbkRJg9357"/>
     <template th:replace="components/head-link"></template>
     <link th:href="@{/css/index/index.h5.css(v=${version})}" media="screen and (max-width:768px)" rel="stylesheet" type="text/css">
     <link th:href="@{/css/index/index.pc.css(v=${version})}" media="screen and (min-width:768px)" rel="stylesheet" type="text/css">