You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sonic/handler/content/api/comment.go

27 lines
592 B
Go

package api
import (
"github.com/gin-gonic/gin"
"github.com/go-sonic/sonic/service"
"github.com/go-sonic/sonic/util"
)
type CommentHandler struct {
BaseCommentService service.BaseCommentService
}
func NewCommentHandler(baseCommentService service.BaseCommentService) *CommentHandler {
return &CommentHandler{
BaseCommentService: baseCommentService,
}
}
func (c *CommentHandler) Like(ctx *gin.Context) (interface{}, error) {
commentID, err := util.ParamInt32(ctx, "commentID")
if err != nil {
return nil, err
}
return nil, c.BaseCommentService.IncreaseLike(ctx, commentID)
}