From c589c2a56cab41345314106f2fc9129f9d7d639d Mon Sep 17 00:00:00 2001 From: smallchill Date: Wed, 11 Mar 2020 12:52:58 +0800 Subject: [PATCH] =?UTF-8?q?:heavy=5Fplus=5Fsign:=20=E6=96=B0=E5=A2=9EsendM?= =?UTF-8?q?essage=E6=8E=A5=E5=8F=A3=E5=8F=8ASmsResponse=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/springblade/resource/feign/ISmsClient.java | 3 ++- .../main/java/org/springblade/resource/utils/SmsUtil.java | 7 ++++--- .../org/springblade/resource/endpoint/SmsEndpoint.java | 5 +++-- .../java/org/springblade/resource/feign/SmsClient.java | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/ISmsClient.java b/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/ISmsClient.java index c75bb911..fbb8da69 100644 --- a/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/ISmsClient.java +++ b/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/feign/ISmsClient.java @@ -17,6 +17,7 @@ package org.springblade.resource.feign; import org.springblade.core.launch.constant.AppConstant; +import org.springblade.core.sms.model.SmsResponse; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; @@ -46,7 +47,7 @@ public interface ISmsClient { * @return R */ @PostMapping(SEND_MESSAGE) - R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); + R sendMessage(@RequestParam("code") String code, @RequestParam("params") String params, @RequestParam("phones") String phones); /** * 短信验证码发送 diff --git a/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/utils/SmsUtil.java b/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/utils/SmsUtil.java index 7ec13a78..b1f65a77 100644 --- a/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/utils/SmsUtil.java +++ b/blade-ops-api/blade-resource-api/src/main/java/org/springblade/resource/utils/SmsUtil.java @@ -17,6 +17,7 @@ package org.springblade.resource.utils; import org.springblade.core.sms.model.SmsCode; +import org.springblade.core.sms.model.SmsResponse; import org.springblade.core.tool.api.R; import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.RandomType; @@ -73,9 +74,9 @@ public class SmsUtil { * @param phones 手机号集合 * @return 发送结果 */ - public static boolean sendMessage(String code, Map params, String phones) { - R result = getSmsClient().sendMessage(code, JsonUtil.toJson(params), phones); - return result.isSuccess(); + public static SmsResponse sendMessage(String code, Map params, String phones) { + R result = getSmsClient().sendMessage(code, JsonUtil.toJson(params), phones); + return result.getData(); } /** diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/SmsEndpoint.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/SmsEndpoint.java index 5263a073..bd1a9343 100644 --- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/SmsEndpoint.java +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/SmsEndpoint.java @@ -21,6 +21,7 @@ import lombok.AllArgsConstructor; import lombok.SneakyThrows; import org.springblade.core.sms.model.SmsCode; import org.springblade.core.sms.model.SmsData; +import org.springblade.core.sms.model.SmsResponse; import org.springblade.core.tool.api.R; import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.Func; @@ -153,8 +154,8 @@ public class SmsEndpoint { * @return 是否发送成功 */ private R send(SmsData smsData, String phones) { - boolean temp = smsBuilder.template().sendMulti(smsData, Func.toStrList(phones)); - return temp ? R.success(SEND_SUCCESS) : R.fail(SEND_FAIL); + SmsResponse response = smsBuilder.template().sendMessage(smsData, Func.toStrList(phones)); + return response.isSuccess() ? R.success(SEND_SUCCESS) : R.fail(SEND_FAIL); } } diff --git a/blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/SmsClient.java b/blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/SmsClient.java index 39e8f53d..52728b59 100644 --- a/blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/SmsClient.java +++ b/blade-ops/blade-resource/src/main/java/org/springblade/resource/feign/SmsClient.java @@ -19,6 +19,7 @@ package org.springblade.resource.feign; import lombok.AllArgsConstructor; import org.springblade.core.sms.model.SmsCode; import org.springblade.core.sms.model.SmsData; +import org.springblade.core.sms.model.SmsResponse; import org.springblade.core.tool.api.R; import org.springblade.core.tool.jackson.JsonUtil; import org.springblade.core.tool.utils.Func; @@ -43,10 +44,10 @@ public class SmsClient implements ISmsClient { @Override @PostMapping(SEND_MESSAGE) - public R sendMessage(String code, String params, String phones) { + public R sendMessage(String code, String params, String phones) { SmsData smsData = new SmsData(JsonUtil.readMap(params, String.class, String.class)); - boolean temp = smsBuilder.template(code).sendMulti(smsData, Func.toStrList(phones)); - return temp ? R.success(SEND_SUCCESS) : R.fail(SEND_FAIL); + SmsResponse response = smsBuilder.template(code).sendMessage(smsData, Func.toStrList(phones)); + return R.data(response); } @Override