|
@@ -2,6 +2,7 @@ package com.miaxis.app.sms.impl;
|
|
|
|
|
|
import com.miaxis.app.sms.ISmsService;
|
|
|
import com.miaxis.common.constant.Constants;
|
|
|
+import com.miaxis.common.constant.SmsTemplateConstants;
|
|
|
import com.miaxis.common.core.domain.Response;
|
|
|
import com.miaxis.common.core.domain.ResponseEnum;
|
|
|
import com.miaxis.common.core.domain.entity.SysUser;
|
|
@@ -67,6 +68,9 @@ public class SmsServiceImpl implements ISmsService {
|
|
|
}
|
|
|
try{
|
|
|
|
|
|
+ //短信模板
|
|
|
+ String smsTemplateStr = "";
|
|
|
+
|
|
|
/**
|
|
|
* login:登录验证 modify;修改验证
|
|
|
* keyPrefix : 缓存key前缀
|
|
@@ -76,6 +80,7 @@ public class SmsServiceImpl implements ISmsService {
|
|
|
if (type.equals("login")){
|
|
|
map.put("keyPrefix", Constants.SMS_LOGIN_CODE);
|
|
|
map.put("verificationCount",Constants.SMS_LOGIN_CODE_COUNT);
|
|
|
+ smsTemplateStr = SmsTemplateConstants.login;
|
|
|
}
|
|
|
if (type.equals("modify")){
|
|
|
if (user.getPhonenumber().equals(phone)){
|
|
@@ -83,6 +88,7 @@ public class SmsServiceImpl implements ISmsService {
|
|
|
}
|
|
|
map.put("keyPrefix",Constants.SMS_MODIFY_CODE);
|
|
|
map.put("verificationCount",Constants.SMS_MODIFY_CODE_COUNT);
|
|
|
+ smsTemplateStr = SmsTemplateConstants.modify;
|
|
|
}
|
|
|
|
|
|
//验证手机号
|
|
@@ -96,7 +102,7 @@ public class SmsServiceImpl implements ISmsService {
|
|
|
for (int i=0;i<6;i++){
|
|
|
code += new Random().nextInt(10);
|
|
|
}
|
|
|
- String content = "本次验证码:"+code+",验证码两分钟内有效";
|
|
|
+ String content = smsTemplateStr.replace("code",code);
|
|
|
|
|
|
// 调用发送接口
|
|
|
Client client = new Client(smsUserName, smsPassword);
|