短信发送方法签名重构
This commit is contained in:
parent
c597826849
commit
7bfc31e2a0
@ -22,13 +22,14 @@ public interface IXhpcSmsService {
|
||||
List<Map<String, Object>> 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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user