def addThirdComment(): form = request.json comment_id = form['comment_id'] comment_id = int(comment_id) #文章的id article_id = form['article_id'] #评论用户的id user_id = form['user_id'] #对谁评论的id to_user = form['to_user'] to_user = int(to_user) content = form['content'] with db.auto_commit(): comment = Comment() comment.article_id = article_id comment.article_type = 1 comment.from_uid = user_id comment.to_uid = to_user comment.origin_uid = to_user comment.content = content comment.comment_id = comment_id db.session.add(comment) article = Article.query.filter_by(id=article_id).first() article.comments += 1 return jsonify({'code': 0, 'message': '二级评论成功'})