File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ async def admin_delete(code: str, s: AsyncSession = Depends(get_session)):
98
98
async def config (s : AsyncSession = Depends (get_session )):
99
99
# 从数据库获取系统配置
100
100
data = (await s .execute (select (Values ).filter (Values .key == 'config' ))).scalar_one_or_none ()
101
- return {'detail' : '获取成功' , 'data' : data .value if data else {}}
101
+ return {'detail' : '获取成功' , 'data' : data .value if data else {'banners' : [] }}
102
102
103
103
104
104
@app .get ('/' )
@@ -114,7 +114,8 @@ async def banner(request: Request, s: AsyncSession = Depends(get_session)):
114
114
if config and config .value .get ('banners' ):
115
115
return {
116
116
'detail' : '查询成功' ,
117
- 'data' : config .value ['banners' ]
117
+ 'data' : config .value ['banners' ],
118
+ 'enable' : request .headers .get ('pwd' , '' ) == settings .ADMIN_PASSWORD or settings .ENABLE_UPLOAD ,
118
119
}
119
120
# 如果不存在config,就返回默认的banner
120
121
return {
You can’t perform that action at this time.
0 commit comments