Commit ed77255d authored by gaozhaochen's avatar gaozhaochen

update:

1、适配中山的demo,自动加载数据
parent c56c5069
......@@ -36,10 +36,12 @@ shinyServer(function(input, output, session) {
withProgress(message = '正在从业务系统同步数据...', value = 0.2, {
# 4. 获取环境变量中的 API 基地址
api_base <- Sys.getenv("HOST_API_BASE","http://127.0.0.1:11999")
# api_base <- Sys.getenv("HOST_API_BASE","http://127.0.0.1:11999")
api_base <- Sys.getenv("HOST_API_BASE","http://localhost:8080")
# 5. 拼接完整 API 路径
target_url <- paste0(api_base, "/disease-data/data/export/apply/apply/case?applyId=", dataset_id)
# target_url <- paste0(api_base, "/disease-data/data/export/apply/apply/case?applyId=", dataset_id)
target_url <- paste0(api_base, "/research-project/generate-project-dataset/", dataset_id)
# 6. 创建临时文件 (明确 .xlsx 后缀)
tmp_file <- tempfile(fileext = ".xlsx")
......@@ -51,11 +53,15 @@ shinyServer(function(input, output, session) {
response <- httr::POST(
url = target_url,
# 添加 Bearer Token (或根据你的接口要求修改 Header)
httr::add_headers(Authorization = paste("Bearer", token)),
httr::add_headers(authentication = paste(token)),
# 将结果写入磁盘
httr::write_disk(tmp_file, overwrite = TRUE)
)
message("=== Request Log ===")
print(response$request)
message("===================")
# 检查 HTTP 状态码
if (httr::status_code(response) != 200) {
stop(paste("下载失败,请手动导入,HTTP状态码:", httr::status_code(response)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment