package like

import (
	"github.com/gin-gonic/gin"
	"hongze/hongze_yb/controller/response"
	"hongze/hongze_yb/models/request/like"
	likeService "hongze/hongze_yb/services/like"
	userService "hongze/hongze_yb/services/user"
)

// SetLike 点赞设置
func SetLike(c *gin.Context) {
	var req like.ReqLike
	if c.ShouldBind(&req) != nil {
		response.Fail("参数异常", c)
		return
	}
	userinfo := userService.GetInfoByClaims(c)

	data, err := likeService.SetLike(userinfo, req)
	if err != nil {
		response.Fail(err.Error(), c)
		return
	}
	response.OkData("操作成功", data, c)
	return
}