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
ea0276fd
Commit
ea0276fd
authored
Mar 07, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化账户修改
parent
3a593bb3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
15 deletions
+7
-15
crud.py
app/api/account/crud.py
+5
-12
views.py
app/api/account/views.py
+2
-0
guild.py
app/api/statement/guild.py
+0
-3
No files found.
app/api/account/crud.py
View file @
ea0276fd
...
@@ -80,18 +80,11 @@ def create_account(db: Session, param: schemas.AccountCreate):
...
@@ -80,18 +80,11 @@ def create_account(db: Session, param: schemas.AccountCreate):
def
update_account_info
(
db
:
Session
,
old_data
):
def
update_account_info
(
db
:
Session
,
old_data
):
"""修改"""
"""修改"""
if
old_data
.
name
:
db
.
query
(
models
.
Account
)
.
filter
(
models
.
Account
.
id
==
old_data
.
id
)
.
update
(
db
.
query
(
models
.
Account
)
.
filter
(
models
.
Account
.
id
==
old_data
.
id
)
.
update
(
{
models
.
Account
.
name
:
old_data
.
name
},
{
models
.
Account
.
name
:
old_data
.
name
})
{
models
.
Account
.
remark
:
old_data
.
remark
},
if
old_data
.
remark
:
{
models
.
Account
.
income
:
','
.
join
(
map
(
str
,
old_data
.
income
))},
db
.
query
(
models
.
Account
)
.
filter
(
models
.
Account
.
id
==
old_data
.
id
)
.
update
(
{
models
.
Account
.
output
:
','
.
join
(
map
(
str
,
old_data
.
output
))})
{
models
.
Account
.
remark
:
old_data
.
remark
})
if
old_data
.
income
:
db
.
query
(
models
.
Account
)
.
filter
(
models
.
Account
.
id
==
old_data
.
id
)
.
update
(
{
models
.
Account
.
income
:
','
.
join
(
map
(
str
,
old_data
.
income
))})
if
old_data
.
output
:
db
.
query
(
models
.
Account
)
.
filter
(
models
.
Account
.
id
==
old_data
.
id
)
.
update
(
{
models
.
Account
.
output
:
','
.
join
(
map
(
str
,
old_data
.
output
))})
db
.
commit
()
db
.
commit
()
...
...
app/api/account/views.py
View file @
ea0276fd
...
@@ -37,6 +37,8 @@ def gift_type_list(db: Session = Depends(get_db)):
...
@@ -37,6 +37,8 @@ def gift_type_list(db: Session = Depends(get_db)):
@
router
.
post
(
"/update"
)
@
router
.
post
(
"/update"
)
def
read_account
(
data
:
schemas
.
AccountUpdate
,
db
:
Session
=
Depends
(
get_db
)):
def
read_account
(
data
:
schemas
.
AccountUpdate
,
db
:
Session
=
Depends
(
get_db
)):
"""账户修改"""
"""账户修改"""
if
not
data
.
name
:
return
HttpResultResponse
(
code
=
500
,
msg
=
"账户名不能为空"
)
crud
.
update_account_info
(
db
,
data
)
crud
.
update_account_info
(
db
,
data
)
return
HttpResultResponse
()
return
HttpResultResponse
()
...
...
app/api/statement/guild.py
View file @
ea0276fd
...
@@ -61,7 +61,6 @@ class GuildSet(object):
...
@@ -61,7 +61,6 @@ class GuildSet(object):
else
:
else
:
guild_info
=
self
.
query_guild_data
(
db
)
guild_info
=
self
.
query_guild_data
(
db
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
return
[],
0
return
[],
0
# 判断是列表还是导出接口
# 判断是列表还是导出接口
guild_info
.
reverse
()
guild_info
.
reverse
()
...
@@ -180,7 +179,6 @@ def transfer_money(db: Session, param, h_list):
...
@@ -180,7 +179,6 @@ def transfer_money(db: Session, param, h_list):
db
.
commit
()
db
.
commit
()
db
.
refresh
(
present
)
db
.
refresh
(
present
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
return
{}
return
{}
return
present
return
present
...
@@ -198,6 +196,5 @@ def create_fix_table(db: Session, param, h_list):
...
@@ -198,6 +196,5 @@ def create_fix_table(db: Session, param, h_list):
db
.
commit
()
db
.
commit
()
db
.
refresh
(
present
)
db
.
refresh
(
present
)
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
return
{}
return
{}
return
present
return
present
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