Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Radiant
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuzekai
Radiant
Commits
ed77255d
Commit
ed77255d
authored
Nov 26, 2025
by
gaozhaochen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:
1、适配中山的demo,自动加载数据
parent
c56c5069
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
27 deletions
+33
-27
server.R
radiant.data/inst/app/server.R
+33
-27
No files found.
radiant.data/inst/app/server.R
View file @
ed77255d
...
@@ -36,10 +36,12 @@ shinyServer(function(input, output, session) {
...
@@ -36,10 +36,12 @@ shinyServer(function(input, output, session) {
withProgress
(
message
=
'正在从业务系统同步数据...'
,
value
=
0.2
,
{
withProgress
(
message
=
'正在从业务系统同步数据...'
,
value
=
0.2
,
{
# 4. 获取环境变量中的 API 基地址
# 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 路径
# 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 后缀)
# 6. 创建临时文件 (明确 .xlsx 后缀)
tmp_file
<-
tempfile
(
fileext
=
".xlsx"
)
tmp_file
<-
tempfile
(
fileext
=
".xlsx"
)
...
@@ -51,11 +53,15 @@ shinyServer(function(input, output, session) {
...
@@ -51,11 +53,15 @@ shinyServer(function(input, output, session) {
response
<-
httr
::
POST
(
response
<-
httr
::
POST
(
url
=
target_url
,
url
=
target_url
,
# 添加 Bearer Token (或根据你的接口要求修改 Header)
# 添加 Bearer Token (或根据你的接口要求修改 Header)
httr
::
add_headers
(
Authorization
=
paste
(
"Bearer"
,
token
)),
httr
::
add_headers
(
authentication
=
paste
(
token
)),
# 将结果写入磁盘
# 将结果写入磁盘
httr
::
write_disk
(
tmp_file
,
overwrite
=
TRUE
)
httr
::
write_disk
(
tmp_file
,
overwrite
=
TRUE
)
)
)
message
(
"=== Request Log ==="
)
print
(
response
$
request
)
message
(
"==================="
)
# 检查 HTTP 状态码
# 检查 HTTP 状态码
if
(
httr
::
status_code
(
response
)
!=
200
)
{
if
(
httr
::
status_code
(
response
)
!=
200
)
{
stop
(
paste
(
"下载失败,请手动导入,HTTP状态码:"
,
httr
::
status_code
(
response
)))
stop
(
paste
(
"下载失败,请手动导入,HTTP状态码:"
,
httr
::
status_code
(
response
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment