1
luodangjia
2025-01-22 3eb56cab8a5a453ac5e70b6e36618dde32431326
ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
@@ -52,6 +52,7 @@
        UserDetail userDetail = new UserDetail();
        BeanUtils.copyProperties(user, userDetail);
        BeanUtils.copyProperties(company, userDetail);
        userDetail.setRegisterTime(user.getCreateTime());
        return R.ok(userDetail);
    }
@@ -83,7 +84,9 @@
    @PutMapping("/updateUserDetail")
    @Operation(summary = "编辑联系人信息",tags = {"企业端"})
    public R<Void> updateUserDetail(@RequestBody UserDetail userDetail) {
        User user = userService.getById(userDetail.getUserId());
        AppUser appLoginUser = SecurityUtils.getAppLoginUser();
        userDetail.setUserId(appLoginUser.getUserId());
        User user = userService.getById(appLoginUser.getUserId());
        BeanUtils.copyProperties(userDetail, user);
        userService.updateById(user);
        return R.ok();
@@ -102,16 +105,21 @@
        }
        String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(updatePhone.getNewPhone(), "");
        String captcha = redisService.getCacheObject(verifyKey);
        if (captcha == null) {
        String[] split = captcha.split(":");
        long l = Long.parseLong(split[2]);
        long l1 = System.currentTimeMillis();
        // 判断是否大于两分钟
        if (l1 - l > 2 * 60 * 1000) {
            throw new CaptchaException("验证码已失效");
        }
        redisService.deleteObject(verifyKey);
        if (captcha == null) {
            throw new CaptchaException("验证码错误");
        }
        if (!updatePhone.getCode().equalsIgnoreCase(captcha)) {
            throw new CaptchaException("验证码错误");
        }
        String password = SecurityUtils.encryptPassword(updatePhone.getPassword());
        if (!user.getPassword().equals(password)) {
        if (!SecurityUtils.matchesPassword(updatePhone.getPassword(), user.getPassword())) {
            return R.fail("密码错误");
        }
        user.setPhone(updatePhone.getNewPhone());