Skip to content

Commit 984d27b

Browse files
committed
fix: 修复全局统计API空指针异常 - getTodayClicksByShortCode返回null处理
1 parent 9384e64 commit 984d27b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/layor/tinyflow/service/ShortUrlService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,8 @@ public GlobalStatsDTO getGlobalStats(String startStr, String endStr) {
631631
org.springframework.data.domain.Sort.by(org.springframework.data.domain.Sort.Direction.DESC, "clickCount")))
632632
.stream()
633633
.map(url -> {
634-
int today = dailyClickRepo.getTodayClicksByShortCode(url.getShortCode());
634+
Integer urlTodayClicks = dailyClickRepo.getTodayClicksByShortCode(url.getShortCode());
635+
int today = urlTodayClicks != null ? urlTodayClicks : 0;
635636
return new UrlRankDTO(url.getShortCode(), url.getLongUrl(), url.getClickCount(), today);
636637
})
637638
.toList();

0 commit comments

Comments
 (0)