From 15d5eb858c36b5cb1e22c9dc66bcbf82e8284c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Mon, 11 Jul 2022 09:39:22 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E7=9F=AD=E4=BF=A1?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E8=BF=94=E5=9B=9E=E5=AE=9E=E4=BD=93=20SysSms?= =?UTF-8?q?=20=E5=BA=8F=E5=88=97=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/ruoyi/sms/core/AliyunSmsTemplate.java | 2 +- .../src/main/java/com/ruoyi/sms/core/TencentSmsTemplate.java | 3 ++- ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java | 4 +++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/AliyunSmsTemplate.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/AliyunSmsTemplate.java index eede376e..3c16a5b4 100644 --- a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/AliyunSmsTemplate.java +++ b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/AliyunSmsTemplate.java @@ -56,7 +56,7 @@ public class AliyunSmsTemplate implements SmsTemplate { return SmsResult.builder() .isSuccess("OK".equals(resp.getBody().getCode())) .message(resp.getBody().getMessage()) - .response(resp) + .response(JsonUtils.toJsonString(resp)) .build(); } catch (Exception e) { throw new SmsException(e.getMessage()); diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TencentSmsTemplate.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TencentSmsTemplate.java index 1de8eae1..17f5b5b1 100644 --- a/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TencentSmsTemplate.java +++ b/ruoyi-sms/src/main/java/com/ruoyi/sms/core/TencentSmsTemplate.java @@ -2,6 +2,7 @@ package com.ruoyi.sms.core; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ArrayUtil; +import com.ruoyi.common.utils.JsonUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.sms.config.properties.SmsProperties; import com.ruoyi.sms.entity.SmsResult; @@ -65,7 +66,7 @@ public class TencentSmsTemplate implements SmsTemplate { SmsResult.SmsResultBuilder builder = SmsResult.builder() .isSuccess(true) .message("send success") - .response(resp); + .response(JsonUtils.toJsonString(resp)); for (SendStatus sendStatus : resp.getSendStatusSet()) { if (!"Ok".equals(sendStatus.getCode())) { builder.isSuccess(false).message(sendStatus.getMessage()); diff --git a/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java b/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java index 3f13b277..89c39b40 100644 --- a/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java +++ b/ruoyi-sms/src/main/java/com/ruoyi/sms/entity/SmsResult.java @@ -24,6 +24,8 @@ public class SmsResult { /** * 实际响应体 + *
+ * 可自行转换为 SDK 对应的 SendSmsResponse */ - private Object response; + private String response; }