def add_second_comment_lib(self, content, comment_id): comment = Comment.by_id(comment_id) if comment is None: return {'status': False, 'msg': '评论不存在'} second_comment = SecondComment() second_comment.content = content second_comment.comment_id = comment.id second_comment.user_id = self.current_user.id self.db.add(second_comment) self.db.commit() return {'status': True, 'msg': '二级评论成功'}
def add_second_comment_lib(self, commont_id, content): """08文章二级评论添加""" if commont_id is None: return {'status': False, 'msg': '缺少评论ID'} comment = Comment.by_id(commont_id) if comment is None: return {'status': False, 'msg': '评论不存在'} secondComment = SecondComment() secondComment.content = content secondComment.comment_id = commont_id secondComment.user_id = self.current_user.id self.db.add(secondComment) self.db.commit() return {'status': True, 'msg': '二级评论提交成功'}
def second_comment_content_lib(self, comment_content, first_comment_id): ''' 二级评论内容存储 ''' if comment_content == '': return {'status': False, 'msg': '评价不能为看'} first_comment = Comment.by_id(first_comment_id) if first_comment is None: return {'status': False, 'msg': '评价的评论已不存在'} second_comment = SecondComment() second_comment.content = comment_content second_comment.comment_id = first_comment_id second_comment.user_id = self.current_user.id self.db.add(second_comment) self.db.commit() return {'status': True, 'msg': '附加评论成功'}
def add_second_comment_lib(self, content, comment_id): '''二次评论''' if content == '': return {'status': False, 'msg': '请输入评论!'} comment = Comment.by_id(comment_id) if comment is None: return {'status': False, 'msg': '文档不存在!'} second_comment = SecondComment() second_comment.content = content second_comment.comment_id = comment.id second_comment.user_id = self.current_user.id self.db.add(second_comment) self.db.commit() return {'status': True, 'msg': '评论成功!'}