Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mancheng
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mancheng
Commits
78b6c728
Commit
78b6c728
authored
Dec 29, 2022
by
dong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix20221229
parent
af71c51a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
9 deletions
+21
-9
apps/models.py
+0
-0
apps/view_index/view.py
+21
-9
No files found.
apps/models.py
View file @
78b6c728
This diff is collapsed.
Click to expand it.
apps/view_index/view.py
View file @
78b6c728
...
...
@@ -28,17 +28,29 @@ def industry_distribute():
try
:
indu_obj_list
=
IndustryDistribute
.
query
.
all
()
industry_num_list
=
[]
data_list
=
[]
if
flag
==
1
:
data_dic
=
[{
"industry_name"
:
i
.
industry_name
,
"industry_num"
:
i
.
industry_num
,
}
for
i
in
indu_obj_list
]
for
i
in
indu_obj_list
:
if
i
.
industry_num
:
industry_num_list
.
append
(
i
.
industry_num
)
data_dic
=
{
"industry_name"
:
i
.
industry_name
,
"industry_num"
:
i
.
industry_num
if
i
.
industry_num
else
0
}
data_list
.
append
(
data_dic
)
# data = {"data": data_list, "total": sum(industry_num_list)}
if
flag
==
2
:
data_dic
=
[{
"industry_name"
:
i
.
industry_name
,
"investment_volume"
:
i
.
investment_volume
,
}
for
i
in
indu_obj_list
]
return
jsonify
(
code
=
RET
.
OK
,
data
=
data_dic
,
msg
=
'查询成功!'
)
for
i
in
indu_obj_list
:
if
i
.
industry_num
:
industry_num_list
.
append
(
i
.
investment_volume
)
data_dic
=
{
"industry_name"
:
i
.
industry_name
,
"investment_volume"
:
i
.
investment_volume
}
data_list
.
append
(
data_dic
)
data
=
{
"data"
:
data_list
,
"total"
:
round
(
sum
(
industry_num_list
),
2
)}
return
jsonify
(
code
=
RET
.
OK
,
data
=
data
,
msg
=
'查询成功!'
)
except
Exception
as
e
:
current_app
.
logger
.
error
(
e
)
return
jsonify
(
code
=
RET
.
DBERR
,
msg
=
"数据库错误"
)
...
...
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