refactor: 后台用户密码更新

This commit is contained in:
pengsz 2025-12-09 20:30:42 +08:00
parent 0ea786f6e6
commit a2c94c06a7
2 changed files with 3 additions and 1 deletions

View File

@ -121,7 +121,7 @@ public class YztUtil {
// 解密结果:中国123ABCabc // 解密结果:中国123ABCabc
// System.out.println(encryptPassword("Yzt_123456", "18292417675")); // System.out.println(encryptPassword("Yzt_123456", "18292417675"));
// System.out.println(decryptPassword("c7Nwx1WsDdewbab2TlkpUg==", "18292417675")); // System.out.println(decryptPassword("c7Nwx1WsDdewbab2TlkpUg==", "18292417675"));
System.out.println(decryptPassword("ZRHx7lLKlTzrjD7fpVAVOQ==", "19924716954")); System.out.println(decryptPassword("u/w7KGAe2kNpl1jr+aqk1w==", "13042028174"));
// 执行结果:f6mcpGQ8NEmwbab2TlkpUg== // 执行结果:f6mcpGQ8NEmwbab2TlkpUg==
// 与 SQL 中的数据一致 // 与 SQL 中的数据一致
} }

View File

@ -1589,6 +1589,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
BeanUtils.copyProperties(userRequest, user); BeanUtils.copyProperties(userRequest, user);
if(userRequest.getPassword().isBlank()){ if(userRequest.getPassword().isBlank()){
user.setPwd(tempUser.getPwd()); user.setPwd(tempUser.getPwd());
}else {
user.setPwd(YztUtil.encryptPassword(userRequest.getPassword(),tempUser.getPhone()));
} }
// if (userRequest.getTradePassword().isBlank()){ // if (userRequest.getTradePassword().isBlank()){
// user.setTradePassword(tempUser.getTradePassword()); // user.setTradePassword(tempUser.getTradePassword());