Commit 6cfcd93b authored by honghy's avatar honghy

调整Sendchamp客户端

parent ccd51cb9
...@@ -8,7 +8,7 @@ INSERT INTO `jiedao`.`system_dict_data`(`sort`, `label`, `value`, `dict_type`, ` ...@@ -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 (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 '发送类型'; alter table system_sms_log add node_id bigint comment '节点id',add node_template_sn int default 1 comment '节点模板序列号',add message_type tinyint comment '发送类型';
......
...@@ -94,8 +94,12 @@ public class SendchampSmsClient extends AbstractSmsClient { ...@@ -94,8 +94,12 @@ public class SendchampSmsClient extends AbstractSmsClient {
Map<?, ?> responseObj = JsonUtils.parseObject(result, Map.class); Map<?, ?> responseObj = JsonUtils.parseObject(result, Map.class);
Map<String, Object> data = (Map<String, Object>) responseObj.get("data"); 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); String id = String.valueOf(data.get("business_id"));
smsCommonResult.setData(new SmsSendRespDTO().setSerialNo(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) { } catch (Exception e) {
// 记录发送短信时发生的错误 // 记录发送短信时发生的错误
...@@ -174,6 +178,7 @@ public class SendchampSmsClient extends AbstractSmsClient { ...@@ -174,6 +178,7 @@ public class SendchampSmsClient extends AbstractSmsClient {
/** /**
* 短信接收状态 * 短信接收状态
* <p> * <p>
*
* @author 捷道源码 * @author 捷道源码
*/ */
@Data @Data
......
...@@ -13,6 +13,9 @@ public class SendchampSmsCodeMapping implements SmsCodeMapping { ...@@ -13,6 +13,9 @@ public class SendchampSmsCodeMapping implements SmsCodeMapping {
public ErrorCode apply(String apiCode) { public ErrorCode apply(String apiCode) {
switch (apiCode) { switch (apiCode) {
case "accepted": return GlobalErrorCodeConstants.SUCCESS; case "accepted": return GlobalErrorCodeConstants.SUCCESS;
case "processing": return GlobalErrorCodeConstants.SUCCESS;
case "send": return GlobalErrorCodeConstants.SUCCESS;
case "delivered": return GlobalErrorCodeConstants.SUCCESS;
} }
return SmsFrameworkErrorCodeConstants.SMS_UNKNOWN; return SmsFrameworkErrorCodeConstants.SMS_UNKNOWN;
} }
......
...@@ -54,9 +54,9 @@ public class SmsCallbackController { ...@@ -54,9 +54,9 @@ public class SmsCallbackController {
} }
@PostMapping("/sendchamp") @PostMapping("/sendchamp")
@ApiOperation(value = "sendchamp短信的回调", notes = "参见 https://help.aliyun.com/document_detail/120998.html 文档") @ApiOperation(value = "sendchamp短信的回调")
@OperateLog(enable = false) @OperateLog(enable = false)
public CommonResult<Boolean> receiveSendchampSmsStatus(HttpServletRequest request) throws Throwable { public CommonResult<Boolean> receiveSendchampSmsStatus(HttpServletRequest request) {
String text = ServletUtil.getBody(request); String text = ServletUtil.getBody(request);
SendchampSmsClient.SmsReceiveStatus smsReceiveStatus = JsonUtils.parseObject(text, SendchampSmsClient.SmsReceiveStatus.class); SendchampSmsClient.SmsReceiveStatus smsReceiveStatus = JsonUtils.parseObject(text, SendchampSmsClient.SmsReceiveStatus.class);
smsLogService.updateSendchampReceive(smsReceiveStatus); smsLogService.updateSendchampReceive(smsReceiveStatus);
......
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