package com.newfiber.system.builder; import com.github.qcloudsms.SmsMultiSender; import com.newfiber.common.redis.service.RedisService; import com.newfiber.system.domain.SmsConfig; import com.newfiber.system.domain.model.SmsProperties; import com.newfiber.system.template.SmsTemplate; import com.newfiber.system.template.TencentSmsTemplate; import lombok.SneakyThrows; /** * 腾讯云短信构建类 * * @author Chill */ public class TencentSmsBuilder { @SneakyThrows public static SmsTemplate template(SmsConfig sms, RedisService redisService) { SmsProperties smsProperties = new SmsProperties(); smsProperties.setTemplateId(sms.getTemplateId()); smsProperties.setAccessKey(sms.getAccessKey()); smsProperties.setSecretKey(sms.getSecretKey()); smsProperties.setSignName(sms.getSignName()); SmsMultiSender smsSender = new SmsMultiSender(Integer.parseInt(smsProperties.getAccessKey()), sms.getSecretKey()); return new TencentSmsTemplate(smsProperties, smsSender, redisService); } }