package com.fzm.mall.server.admin.mq.consumer.message_center;

import com.fzm.mall.server.admin.message.entity.dto.SmsBatchDTO;
import com.fzm.mall.server.admin.util.AliCloudSmsUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author wangp
 * @date 2021/5/7 10:24
 * @description 发送短信
 * @since JDK 1.8
 */
@Component
@Slf4j
public class SmsSendConsumer {

    @RabbitListener(queues = "ly.send.timing.sms.queue")
    public void querySmsTemplateCheck(Object obj) {
        SmsBatchDTO smsBatchDTO = (SmsBatchDTO) obj;
        //TODO check 循环调用直到请求成功
        AliCloudSmsUtil.sendBatchSms(smsBatchDTO);
    }
}
