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.ModelCommentLike;
import com.mcwl.resource.mapper.ModelCommentLikeMapper;
import com.mcwl.resource.service.ModelCommentLikeService;
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
public class ModelCommentLikeServiceImpl extends ServiceImpl<ModelCommentLikeMapper, ModelCommentLike> implements ModelCommentLikeService {


    @Autowired
    private 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.MODEL_COMMENT_LIKE_QUEUE, map);
    }


}
