package cn.newfeifan.mall.module.member.mq.producer.sharePath;

import cn.newfeifan.mall.module.member.message.share.SharePathCreateMessage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 创建人员与平台之间的关系 Producer
 *
 * @author owen
 */
@Slf4j
@Component
public class SharePathProducer {

    @Resource
    private ApplicationContext applicationContext;

    /**
     * 发送 {@link SharePathCreateMessage} 消息
     *
     * @param linkId 推荐链接编号
     * @param descendant 直推人
     */
    public void sendSharePathCreatMessage(Long linkId,Long descendant) {
        applicationContext.publishEvent(new SharePathCreateMessage().setLinkId(linkId).setDescendant(descendant));
    }

}
