优化制度接口
This commit is contained in:
@@ -2931,12 +2931,19 @@ class BulletinDetail(APIView):
|
||||
user_agents_page = paginator.page(paginator.num_pages)
|
||||
data = []
|
||||
for info in user_agents_page.object_list:
|
||||
# 解析 file 字段:有文件返回数组,无文件返回空字符串
|
||||
try:
|
||||
file_list = json.loads(info.file) if info.file else []
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
file_list = []
|
||||
# 空列表返回空字符串
|
||||
file_result = file_list if file_list else ""
|
||||
data.append({
|
||||
"id": info.id,
|
||||
"title": info.title,
|
||||
"content": info.content,
|
||||
"times": info.times,
|
||||
"file": info.file,
|
||||
"file": file_result,
|
||||
"username": info.username,
|
||||
"state": info.state,
|
||||
})
|
||||
@@ -5054,12 +5061,19 @@ class SystemList(APIView):
|
||||
user_agents_page = paginator.page(paginator.num_pages)
|
||||
data = []
|
||||
for info in user_agents_page.object_list:
|
||||
# 解析 file 字段:有文件返回数组,无文件返回空字符串
|
||||
try:
|
||||
file_list = json.loads(info.file) if info.file else []
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
file_list = []
|
||||
# 空列表返回空字符串
|
||||
file_result = file_list if file_list else ""
|
||||
data.append({
|
||||
"id": info.id,
|
||||
"title": info.title,
|
||||
"content": info.content,
|
||||
"times": info.times,
|
||||
"file": info.file,
|
||||
"file": file_result,
|
||||
"username": info.username,
|
||||
"state": info.state,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user