| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping(value = "/system/secret/auth") |
| | | @PostMapping(value = "/system/license/auth") |
| | | @ManagerAuth |
| | | public R systemSecret(@RequestParam(value = "secret") String secret) { |
| | | if (Cools.isEmpty(secret)) { |
| | | public R systemSecret(@RequestParam(value = "license") String license) { |
| | | if (Cools.isEmpty(license)) { |
| | | return R.error("请输入激活码"); |
| | | } |
| | | // 验证激活码 |
| | | String timeStr = AesUtils.decrypt(secret, SystemProperties.SALT); |
| | | String timeStr = AesUtils.decrypt(license, SystemProperties.SALT); |
| | | if (null == timeStr) { |
| | | return R.error("激活码错误"); |
| | | } |
| | |
| | | if (new Date().getTime() >= exprTime.getTime()) { |
| | | return R.error("激活码已失效"); |
| | | } |
| | | boolean result = SystemProperties.saveActivationCode(OSinfo.getOSname().getActivationCodePath(), secret); |
| | | boolean result = SystemProperties.saveActivationCode(OSinfo.getOSname().getActivationCodePath(), license); |
| | | if (!result) { |
| | | return R.error("激活失败"); |
| | | } |
| | |
| | | } |
| | | List<Long> collect = rolePermissions.stream().map(RolePermission::getPermissionId).distinct().collect(Collectors.toList()); |
| | | List<Permission> permissions = permissionService.selectBatchIds(collect); |
| | | return R.ok().add(permissions.stream().map(Permission::getAction).distinct().collect(Collectors.toList())); |
| | | return R.ok().add(permissions); |
| | | } |
| | | |
| | | } |