Exemplo n.º 1
0
def showComments():

    if request.method == 'POST':
        data = request.json

        try:
            comments = CommentService.get_comments(post_id=data['id'])
            count = CommentService.get_comments_count(post_id=data['id'])
        except:
            return json.dumps({'has_error':True, 'message':"查询出错"})


        if not count:
            return jsonify(success=True, count=0, message="没有评论")
        else:
            return  jsonify(success=True, count=count, info=comments)
Exemplo n.º 2
0
def post(id):
    post = PostService.get_one(id)
    comment = CommentService.get_comments(id)

    return render_template('admin/posts.html', post=post, comment=comment)