From 0b7fd65f8542284980c92cde8e8a7a2de2422667 Mon Sep 17 00:00:00 2001 From: Your Name <365246692@qq.com> Date: Tue, 18 Jun 2024 16:58:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E4=BA=86=E4=B8=AA=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/now/nowbot/service/BsApiService.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/main/java/com/now/nowbot/service/BsApiService.java diff --git a/src/main/java/com/now/nowbot/service/BsApiService.java b/src/main/java/com/now/nowbot/service/BsApiService.java new file mode 100644 index 000000000..8fc3eeeac --- /dev/null +++ b/src/main/java/com/now/nowbot/service/BsApiService.java @@ -0,0 +1,22 @@ +package com.now.nowbot.service; + +import com.now.nowbot.config.NowbotConfig; +import jakarta.annotation.Resource; +import org.springframework.stereotype.Service; +import org.springframework.web.reactive.function.client.WebClient; + +@Service("BsApiService") +public class BsApiService { + @Resource + WebClient webClient; + private static final String URL = NowbotConfig.BS_API_URL; + + public String getOsuFile(long bid) { + return webClient.get() + .uri(URL, b -> b.path("/").build()) + .header("AuthorizationX", "") + .retrieve() + .bodyToMono(String.class) + .block(); + } +} -- GitLab