Преглед на файлове

头像和评论逻辑调整

huangct преди 8 години
родител
ревизия
c64b11c9a8

+ 5 - 5
jpress-model/src/main/java/io/jpress/model/query/CommentQuery.java

@@ -138,16 +138,16 @@ public class CommentQuery extends JBaseQuery {
 		StringBuilder fromBuilder = new StringBuilder("  from comment c");
 		fromBuilder.append(" left join content on c.content_id = content.id");
 		fromBuilder.append(" left join user u on c.user_id = u.id ");
-		fromBuilder.append(" left join comment quote_comment on c.parent_id = quote_comment.id");
+		fromBuilder.append(" left join comment quote_comment on c.id = quote_comment.parent_id");
 		fromBuilder.append(" left join user quote_user on quote_comment.user_id = quote_user.id ");
 
 		fromBuilder.append(" WHERE c.status <> '" + Comment.STATUS_DELETE + "' ");
 
 		if (hasSon == true) {
-			fromBuilder.append("and c.parent_id is not null ");
+			fromBuilder.append("and quote_comment.parent_id is not null ");
 		} else {
 			//不找作者本身的回复(需再思考  数量和实际显示)
-			fromBuilder.append("and c.parent_id is null and c.user_id != content.user_id ");
+			fromBuilder.append("and c.parent_id is null and quote_comment.id is null  and c.user_id != content.user_id ");
 		}
 
 		LinkedList<Object> params = new LinkedList<Object>();
@@ -228,9 +228,9 @@ public class CommentQuery extends JBaseQuery {
 			count = DAO.doFindCount("content_module = ? and parent_id is not null and content_id = ?", module ,contentId);
 		} else {
 			if (authorUserId == null) {
-				count = DAO.doFindCount("content_module = ? and parent_id is null and content_id = ? ", module ,contentId);
+				count = DAO.doFindCount("id NOT IN (select c.parent_id from comment c where c.parent_id IS NOT null) and content_module = ? and parent_id is null and content_id = ? ", module ,contentId);
 			} else {
-				count = DAO.doFindCount("content_module = ? and parent_id is null and content_id = ? and user_id != ?", module ,contentId ,authorUserId);
+				count = DAO.doFindCount("id NOT IN (select c.parent_id from comment c where c.parent_id IS NOT null) and content_module = ? and parent_id is null and content_id = ? and user_id != ?", module ,contentId ,authorUserId);
 			}
 		}
 

+ 6 - 2
jpress-web-admin/src/main/webapp/WEB-INF/admin/comment/uuHelperGroupDetail.html

@@ -155,10 +155,14 @@
                                 <td>
                                     <div class="messageContent">
                                         <div class="leftImg">
-                                            <img src="${(bean.user.avatar)!CPATH+'/static/jpress/admin/image/nothumbnail.jpg'}" alt="头像">
+                                            <#if bean?? && bean.uu_user_avatar??>
+                                                <img src="${(bean.uu_user_avatar)!}" alt="头像">
+                                                <#else>
+                                                    <img src="${CPATH}/static/jpress/admin/image/defaultUuUserPhoto.png" alt="头像">
+                                            </#if>
                                         </div>
                                         <div class="rightContent">
-                                            <p>${bean.author!}</p>
+                                            <p>${bean.author!}<#if bean?? && bean.user_id?? && bean.getContentUserId() == bean.user_id>(作者)</#if></p>
                                             <span>${bean.text!}<#if "draft" == bean.status!>(待审核)<#elseif "delete" == bean.status!>(垃圾箱)</#if></span>
                                         </div>
                                     </div>