Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
financial-system
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xianyang
financial-system
Commits
48e06dc2
Commit
48e06dc2
authored
Apr 12, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化账户消费类型显示
parent
7ca70078
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
crud.py
app/api/account/crud.py
+17
-6
views.py
app/api/account/views.py
+2
-2
No files found.
app/api/account/crud.py
View file @
48e06dc2
...
...
@@ -116,16 +116,27 @@ class HDUd():
return
self
.
result_list
,
count
def
get_gift_type
():
def
get_gift_type
(
unique_tag
):
"""礼物类型"""
fi_income_id
=
[]
fi_out_id
=
[]
fi_sql
=
f
"select income,output from fi_account where unique_tag='{unique_tag}'"
gift_sql
=
"select id,keyName,keyValue,type from fi_account_type"
with
ThreadPoolExecutor
(
max_workers
=
2
)
as
pool
:
future1
=
pool
.
submit
(
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
,
fi_sql
)
future2
=
pool
.
submit
(
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
,
gift_sql
)
account
=
future1
.
result
()
output
=
future2
.
result
()
if
account
[
0
]
.
get
(
'output'
):
fi_out_id
=
[
int
(
i
)
for
i
in
account
[
0
]
.
get
(
'output'
)
.
split
(
','
)]
if
account
[
0
]
.
get
(
'income'
):
fi_income_id
=
[
int
(
i
)
for
i
in
account
[
0
]
.
get
(
'income'
)
.
split
(
','
)]
out_list
=
[]
income_list
=
[]
gift_sql
=
"select id,keyName,keyValue,type from fi_account_type"
output
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
gift_sql
)
for
info
in
output
:
if
info
.
get
(
"type"
)
==
1
:
if
info
.
get
(
"type"
)
==
1
and
info
.
get
(
"id"
)
in
fi_income_id
:
income_list
.
append
(
info
)
else
:
if
info
.
get
(
"type"
)
==
0
and
info
.
get
(
"id"
)
in
fi_out_id
:
out_list
.
append
(
info
)
return
{
"income"
:
income_list
,
"output"
:
out_list
}
...
...
@@ -299,7 +310,7 @@ def out_income_combine(data):
res_dict
[
'balance'
]
=
res_dict
[
'income'
]
-
res_dict
[
'outcome'
]
record_v_list
=
[]
for
k
,
v
in
record_dict
.
items
():
v
[
'balance'
]
=
v
[
'income'
]
-
v
[
'outcome'
]
v
[
'balance'
]
=
round
(
v
[
'income'
]
-
v
[
'outcome'
],
2
)
time_arr
=
time
.
strptime
(
v
[
'create_time'
],
"
%
Y
%
m
%
d"
)
v
[
'create_time'
]
=
int
(
time
.
mktime
(
time_arr
))
record_v_list
.
append
(
v
)
...
...
app/api/account/views.py
View file @
48e06dc2
...
...
@@ -33,9 +33,9 @@ def user_list(page: int, size: int, name: Optional[str] = None, token=Depends(lo
@
router
.
get
(
"/gift/type"
)
def
gift_type_list
(
token
=
Depends
(
login_required
)):
def
gift_type_list
(
unique_tag
:
Optional
[
str
]
=
""
,
token
=
Depends
(
login_required
)):
"""礼物类型配置返回"""
result
=
crud
.
get_gift_type
()
result
=
crud
.
get_gift_type
(
unique_tag
)
return
HttpResultResponse
(
data
=
result
)
...
...
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