Explorar el Código

更新文件 articleTweetAction.java

陈士柏 hace 2 años
padre
commit
cdc65e6a52
Se han modificado 1 ficheros con 29 adiciones y 0 borrados
  1. 29 0
      mhotel/src/com/happy/action/articleTweetAction.java

+ 29 - 0
mhotel/src/com/happy/action/articleTweetAction.java

@@ -1272,5 +1272,34 @@ public class articleTweetAction extends BaseController implements ModelDriven<Ar
         return null;
     }
 
+    /**
+     * 点赞数前三的推文
+     */
+    public String queryTop3ArticleLike() {
+        JSONObject jsonObject = new JSONObject();
+        List<ArticleLikeMaxVo> result = articleTweetService.queryTop3ArticleLike();
+        if (result != null) {
+            for (int i = 0; i < result.size(); i++) {
+                List<FileInfo> fileInfos = articleTweetService.queryList("and link_id = " + result.get(i).getId() + "");
+                if (fileInfos != null) {
+                    if (fileInfos.size() > 1) {
+                        result.get(i).setImage(fileInfos.get(0).getUrl());
+                    } else if (fileInfos.size() == 1) {
+                        String url = fileInfos.get(0).getUrl();
+                        if (!url.endsWith("jpg") && !url.endsWith("png")) {
+                            result.get(i).setVideo(fileInfos.get(0).getUrl());
+                        } else {
+                            result.get(i).setImage(url);
+                        }
+                    }
+                }
+            }
+        }
+        jsonObject.put("code", ResultStatusCode.OK.getStatus());
+        jsonObject.put("message", "请求成功");
+        jsonObject.put("data", result);
+        ResponseUtil.writeJson(ServletActionContext.getResponse(), jsonObject.toString());
+        return null;
+    }
 
 }