| | |
| | | SysUser dbUser = sysUserService.getOne(new LambdaQueryWrapper<SysUser>() |
| | | .eq(SysUser::getUsername, userName)); |
| | | if (dbUser != null) { |
| | | throw new YamiShopBindException("该用户已存在"); |
| | | throw new YamiShopBindException("User already exists"); |
| | | } |
| | | List<SysRole> list = roleService.list(Wrappers.<SysRole>query() |
| | | .lambda().eq(SysRole::getRoleName, "代理商")); |
| | |
| | | public void restPassword(String password, String id) { |
| | | Agent agent = agentService.getById(id); |
| | | if (agent == null) { |
| | | throw new YamiShopBindException("参数错误!"); |
| | | throw new YamiShopBindException("Invalid parameters!"); |
| | | } |
| | | User user = userService.getById(agent.getUserId()); |
| | | if (user == null) { |
| | | throw new YamiShopBindException("代理商不存在!"); |
| | | throw new YamiShopBindException("Agent does not exist!"); |
| | | } |
| | | user.setLoginPassword(passwordEncoder.encode(password)); |
| | | userService.updateById(user); |
| | |
| | | public void unbindGoogleAuthCode(String id) { |
| | | Agent agent = agentService.getById(id); |
| | | if (agent == null) { |
| | | throw new YamiShopBindException("参数错误"); |
| | | throw new YamiShopBindException("Invalid parameters"); |
| | | } |
| | | User user = userService.getById(agent.getUserId()); |
| | | SysUser sysUser = sysUserService.getByUserName(user.getUserName()); |
| | | if (sysUser == null) { |
| | | throw new YamiShopBindException("参数错误"); |
| | | throw new YamiShopBindException("Invalid parameters"); |
| | | } |
| | | sysUser.setGoogleAuthSecret(null); |
| | | sysUser.setGoogleAuthBind(false); |
| | |
| | | public void bindGoogleAuthCode(String googleAuthSecret, String id) { |
| | | Agent agent = agentService.getById(id); |
| | | if (agent == null) { |
| | | throw new YamiShopBindException("参数错误"); |
| | | throw new YamiShopBindException("Invalid parameters"); |
| | | } |
| | | User user = userService.getById(agent.getUserId()); |
| | | SysUser sysUser = sysUserService.getByUserName(user.getUserName()); |
| | | if (sysUser == null) { |
| | | throw new YamiShopBindException("参数错误"); |
| | | throw new YamiShopBindException("Invalid parameters"); |
| | | } |
| | | sysUser.setGoogleAuthSecret(googleAuthSecret); |
| | | sysUser.setGoogleAuthBind(true); |