短信提交 2021-03-24,调整下短信发送 API

This commit is contained in:
YunaiV
2021-03-24 00:52:40 +08:00
parent 162d604644
commit 3acdec965d
52 changed files with 219 additions and 378 deletions

View File

@@ -1,29 +0,0 @@
package cn.iocoder.dashboard.framework.redis.core.util;
import cn.iocoder.dashboard.modules.system.redis.stream.sms.SmsSendMessage;
import org.springframework.data.redis.connection.stream.StreamRecords;
import org.springframework.data.redis.core.RedisTemplate;
/**
* Redis 消息工具类
*
* @author 芋道源码
*/
public class RedisStreamUtils {
public static final String KEY_SMS_SEND = "stream_sms_send";
public static final String GROUP_SMS_SEND = "group_sms_send";
/**
* 发送 Redis 消息,基于 Redis pub/sub 实现
*
* @param redisTemplate Redis 操作模板
* @param message 消息
*/
public static void sendChannelMessage(RedisTemplate<String, ?> redisTemplate, SmsSendMessage message) {
redisTemplate.opsForStream().add(StreamRecords.newRecord().ofObject(message).withStreamKey(KEY_SMS_SEND));
}
}

View File

@@ -102,7 +102,7 @@ public class SmsClientFactory {
public String getTemplateApiIdByCode(String templateCode) {
SmsTemplateProperty smsTemplateProperty = templatePropertyMap.get(templateCode);
if (smsTemplateProperty == null) {
throw new ServiceException(SMS_TEMPLATE_NOT_FOUND);
throw new ServiceException(SMS_TEMPLATE_NOT_EXISTS);
}
return smsTemplateProperty.getApiTemplateId();
}