diff --git a/src/main/kotlin/plus/maa/backend/controller/UserController.kt b/src/main/kotlin/plus/maa/backend/controller/UserController.kt index 3000f356..537ad1bd 100644 --- a/src/main/kotlin/plus/maa/backend/controller/UserController.kt +++ b/src/main/kotlin/plus/maa/backend/controller/UserController.kt @@ -158,5 +158,4 @@ class UserController( @Operation(summary = "查询用户信息") @ApiResponse(description = "用户详情信息") fun getUserInfo(@RequestParam userId: String): MaaResult = success(userService.get(userId)) - } diff --git a/src/main/kotlin/plus/maa/backend/service/UserService.kt b/src/main/kotlin/plus/maa/backend/service/UserService.kt index 489d6981..e1965fa9 100644 --- a/src/main/kotlin/plus/maa/backend/service/UserService.kt +++ b/src/main/kotlin/plus/maa/backend/service/UserService.kt @@ -205,7 +205,5 @@ class UserService( fun getOrDefault(id: String) = get(id) ?: MaaUser.UNKNOWN } - fun get(userId: String): MaaUserInfo = - (userRepository.findByUserId(userId) ?: MaaUser.UNKNOWN).run(::MaaUserInfo) - + fun get(userId: String): MaaUserInfo = (userRepository.findByUserId(userId) ?: MaaUser.UNKNOWN).run(::MaaUserInfo) } diff --git a/src/test/kotlin/plus/maa/backend/config/security/JwtAuthenticationTokenFilterTest.kt b/src/test/kotlin/plus/maa/backend/config/security/JwtAuthenticationTokenFilterTest.kt index 0afce177..403a8bd5 100644 --- a/src/test/kotlin/plus/maa/backend/config/security/JwtAuthenticationTokenFilterTest.kt +++ b/src/test/kotlin/plus/maa/backend/config/security/JwtAuthenticationTokenFilterTest.kt @@ -35,4 +35,4 @@ class JwtAuthenticationTokenFilterTest { } requireNotNull(SecurityContextHolder.getContext().authentication) } -} \ No newline at end of file +} diff --git a/src/test/kotlin/plus/maa/backend/repository/GithubRepositoryTest.kt b/src/test/kotlin/plus/maa/backend/repository/GithubRepositoryTest.kt index 6bbc3e17..19d1bfad 100644 --- a/src/test/kotlin/plus/maa/backend/repository/GithubRepositoryTest.kt +++ b/src/test/kotlin/plus/maa/backend/repository/GithubRepositoryTest.kt @@ -8,7 +8,7 @@ import plus.maa.backend.config.external.MaaCopilotProperties @SpringBootTest class GithubRepositoryTest( @Autowired val repository: GithubRepository, - @Autowired val properties: MaaCopilotProperties + @Autowired val properties: MaaCopilotProperties, ) { @Test fun testGetTrees() { @@ -26,4 +26,4 @@ class GithubRepositoryTest( val contents = repository.getContents(properties.github.token, "") check(contents.isNotEmpty()) } -} \ No newline at end of file +} diff --git a/src/test/kotlin/plus/maa/backend/service/CopilotServiceTest.kt b/src/test/kotlin/plus/maa/backend/service/CopilotServiceTest.kt index 368aceed..1d7d6be8 100644 --- a/src/test/kotlin/plus/maa/backend/service/CopilotServiceTest.kt +++ b/src/test/kotlin/plus/maa/backend/service/CopilotServiceTest.kt @@ -29,7 +29,6 @@ class CopilotServiceTest { lastWeekLikeCounts[1] = 6L lastWeekDislikeCounts[1] = 1L - // 近期作业,差评较多,均为近期评分 val newBad = Copilot(doc = Copilot.Doc(title = "test")) newBad.uploadTime = now @@ -38,7 +37,6 @@ class CopilotServiceTest { lastWeekLikeCounts[2] = 2L lastWeekDislikeCounts[2] = 4L - // 一月前的作业,评分高,但是只有一条近期好评,浏览量尚可 val oldNormal = Copilot(doc = Copilot.Doc(title = "test")) oldNormal.uploadTime = beforeWeek.minusDays(21L) @@ -47,7 +45,6 @@ class CopilotServiceTest { lastWeekLikeCounts[3] = 1L lastWeekDislikeCounts[3] = 0L - // 新增作业,暂无评分 val newEmpty = Copilot(doc = Copilot.Doc(title = "test")) newEmpty.uploadTime = now @@ -57,8 +54,7 @@ class CopilotServiceTest { lastWeekDislikeCounts[4] = 0L for (i in 0..4) { - copilots[i]!!.hotScore = - getHotScore(copilots[i]!!, lastWeekLikeCounts[i], lastWeekDislikeCounts[i]) + copilots[i]!!.hotScore = getHotScore(copilots[i]!!, lastWeekLikeCounts[i], lastWeekDislikeCounts[i]) } // 近期好评 > 远古好评 > 近期新增 > 近期差评 > 远古一般