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
f458c8bf
Commit
f458c8bf
authored
Mar 29, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化角色 账户
parent
5540ed9e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
8 deletions
+33
-8
crud.py
app/api/account/crud.py
+3
-2
crud.py
app/api/role/crud.py
+10
-5
views.py
app/api/role/views.py
+3
-1
guild.py
app/api/statement/guild.py
+17
-0
No files found.
app/api/account/crud.py
View file @
f458c8bf
...
...
@@ -14,6 +14,8 @@ from libs.orm import QueryAllData
from
models
import
account
as
models
from
models.account
import
AccountFinance
,
AccountFinanceDetails
,
AccountType
locka
=
threading
.
Lock
()
def
get_account
(
name
):
"""查询单个账户"""
...
...
@@ -96,8 +98,7 @@ class HDUd():
data_sql
=
f
"select id,name,unique_tag,uuid,config_key,beneficiary,description,create_time, income, output from fi_account ORDER BY id DESC LIMIT {(int(page) - 1) * size},{size}"
query_res
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
data_sql
)
if
not
query_res
:
return
[]
return
[],
0
# 多线程
ths
=
[]
# 创建线程
...
...
app/api/role/crud.py
View file @
f458c8bf
...
...
@@ -53,12 +53,17 @@ def create_role(db: Session, user: schemas.RoleCreate):
def
update_role
(
db
:
Session
,
role_info
):
try
:
db
.
query
(
models
.
Role
)
.
filter
(
models
.
Role
.
id
==
role_info
.
id
)
.
update
(
{
models
.
Role
.
role_name
:
role_info
.
role_name
,
models
.
Role
.
authority
:
','
.
join
(
map
(
str
,
role_info
.
authority
))
if
role_info
.
authority
else
''
,
models
.
Role
.
remark
:
role_info
.
remark
})
except
Exception
as
e
:
if
'role_name'
in
str
(
e
):
return
'角色名称重复'
return
e
db
.
commit
()
return
''
def
delete_role
(
db
:
Session
,
role_id
:
int
):
...
...
app/api/role/views.py
View file @
f458c8bf
...
...
@@ -25,7 +25,9 @@ def create_user(data: schemas.RoleCreate, token=Depends(login_required), db: Ses
@
router
.
post
(
"/update"
)
def
read_user
(
data
:
schemas
.
RoleUpdate
,
token
=
Depends
(
login_required
),
db
:
Session
=
Depends
(
get_db
)):
"""角色权限分配"""
crud
.
update_role
(
db
,
data
)
res
=
crud
.
update_role
(
db
,
data
)
if
res
:
return
HttpResultResponse
(
code
=
500
,
msg
=
res
)
return
HttpResultResponse
()
...
...
app/api/statement/guild.py
View file @
f458c8bf
...
...
@@ -142,6 +142,15 @@ def outon_account_data(db: Session, dbname, params):
return
data
,
count
def
account_thead_task
(
data
):
account_sql
=
f
"select name from fi_account where uuid='{data['transfer_uuid']}' limit 0,1"
account
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
account_sql
)
if
not
account
:
user_sql
=
f
"select nick_name as name from v2_user where uuid='{data['transfer_uuid']}' limit 0,1"
account
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
user_sql
)
data
[
'transfer_name'
]
=
account
[
0
][
'name'
]
def
accout_list_data
(
**
params
):
accout_filters
=
[]
...
...
@@ -165,6 +174,14 @@ def accout_list_data(**params):
total
=
future1
.
result
()
res
=
future2
.
result
()
if
res
:
# 多线程
ths
=
[]
for
x
in
range
(
len
(
res
)):
ths
.
append
(
threading
.
Thread
(
target
=
account_thead_task
,
args
=
[
res
[
x
]]))
for
y
in
range
(
len
(
res
)):
ths
[
y
]
.
start
()
for
z
in
range
(
len
(
res
)):
ths
[
z
]
.
join
()
return
res
,
total
[
0
][
'num'
]
return
[],
0
...
...
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