This commit is contained in:
张良(004796)
2024-01-23 16:33:42 +08:00
parent 5254dce420
commit 434555e744
2 changed files with 2 additions and 3 deletions

View File

@@ -46,7 +46,7 @@ public class AdolescentAppController {
return R.ok(vo); return R.ok(vo);
} }
@GetMapping("/switch") @PostMapping("/switch")
@Operation(summary = "青少年模式开关") @Operation(summary = "青少年模式开关")
@Log(title = "青少年模式开关", businessType = BusinessType.OTHER, isSaveDb = false) @Log(title = "青少年模式开关", businessType = BusinessType.OTHER, isSaveDb = false)
public R<Void> switchAdolescent(@RequestBody AdolescentSwitch adolescentSwitch){ public R<Void> switchAdolescent(@RequestBody AdolescentSwitch adolescentSwitch){

View File

@@ -62,8 +62,7 @@ public class AdolescentServiceImpl extends ServiceImpl<AdolescentMapper,Adolesce
throw new ServiceException("参数不正确"); throw new ServiceException("参数不正确");
} }
Adolescent adolescent = this.getByUserId(LoginHelper.getUserId()); Adolescent adolescent = this.getByUserId(LoginHelper.getUserId());
String hashpw = BCrypt.hashpw(adolescentSwitch.getPassword()); if(adolescent == null || !BCrypt.checkpw(adolescentSwitch.getPassword(), adolescent.getPassword())){
if(adolescent == null || !adolescent.getPassword().equals(hashpw)){
throw new ServiceException("密码错误"); throw new ServiceException("密码错误");
} }
if(adolescentSwitch.getIsOpen() == 0){ if(adolescentSwitch.getIsOpen() == 0){