From 7bfc31e2a0af3abcd8674edfc4e285f275ba3093 Mon Sep 17 00:00:00 2001 From: ZZ Date: Wed, 11 Aug 2021 17:18:56 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=8F=91=E9=80=81=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E7=AD=BE=E5=90=8D=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xhpc/general/service/IXhpcSmsService.java | 11 ++++++----- .../com/xhpc/general/service/XhpcSmsServiceImpl.java | 12 ++++++------ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java index 4f6a1a30..80184477 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/IXhpcSmsService.java @@ -22,13 +22,14 @@ public interface IXhpcSmsService { List> getList(Integer status,String phone); /** - * 公共调用方法 - * @param phone 手机号 - * @param content 内容 - * @param random 验证码6位 + * 发送短信通用方法 + * + * @param phone 手机号 + * @param content 内容 + * @param random 验证码6位 不为空则是获取验证码 * @return */ - AjaxResult getPhoneCode(String phone,String content,String random); + AjaxResult send(String phone, String content, String random); } diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java index c4a99c13..8735bcbe 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcSmsServiceImpl.java @@ -44,7 +44,7 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService{ public AjaxResult getLogonPhoneCode(String phone) { String random = getRandom(); String conten ="【小华充电】您的验证码是:"+random+",有效期为5分钟。如非本人操作,可不用理会。"; - return getPhoneCode(phone,conten,random); + return send(phone, conten, random); } @Override @@ -54,15 +54,15 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService{ } @Override - public AjaxResult getPhoneCode(String phone, String content,String random) { + public AjaxResult send(String phone, String content, String random) { //调用接口 - String pattern ="^([1][0-9]{10})"; + String pattern = "^([1][0-9]{10})"; Pattern compile = Pattern.compile(pattern); - Matcher m =compile.matcher(phone); + Matcher m = compile.matcher(phone); boolean isMatch = m.matches(); - if(!isMatch){ - return AjaxResult.error("1003","请输入正确的手机号"); + if (!isMatch) { + return AjaxResult.error("1003", "请输入正确的手机号"); } //添加短信记录 XhpcSms xhpcSms =new XhpcSms();