Commit 9452b7e6 authored by Smile's avatar Smile

Merge remote-tracking branch 'origin/jd_dev' into jd_dev

parents 94868831 6cfcd93b
......@@ -8,7 +8,7 @@ INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, `
-- 新增渠道
INSERT INTO `jiedao`.`system_sms_channel`(`id`, `signature`, `code`, `status`, `remark`, `api_key`, `api_secret`, `callback_url`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `signature_en`) VALUES (7, 'sendchamp', 'SENDCHAMP', 0, '', 'ecit@ewchina.net', 'sendchamp_live_$2a$10$vQPdaDjl96Ybc5tzFmZYg.nqGirXuJBGDqJArthZnFR8P9mM5Z/JO', '', '2741', '2024-10-26 17:06:44', '2741', '2024-10-28 15:16:39', b'0', 'sendchamp');
INSERT INTO `jiedao`.`system_sms_channel`(`id`, `signature`, `code`, `status`, `remark`, `api_key`, `api_secret`, `callback_url`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `signature_en`) VALUES (8, 'ycloud', 'YCLOUD', 0, NULL, 'ecit@ewchina.net', 'gAAAAABl5ZDpoKnKVaK0scmWo7GQeKDA1sn3OZBeMXUz211vZv5QqSEtr7_LD5ISTqSD0PnWLRWavYmJ3nQJiutT-sgp0dyHR2HIL6FYEhD3t2CNuoHJoSIOia5ffo_rjfxW_pk8co0i7UMTYANNGxsRNJLQTu_Alw==', NULL, '2741', '2024-10-26 17:12:50', '2741', '2024-10-28 15:16:18', b'0', 'ycloud');
INSERT INTO `jiedao`.`system_sms_channel`(`id`, `signature`, `code`, `status`, `remark`, `api_key`, `api_secret`, `callback_url`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `signature_en`) VALUES (8, 'ycloud', 'YCLOUD', 0, NULL, 'ecit@ewchina.net', '9dbd912f56c101e53b23cb7b758ffda8', NULL, '2741', '2024-10-26 17:12:50', '2741', '2024-10-28 15:16:18', b'0', 'ycloud');
-- 短信日志新增字段
alter table system_sms_log add node_id bigint comment '节点id',add node_template_sn int default 1 comment '节点模板序列号',add message_type tinyint comment '发送类型';
......
......@@ -111,6 +111,8 @@ public class YudaoMQAutoConfiguration {
.autoAcknowledge(false) // 不自动 ack
.cancelOnError(throwable -> false); // 默认配置,发生异常就取消消费,显然不符合预期;因此,我们设置为 false
container.register(builder.build(), listener);
log.info("[redisMessageListenerContainer][注册 streamKey({}) 对应的监听器({})]",
listener.getStreamKey(), listener.getClass().getName());
});
return container;
}
......
......@@ -94,8 +94,12 @@ public class SendchampSmsClient extends AbstractSmsClient {
Map<?, ?> responseObj = JsonUtils.parseObject(result, Map.class);
Map<String, Object> data = (Map<String, Object>) responseObj.get("data");
// 构建发送结果
smsCommonResult = SmsCommonResult.build(String.valueOf(responseObj.get("status")), String.valueOf(responseObj.get("message")), String.valueOf(data.get("business_id")), null, codeMapping);
smsCommonResult.setData(new SmsSendRespDTO().setSerialNo(String.valueOf(data.get("business_id"))));
String id = String.valueOf(data.get("business_id"));
if ("null".equals(id)) {
id = String.valueOf(data.get("id"));
}
smsCommonResult = SmsCommonResult.build(String.valueOf(responseObj.get("message")), String.valueOf(responseObj.get("message")), id, null, codeMapping);
smsCommonResult.setData(new SmsSendRespDTO().setSerialNo(id));
}
} catch (Exception e) {
// 记录发送短信时发生的错误
......@@ -174,6 +178,7 @@ public class SendchampSmsClient extends AbstractSmsClient {
/**
* 短信接收状态
* <p>
*
* @author 捷道源码
*/
@Data
......
......@@ -13,6 +13,9 @@ public class SendchampSmsCodeMapping implements SmsCodeMapping {
public ErrorCode apply(String apiCode) {
switch (apiCode) {
case "accepted": return GlobalErrorCodeConstants.SUCCESS;
case "processing": return GlobalErrorCodeConstants.SUCCESS;
case "send": return GlobalErrorCodeConstants.SUCCESS;
case "delivered": return GlobalErrorCodeConstants.SUCCESS;
}
return SmsFrameworkErrorCodeConstants.SMS_UNKNOWN;
}
......
......@@ -54,9 +54,9 @@ public class SmsCallbackController {
}
@PostMapping("/sendchamp")
@ApiOperation(value = "sendchamp短信的回调", notes = "参见 https://help.aliyun.com/document_detail/120998.html 文档")
@ApiOperation(value = "sendchamp短信的回调")
@OperateLog(enable = false)
public CommonResult<Boolean> receiveSendchampSmsStatus(HttpServletRequest request) throws Throwable {
public CommonResult<Boolean> receiveSendchampSmsStatus(HttpServletRequest request) {
String text = ServletUtil.getBody(request);
SendchampSmsClient.SmsReceiveStatus smsReceiveStatus = JsonUtils.parseObject(text, SendchampSmsClient.SmsReceiveStatus.class);
smsLogService.updateSendchampReceive(smsReceiveStatus);
......
package cn.iocoder.yudao.module.system.mq.consumer.sms;
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener;
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessageV2;
import cn.iocoder.yudao.module.system.service.sms.SmsSendService;
import lombok.extern.slf4j.Slf4j;
......@@ -10,7 +9,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* 针对 {@link SmsSendMessage} 的消费者
* 针对 {@link SmsSendConsumerV2} 的消费者
*
* @author zzf
*/
......
......@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.mq.message.sms;
import cn.iocoder.yudao.framework.common.util.json.core.KeyValue;
import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage;
import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.sms.SmsTemplateDO;
import lombok.Data;
import lombok.EqualsAndHashCode;
......@@ -44,7 +43,7 @@ public class SmsSendMessageV2 extends AbstractStreamMessage {
@Override
public String getStreamKey() {
return "system.sms.send";
return "system.sms.send.v2";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment