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
13d3d23f
Commit
13d3d23f
authored
Apr 21, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化公会质押金,新增首页查询
parent
48c493eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
crud.py
app/api/account/crud.py
+31
-1
No files found.
app/api/account/crud.py
View file @
13d3d23f
...
...
@@ -10,7 +10,7 @@ from core.config.env import env
from
libs.business
import
TYPE_NAME
,
query_fi_account_type
from
libs.db_link
import
LinkMysql
from
libs.functions
import
wrapper_out
,
get_now_timestamp
,
uuid
,
get_before_timestamp
,
time_str_to_timestamp
,
\
get_yesterday_timestamp
,
search
,
get_last_month
get_yesterday_timestamp
,
search
,
get_last_month
,
get_date_list
from
libs.orm
import
QueryAllData
from
models
import
account
as
models
from
models.account
import
AccountFinance
,
AccountFinanceDetails
,
AccountType
...
...
@@ -420,6 +420,9 @@ class AccountStatistics(object):
if
self
.
unique
==
'guild_account'
:
data
,
total
=
self
.
guild_calculation
()
return
data
,
total
,
0
if
self
.
unique
==
"pledgeDeduction"
:
data
,
total
=
self
.
guild_calculation_pledge
()
return
data
,
total
,
0
if
self
.
unique
==
"user_account"
:
if
self
.
user_id
:
user_sql
=
f
"select uuid from v2_user where user_id={self.user_id}"
...
...
@@ -477,6 +480,33 @@ class AccountStatistics(object):
mysql_data
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
sql
)
return
mysql_data
[
int
(
self
.
page
-
1
)
*
self
.
size
:
self
.
page
*
self
.
size
],
len
(
mysql_data
)
def
guild_calculation_pledge
(
self
):
"""公会质押金处理"""
cp_cond
=
[]
start_time
=
time_str_to_timestamp
(
self
.
start_time
+
' 00:00:00'
)
end_time
=
time_str_to_timestamp
(
self
.
end_time
+
' 23:59:59'
)
month_tuple
=
get_date_list
(
self
.
start_time
,
self
.
end_time
)
cp_cond
.
append
(
f
" create_time >={start_time} and create_time<= {end_time}"
)
cp_cond
.
append
(
" (income != 0 or outcome !=0 or initial_money !=0) "
)
if
self
.
user_id
:
guild_sql
=
f
"select ice_uuid from guild where id={self.user_id}"
res_data
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
guild_sql
)
if
not
res_data
:
return
[],
0
cp_cond
.
append
(
f
" uuid='{res_data[0]['ice_uuid']}'"
)
result_list
=
[]
for
i
in
month_tuple
:
year
,
month
=
str
(
i
)[:
4
],
str
(
i
)[
4
:]
table
=
'finance_data_calculation_pledge'
+
year
+
'_'
+
month
try
:
cp_sql
=
f
"SELECT FROM_UNIXTIME(create_time, '
%
Y-
%
c-
%
d') as create_time,uuid,income,outcome,initial_money from {table} WHERE {' and '.join(cp_cond)} GROUP BY create_time, uuid ORDER BY create_time DESC"
mysql_data
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
cp_sql
)
result_list
=
result_list
+
mysql_data
except
Exception
as
e
:
print
(
f
"没有此表{table},或者检查:{cp_sql},是否正确!"
)
continue
return
result_list
[
int
(
self
.
page
-
1
)
*
self
.
size
:
self
.
page
*
self
.
size
],
len
(
result_list
)
def
delete_specify_field
(
data
):
res_list
=
[]
...
...
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