mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2025-01-04 01:52:21 +08:00
style:代码移除无用依赖和删除多余空行
This commit is contained in:
parent
dbb2208bd1
commit
ba86c37ae8
@ -2,7 +2,6 @@ package com.youlai.admin.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.aliyuncs.CommonRequest;
|
import com.aliyuncs.CommonRequest;
|
||||||
import com.aliyuncs.CommonResponse;
|
import com.aliyuncs.CommonResponse;
|
||||||
import com.aliyuncs.DefaultAcsClient;
|
import com.aliyuncs.DefaultAcsClient;
|
||||||
@ -34,7 +33,6 @@ import java.util.concurrent.TimeUnit;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class AliyunSmsServiceImpl implements ISmsService {
|
public class AliyunSmsServiceImpl implements ISmsService {
|
||||||
|
|
||||||
|
|
||||||
@Setter
|
@Setter
|
||||||
private String accessKeyId;
|
private String accessKeyId;
|
||||||
|
|
||||||
@ -53,12 +51,11 @@ public class AliyunSmsServiceImpl implements ISmsService {
|
|||||||
@Setter
|
@Setter
|
||||||
private String signName;
|
private String signName;
|
||||||
|
|
||||||
|
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送短信
|
* 发送验证码短信
|
||||||
*
|
*
|
||||||
* @param phoneNumber 手机号
|
* @param phoneNumber 手机号
|
||||||
* @return
|
* @return
|
||||||
@ -66,11 +63,19 @@ public class AliyunSmsServiceImpl implements ISmsService {
|
|||||||
@Override
|
@Override
|
||||||
public boolean sendSmsCode(String phoneNumber) {
|
public boolean sendSmsCode(String phoneNumber) {
|
||||||
String code = RandomUtil.randomNumbers(6); // 随机生成6位的手机验证码
|
String code = RandomUtil.randomNumbers(6); // 随机生成6位的手机验证码
|
||||||
stringRedisTemplate.opsForValue().set(AuthConstants.SMS_CODE_PREFIX + phoneNumber, code, 600, TimeUnit.SECONDS);
|
stringRedisTemplate.opsForValue().set(AuthConstants.SMS_CODE_PREFIX + phoneNumber, code, 600, TimeUnit.SECONDS); // 验证登录成功之后删除
|
||||||
boolean result = this.sendSms(phoneNumber, code);
|
boolean result = this.sendSms(phoneNumber, code);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送短信
|
||||||
|
*
|
||||||
|
* @param phoneNumbers 手机号,多个用英文逗号(,)分割
|
||||||
|
* @param code
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
private boolean sendSms(String phoneNumbers, String code) {
|
private boolean sendSms(String phoneNumbers, String code) {
|
||||||
DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
|
DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret);
|
||||||
IAcsClient client = new DefaultAcsClient(profile);
|
IAcsClient client = new DefaultAcsClient(profile);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.youlai.auth.security.extension.wechat;
|
package com.youlai.auth.security.extension.wechat;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import org.springframework.security.authentication.*;
|
import org.springframework.security.authentication.*;
|
||||||
import org.springframework.security.core.Authentication;
|
import org.springframework.security.core.Authentication;
|
||||||
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
|
import org.springframework.security.oauth2.common.exceptions.InvalidGrantException;
|
||||||
@ -33,7 +32,6 @@ public class WechatTokenGranter extends AbstractTokenGranter {
|
|||||||
String encryptedData = parameters.get("encryptedData");
|
String encryptedData = parameters.get("encryptedData");
|
||||||
String iv = parameters.get("iv");
|
String iv = parameters.get("iv");
|
||||||
|
|
||||||
|
|
||||||
parameters.remove("code");
|
parameters.remove("code");
|
||||||
parameters.remove("encryptedData");
|
parameters.remove("encryptedData");
|
||||||
parameters.remove("iv");
|
parameters.remove("iv");
|
||||||
|
Loading…
Reference in New Issue
Block a user