余额支付密码开关校验支付密码可为空
This commit is contained in:
parent
49b704409c
commit
138e6a88ea
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoEditDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoPwdEditDTO;
|
||||
|
|
@ -43,7 +44,7 @@ public class UserController {
|
|||
*/
|
||||
@PutMapping("/pwd")
|
||||
public CzgResult<Boolean> updatePwd(@RequestBody UserInfoPwdEditDTO userInfoPwdEditDTO) {
|
||||
if (!userInfoPwdEditDTO.getPayPwd().equals(userInfoPwdEditDTO.getCheckPayPwd())) {
|
||||
if (StrUtil.isNotBlank(userInfoPwdEditDTO.getCheckPayPwd()) && !userInfoPwdEditDTO.getPayPwd().equals(userInfoPwdEditDTO.getCheckPayPwd())) {
|
||||
return CzgResult.failure("两次密码不一致");
|
||||
}
|
||||
return CzgResult.success(userInfoService.updatePwd(StpKit.USER.getLoginIdAsLong(), userInfoPwdEditDTO));
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@ public class UserInfoPwdEditDTO {
|
|||
/**
|
||||
* 支付密码
|
||||
*/
|
||||
@NotEmpty(message = "支付密码不为空")
|
||||
private String payPwd;
|
||||
@NotEmpty(message = "二次确认支付密码不为空")
|
||||
private String checkPayPwd;
|
||||
/**
|
||||
* 验证码
|
||||
|
|
|
|||
|
|
@ -88,8 +88,10 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
|||
throw new ApiNotPrintException("验证码错误");
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(userInfoPwdEditDTO.getCheckPayPwd())) {
|
||||
userInfo.setPayPwd(SecureUtil.md5(userInfoPwdEditDTO.getPayPwd()));
|
||||
}
|
||||
userInfo.setUsePayPwd(userInfoPwdEditDTO.getUsePayPwd());
|
||||
userInfo.setPayPwd(SecureUtil.md5(userInfoPwdEditDTO.getPayPwd()));
|
||||
boolean b = updateById(userInfo);
|
||||
if (b) {
|
||||
redisService.del(key);
|
||||
|
|
|
|||
Loading…
Reference in New Issue