压测相关还原
This commit is contained in:
parent
b13a5d5f2a
commit
cf0d1378c8
@ -26,7 +26,7 @@ public class SliderImageController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VerificationService verificationService;
|
private VerificationService verificationService;
|
||||||
|
|
||||||
// @LimitPoint(name = "slider_image", key = "verification")
|
@LimitPoint(name = "slider_image", key = "verification")
|
||||||
@GetMapping("/{verificationEnums}")
|
@GetMapping("/{verificationEnums}")
|
||||||
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
|
@ApiOperation(value = "获取校验接口,一分钟同一个ip请求10次")
|
||||||
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
public ResultMessage getSliderImage(@RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
||||||
@ -34,7 +34,7 @@ public class SliderImageController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// @LimitPoint(name = "slider_image", key = "verification_pre_check", limit = 600)
|
@LimitPoint(name = "slider_image", key = "verification_pre_check", limit = 600)
|
||||||
@PostMapping("/{verificationEnums}")
|
@PostMapping("/{verificationEnums}")
|
||||||
@ApiOperation(value = "验证码预校验")
|
@ApiOperation(value = "验证码预校验")
|
||||||
public ResultMessage verificationImage(Integer xPos, @RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
public ResultMessage verificationImage(Integer xPos, @RequestHeader String uuid, @PathVariable VerificationEnums verificationEnums) {
|
||||||
|
@ -30,7 +30,7 @@ public class SmsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private VerificationService verificationService;
|
private VerificationService verificationService;
|
||||||
|
|
||||||
// @LimitPoint(name = "sms_send", key = "sms")
|
@LimitPoint(name = "sms_send", key = "sms")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(paramType = "path", dataType = "String", name = "mobile", value = "手机号"),
|
@ApiImplicitParam(paramType = "path", dataType = "String", name = "mobile", value = "手机号"),
|
||||||
@ApiImplicitParam(paramType = "header", dataType = "String", name = "uuid", value = "uuid"),
|
@ApiImplicitParam(paramType = "header", dataType = "String", name = "uuid", value = "uuid"),
|
||||||
|
@ -134,15 +134,15 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
|||||||
@Override
|
@Override
|
||||||
public Token usernameLogin(String username, String password) {
|
public Token usernameLogin(String username, String password) {
|
||||||
Member member = this.findMember(username);
|
Member member = this.findMember(username);
|
||||||
// //判断用户是否存在
|
//判断用户是否存在
|
||||||
// if (member == null || !member.getDisabled()) {
|
if (member == null || !member.getDisabled()) {
|
||||||
// throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||||
// }
|
}
|
||||||
// //判断密码是否输入正确
|
//判断密码是否输入正确
|
||||||
// if (!new BCryptPasswordEncoder().matches(password, member.getPassword())) {
|
if (!new BCryptPasswordEncoder().matches(password, member.getPassword())) {
|
||||||
// throw new ServiceException(ResultCode.USER_PASSWORD_ERROR);
|
throw new ServiceException(ResultCode.USER_PASSWORD_ERROR);
|
||||||
// }
|
}
|
||||||
// loginBindUser(member);
|
loginBindUser(member);
|
||||||
return memberTokenGenerate.createToken(member, false);
|
return memberTokenGenerate.createToken(member, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,19 +106,6 @@ public class TradeDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private MemberAddress memberAddress;
|
private MemberAddress memberAddress;
|
||||||
|
|
||||||
public MemberAddress getMemberAddress() {
|
|
||||||
MemberAddress memberAddress = new MemberAddress();
|
|
||||||
memberAddress.setId("1376445134773682176");
|
|
||||||
memberAddress.setConsigneeAddressIdPath("1401797451706269749,1401797451706270007,1401797451706270104,1401797451706270108");
|
|
||||||
memberAddress.setConsigneeAddressPath("河北省,廊坊市,三河市,燕郊镇");
|
|
||||||
memberAddress.setAlias("DEFAULT");
|
|
||||||
memberAddress.setMobile("13232323232");
|
|
||||||
memberAddress.setName("NMNNN");
|
|
||||||
memberAddress.setIsDefault(true);
|
|
||||||
memberAddress.setLat("131.13");
|
|
||||||
memberAddress.setLon("131.13");
|
|
||||||
return memberAddress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 客户端类型
|
* 客户端类型
|
||||||
|
@ -215,9 +215,8 @@ public class CartServiceImpl implements CartService {
|
|||||||
|
|
||||||
//缓存key,默认使用购物车
|
//缓存key,默认使用购物车
|
||||||
if (cartTypeEnum != null) {
|
if (cartTypeEnum != null) {
|
||||||
// AuthUser currentUser = UserContext.getCurrentUser();
|
AuthUser currentUser = UserContext.getCurrentUser();
|
||||||
// return cartTypeEnum.getPrefix() + currentUser.getId();
|
return cartTypeEnum.getPrefix() + currentUser.getId();
|
||||||
return cartTypeEnum.getPrefix() + UserContext.getUuid();
|
|
||||||
}
|
}
|
||||||
throw new ServiceException(ResultCode.ERROR);
|
throw new ServiceException(ResultCode.ERROR);
|
||||||
}
|
}
|
||||||
|
@ -132,14 +132,14 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean verifyCode(String mobile, VerificationEnums verificationEnums, String uuid, String code) {
|
public boolean verifyCode(String mobile, VerificationEnums verificationEnums, String uuid, String code) {
|
||||||
// Object result = cache.get(cacheKey(verificationEnums, mobile, uuid));
|
Object result = cache.get(cacheKey(verificationEnums, mobile, uuid));
|
||||||
// if (code.equals(result)) {
|
if (code.equals(result)) {
|
||||||
//校验之后,删除
|
//校验之后,删除
|
||||||
cache.remove(cacheKey(verificationEnums, mobile, uuid));
|
cache.remove(cacheKey(verificationEnums, mobile, uuid));
|
||||||
return true;
|
return true;
|
||||||
// } else {
|
} else {
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@ import cn.lili.common.vo.SerializableStream;
|
|||||||
import cn.lili.modules.verification.SliderImageUtil;
|
import cn.lili.modules.verification.SliderImageUtil;
|
||||||
import cn.lili.modules.verification.entity.dos.VerificationSource;
|
import cn.lili.modules.verification.entity.dos.VerificationSource;
|
||||||
import cn.lili.modules.verification.entity.dto.VerificationDTO;
|
import cn.lili.modules.verification.entity.dto.VerificationDTO;
|
||||||
|
import cn.lili.modules.verification.service.VerificationSourceService;
|
||||||
|
import cn.lili.modules.verification.SliderImageUtil;
|
||||||
import cn.lili.modules.verification.entity.enums.VerificationEnums;
|
import cn.lili.modules.verification.entity.enums.VerificationEnums;
|
||||||
import cn.lili.modules.verification.service.VerificationService;
|
import cn.lili.modules.verification.service.VerificationService;
|
||||||
import cn.lili.modules.verification.service.VerificationSourceService;
|
import cn.lili.modules.verification.service.VerificationSourceService;
|
||||||
@ -132,19 +134,18 @@ public class VerificationServiceImpl implements VerificationService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums) {
|
public boolean preCheck(Integer xPos, String uuid, VerificationEnums verificationEnums) {
|
||||||
// Integer randomX = (Integer) cache.get(cacheKey(verificationEnums, uuid));
|
Integer randomX = (Integer) cache.get(cacheKey(verificationEnums, uuid));
|
||||||
// if (randomX == null) {
|
if (randomX == null) {
|
||||||
// throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
||||||
// }
|
}
|
||||||
// log.debug("{}{}", randomX, xPos);
|
log.debug("{}{}", randomX, xPos);
|
||||||
// //验证结果正确 && 删除标记成功
|
//验证结果正确 && 删除标记成功
|
||||||
// if (Math.abs(randomX - xPos) < verificationCodeProperties.getFaultTolerant() && cache.remove(cacheKey(verificationEnums, uuid))) {
|
if (Math.abs(randomX - xPos) < verificationCodeProperties.getFaultTolerant() && cache.remove(cacheKey(verificationEnums, uuid))) {
|
||||||
//验证成功,则记录验证结果 验证有效时间与验证码创建有效时间一致
|
//验证成功,则记录验证结果 验证有效时间与验证码创建有效时间一致
|
||||||
cache.remove(cacheKey(verificationEnums, uuid));
|
cache.put(cacheResult(verificationEnums, uuid), true, verificationCodeProperties.getEffectiveTime());
|
||||||
cache.put(cacheResult(verificationEnums, uuid), true, verificationCodeProperties.getEffectiveTime());
|
return true;
|
||||||
return true;
|
}
|
||||||
// }
|
throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
||||||
// throw new ServiceException(ResultCode.VERIFICATION_ERROR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,8 +161,7 @@ public class VerificationServiceImpl implements VerificationService {
|
|||||||
if (cache.remove(cacheResult(verificationEnums, uuid))) {
|
if (cache.remove(cacheResult(verificationEnums, uuid))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
throw new ServiceException(ResultCode.VERIFICATION_CODE_INVALID);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -187,3 +187,4 @@ public class VerificationServiceImpl implements VerificationService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user