Преглед изворни кода

Update PopularFeelingsServiceImpl.java

stjdydayou пре 4 година
родитељ
комит
b37cf21e33

+ 7 - 7
src/main/java/com/zhiqiyun/open/core/service/impl/PopularFeelingsServiceImpl.java

@@ -75,10 +75,10 @@ public class PopularFeelingsServiceImpl extends ServiceImpl<PopularFeelingsMappe
 
                 String[] listKeywords = popular.getKeywords().split(",");
 
-                boolean flag = false;
+                boolean flag = true;
                 for (String k : listKeywords) {
-                    flag = bodyText.contains(k);
-                    if (flag) {
+                    if (!bodyText.contains(k)) {
+                        flag = false;
                         break;
                     }
                 }
@@ -187,10 +187,10 @@ public class PopularFeelingsServiceImpl extends ServiceImpl<PopularFeelingsMappe
                 for (Element element : elements) {
                     String metaName = element.attr("name");
                     String metaContent = element.attr("content");
-                    if ("keywords".equals(metaName)) {
+                    if (StringUtils.equalsIgnoreCase("keywords", metaName)) {
                         keywords = metaContent;
                     }
-                    if ("description".equals(metaName)) {
+                    if (StringUtils.equalsIgnoreCase("description", metaName)) {
                         description = metaContent;
                     }
                 }
@@ -200,8 +200,8 @@ public class PopularFeelingsServiceImpl extends ServiceImpl<PopularFeelingsMappe
                 description = bodyText.length() >= 200 ? bodyText.substring(0, 200) : bodyText;
             }
 
-            if (StringUtils.isBlank(keywords) && StringUtils.isNotBlank(bodyText)) {
-                description = keywords;
+            if (StringUtils.isBlank(keywords) && StringUtils.isNotBlank(description)) {
+                keywords = description;
             }