package com.mcwl.resource.service.impl;

import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
import com.mcwl.resource.service.ModelImageCommentLikeService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;

/**
 * 图片评论点赞
 */
@Service
@RequiredArgsConstructor
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {


    private final RabbitTemplate rabbitTemplate;


    @Override
    public void  like(Long commentId) {
        Map<String, Long> map = new HashMap<>();
        map.put("userId", SecurityUtils.getUserId());
        map.put("commentId", commentId);
        rabbitTemplate.convertAndSend(QueueConstants.IMAGE_COMMENT_LIKE_QUEUE, map);
    }



}
