CreateComment 创建评论
(ctx context.Context, comment Comment)
| 57 | |
| 58 | // CreateComment 创建评论 |
| 59 | func (c *commentDAO) CreateComment(ctx context.Context, comment Comment) (int64, error) { |
| 60 | |
| 61 | if err := c.db.WithContext(ctx).Create(&comment).Error; err != nil { |
| 62 | c.l.Error("创建评论失败", zap.Error(err)) |
| 63 | return 0, err |
| 64 | } |
| 65 | return comment.Id, nil |
| 66 | } |
| 67 | |
| 68 | // FindCommentByCommentId 根据commentId查找评论 |
| 69 | func (c *commentDAO) FindCommentByCommentId(ctx context.Context, commentId int64) (Comment, error) { |