springboot 获取请求头的信息如token

    科技2024-09-28  17

    通过@RequestHeader()来获取然后用token相关工具取出token里面的用户信息   @AutoLog(value = "appAndroid用户课程小节视频学习进度管理列表") @ApiOperation(value = "appAndroid用户课程小节视频学习进度管理列表", notes = "appAndroid用户课程小节视频学习进度管理列表") @GetMapping(value = "/appAndroidStudyRecordList") public Result<?> queryAndroid(@RequestHeader("X-Access-Token") String language) { QueryWrapper<AppStudyRecordDO> queryAndroidWrapper = new QueryWrapper<>(); LoginUser loginUser = shiroRealm.checkUserTokenIsEffect(language); String userId = loginUser.getId(); queryAndroidWrapper.eq("user_id", userId); queryAndroidWrapper.eq("type", 1); List<AppStudyRecordDO> appStudyRecordDOList = appStudyRecordService.list(queryAndroidWrapper); return Result.ok(appStudyRecordDOList); }
    Processed: 0.008, SQL: 8