Commit 930e9e71 authored by licc's avatar licc

修改短信接口

parent d66b03fb
......@@ -61,6 +61,15 @@ public class SendSmsSerViceImpl implements SendSmsSerVice {
//生成六位随机数作为短信验证码
int code = (int) ((Math.random() * 9 + 1) * 100000);
//保存验证到缓存,以便做验证
String scene = SceneType.getNameByCode(sendSmsVo.getScene());
boolean bool = redisService.set(CachePrefix.SMS_CODE.getPrefix() + scene + "_" +
sendSmsVo.getSource() + "_" + sendSmsVo.getPhone(), code, Common.SMS_TIMEOUT);
if (!bool) {
return R.error("缓存验证码失败!");
}
Map<String, Object> map = new HashMap<>(4);
map.put("code", code);
request.putQueryParameter("RegionId", "cn-hangzhou");
......@@ -71,14 +80,11 @@ public class SendSmsSerViceImpl implements SendSmsSerVice {
try {
//发送验证码
CommonResponse response = client.getCommonResponse(request);
log.info("输出短信返回参数");
} catch (ClientException e) {
e.printStackTrace();
}
//保存验证到缓存,以便做验证
String scene = SceneType.getNameByCode(sendSmsVo.getScene());
boolean bool = redisService.set(CachePrefix.SMS_CODE.getPrefix() + scene + "_" +
sendSmsVo.getSource() + "_" + sendSmsVo.getPhone(), code, Common.SMS_TIMEOUT);
return R.ok(bool);
}
......
......@@ -46,7 +46,7 @@ public class UserLoginServiceImpl extends ServiceImpl<UsersMapper, User> impleme
@Autowired
private UserLimitMapper userLimitMapper;
private static final int ERROR_CODE = 500;
private static final int ERROR_CODE = 1;
@Transactional(rollbackFor = Exception.class)
@Override
......
......@@ -27,7 +27,7 @@ public class Common {
/**
* 阿里云短信超时时间
*/
public static final long SMS_TIMEOUT = 300;
public static final long SMS_TIMEOUT = 1200;
/**
* 支付宝支付app_id
......@@ -62,7 +62,7 @@ public class Common {
/**
* 沙箱 --支付宝支付app_id
*/
public static final String APP_ID_CS ="2021000117607483";
public static final String APP_ID_CS = "2021000117607483";
public static final String ALIPAY_PUBLIC_KEY_CS = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh5uAe8quhr05KrOnJ5Jrrp" +
"TphjEoFR4VnHFy9QDRoHK6ouFIz7ksCw6LS7A/S3Yhe3+bZbcvmJSKN1pVO6ssa8iuai81NAnylMZm5tOTaMl945OuqmC8qvIk9wg4AkYd" +
......
......@@ -9,7 +9,6 @@ import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.alipay.api.response.AlipayTradePagePayResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -24,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.UUID;
/**
* @author 86187
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment