Merge branch 'why' into glj

This commit is contained in:
glj 2023-04-20 14:25:07 +08:00
commit 633fa14a57
2 changed files with 13 additions and 5 deletions

View File

@ -65,8 +65,8 @@ public class CenterController {
));
}
@PostMapping("/updatePassword")
public R<Boolean> updatePassword(String oldPassword, String password, String email) {
return R.data(guestInfoService.updatePassword(oldPassword, password, email));
public R<Boolean> updatePassword(@RequestBody Map<String, String> param) {
return R.data(guestInfoService.updatePassword(param.get("originalPassword"), param.get("password"), param.get("email")));
}
}

View File

@ -6,26 +6,34 @@ import com.kening.vordm.entity.GuestInfo;
import com.kening.vordm.mapper.GuestInfoMapper;
import com.kening.vordm.service.GuestInfoService;
import com.kening.vordm.vo.UserVo;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.DigestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import static org.springblade.core.cache.constant.CacheConstant.USER_CACHE;
/**
* @author G1393
* @description 针对表guest_info(游客信息表/志愿者)的数据库操作Service实现
* @createDate 2023-04-04 15:54:30
*/
@Service
public class GuestInfoServiceImpl extends ServiceImpl<GuestInfoMapper, GuestInfo>
implements GuestInfoService {
@Autowired
private BladeRedis bladeRedis;
@Override
public Boolean updatePassword(String oldPassword, String password, String email) {
String op = DigestUtil.encrypt(oldPassword);
UserVo user = this.baseMapper.getBladeUserByEmail(email);
int i = 0;
if(op.equals(user.getPassword())){
i = this.baseMapper.updatePassword(email, password);
return true;
i = this.baseMapper.updatePassword(email, DigestUtil.encrypt(password));
CacheUtil.clear(USER_CACHE);
return i>0;
}else{
return false;
}