Search in sources :

Example 1 with Comment

use of com.tale.model.dto.Comment in project tale by otale.

the class Theme method comments.

/**
 * 获取当前文章/页面的评论
 *
 * @param limit
 * @return
 */
public static Page<Comment> comments(int limit) {
    Contents contents = current_article();
    if (null == contents) {
        return new Page<>();
    }
    InterpretContext ctx = InterpretContext.current();
    Object value = ctx.getValueStack().getValue("cp");
    int page = 1;
    if (null != value) {
        page = (int) value;
    }
    Page<Comment> comments = siteService.getComments(contents.getCid(), page, limit);
    return comments;
}
Also used : Comment(com.tale.model.dto.Comment) Contents(com.tale.model.entity.Contents) InterpretContext(jetbrick.template.runtime.InterpretContext) Page(io.github.biezhi.anima.page.Page)

Example 2 with Comment

use of com.tale.model.dto.Comment in project tale by otale.

the class CommentsService method apply.

private Comment apply(Comments parent) {
    Comment comment = new Comment(parent);
    List<Comments> children = new ArrayList<>();
    getChildren(children, comment.getCoid());
    comment.setChildren(children);
    if (BladeKit.isNotEmpty(children)) {
        comment.setLevels(1);
    }
    return comment;
}
Also used : Comment(com.tale.model.dto.Comment) Comments(com.tale.model.entity.Comments) ArrayList(java.util.ArrayList)

Aggregations

Comment (com.tale.model.dto.Comment)2 Comments (com.tale.model.entity.Comments)1 Contents (com.tale.model.entity.Contents)1 Page (io.github.biezhi.anima.page.Page)1 ArrayList (java.util.ArrayList)1 InterpretContext (jetbrick.template.runtime.InterpretContext)1