huangzhiguo 1 år sedan
förälder
incheckning
20a26999ee

+ 21 - 11
src/main/java/com/caimei/www/controller/unlimited/ArticleController.java

@@ -206,6 +206,8 @@ public class ArticleController extends BaseController {
         String subReferer = "";
         if (referer.length() > 200) {
             subReferer = referer.substring(0, 190);
+        } else {
+            subReferer = referer;
         }
         source = source(referer);
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -338,26 +340,34 @@ public class ArticleController extends BaseController {
     private String source(String link) {
         if (link.contains("baidu.com")) {
             return "1";
-        } else if (link.contains("www.so.com")) {
+        }
+        if (link.contains("www.so.com")) {
             return "2";
-        } else if (link.contains("google")) {
+        }
+        if (link.contains("google")) {
             return "3";
-        } else if (link.contains("m.sm.cn")) {
+        }
+        if (link.contains("m.sm.cn")) {
             return "4";
-        } else if (link.contains("toutiao.com")) {
+        }
+        if (link.contains("toutiao.com")) {
             return "5";
-        } else if (link.contains("sogou.com")) {
+        }
+        if (link.contains("sogou.com")) {
             return "6";
-        } else if (link.contains("servicewechat.com")) {
+        }
+        if (link.contains("servicewechat.com")) {
             return "7";
-        } else if (link.contains("weibo.com")) {
+        }
+        if (link.contains("weibo.com")) {
             return "8";
-        } else if (link.contains("caimei365.com")) {
-            return "0";
-        } else if (link.contains("zzjtest.gz.aeert.com")) {
+        }
+        if (link.contains("caimei365.com")) {
             return "0";
-        } else {
+        }
+        if (link.contains("zzjtest.gz.aeert.com")) {
             return "0";
         }
+        return null;
     }
 }

+ 21 - 11
src/main/java/com/caimei/www/controller/unlimited/HomeController.java

@@ -68,6 +68,8 @@ public class HomeController extends BaseController {
         String subReferer = "";
         if (referer.length() > 200) {
             subReferer = referer.substring(0, 190);
+        } else {
+            subReferer = referer;
         }
         source = source(referer);
         SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -119,26 +121,34 @@ public class HomeController extends BaseController {
     private String source(String link) {
         if (link.contains("baidu.com")) {
             return "1";
-        } else if (link.contains("so.com")) {
+        }
+        if (link.contains("www.so.com")) {
             return "2";
-        } else if (link.contains("google.cn")) {
+        }
+        if (link.contains("google")) {
             return "3";
-        } else if (link.contains("m.sm.cn")) {
+        }
+        if (link.contains("m.sm.cn")) {
             return "4";
-        } else if (link.contains("toutiao.com")) {
+        }
+        if (link.contains("toutiao.com")) {
             return "5";
-        } else if (link.contains("sogou.com")) {
+        }
+        if (link.contains("sogou.com")) {
             return "6";
-        } else if (link.contains("servicewechat.com")) {
+        }
+        if (link.contains("servicewechat.com")) {
             return "7";
-        } else if (link.contains("weibo.com")) {
+        }
+        if (link.contains("weibo.com")) {
             return "8";
-        } else if (link.contains("caimei365.com")) {
-            return "0";
-        } else if (link.contains("zzjtest.gz.aeert.com")) {
+        }
+        if (link.contains("caimei365.com")) {
             return "0";
-        } else {
+        }
+        if (link.contains("zzjtest.gz.aeert.com")) {
             return "0";
         }
+        return null;
     }
 }