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
0aaca536
Commit
0aaca536
authored
Apr 23, 2023
by
xupeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
时间修改为时间戳
parent
c8caaf20
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
13 deletions
+22
-13
guild.py
app/api/statement/guild.py
+13
-12
functions.py
libs/functions.py
+8
-0
guild.py
models/guild.py
+1
-1
No files found.
app/api/statement/guild.py
View file @
0aaca536
...
...
@@ -10,7 +10,8 @@ from sqlalchemy import and_, func, engine
from
sqlalchemy.orm
import
Session
from
core.config.env
import
env
,
COS_PATH
,
COS_RERURN_PATH
from
libs.db_link
import
LinkMysql
from
libs.functions
import
get_now_timestamp
,
get_now_datetime
,
search
,
get_order
,
get_ip
,
time_str_to_timestamp
from
libs.functions
import
get_now_timestamp
,
get_now_datetime
,
search
,
get_order
,
get_ip
,
time_str_to_timestamp
,
\
time_int_timestamp
from
libs.orm
import
QueryAllData
from
libs.token_verify
import
get_current_user
from
models.recharge
import
Settlement
,
Fitransferlog
,
FinanceFixLog
,
Account_log
,
Paymentlog
...
...
@@ -97,7 +98,7 @@ class GuildSet(object):
list
=
[]
for
item
in
data
:
item
[
'accounts'
]
=
item
.
get
(
"pearl"
)
+
item
.
get
(
"balance"
)
item
[
'update_time'
]
=
item
.
get
(
"update_time"
)
item
[
'update_time'
]
=
time
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
,
time
.
localtime
(
item
.
get
(
"update_time"
))
)
list
.
append
(
item
)
count
=
db
.
query
(
func
.
count
(
GuildSettlementLog
.
id
))
.
filter
()
.
scalar
()
return
list
,
count
...
...
@@ -536,7 +537,7 @@ def GuildSettlementAdd(db, data):
is_failure
=
transfer_trigger_task
(
guild_info
[
0
]
.
get
(
"uuid"
),
0
,
float
(
guild_data
.
balance
),
'guild_clear'
,
'consumable'
,
balance_refer_num
,
[],
1
,
acc_info
[
0
][
'uuid'
])
if
is_failure
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
400
,
{
"msg"
:
"结算错误"
}
first_sta
=
1
...
...
@@ -546,7 +547,7 @@ def GuildSettlementAdd(db, data):
is_lose
=
transfer_trigger_task
(
guild_info
[
0
]
.
get
(
"uuid"
),
0
,
float
(
guild_data
.
pearl
),
'guild_clear'
,
'withdrawable'
,
pearl_refer_num
,
[],
1
,
acc_info
[
0
][
'uuid'
])
if
is_lose
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
400
,
{
"msg"
:
"结算错误"
}
first_sta
=
1
...
...
@@ -558,15 +559,15 @@ def GuildSettlementAdd(db, data):
return
400
,
{
"msg"
:
"业务请求失败"
}
except
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
400
,
{
"msg"
:
"业务请求失败"
}
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
data
.
status
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
data
.
status
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
else
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
200
,
{
"msg"
:
"操作成功"
}
if
guild_data
.
status
==
1
:
...
...
@@ -578,11 +579,11 @@ def GuildSettlementAdd(db, data):
return
400
,
{
"msg"
:
"业务请求失败"
}
except
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
3
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
400
,
{
"msg"
:
"业务请求失败"
}
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
id
==
data
.
id
)
.
update
(
{
GuildSettlementLog
.
status
:
data
.
status
,
GuildSettlementLog
.
update_time
:
get_now_datetime
()})
{
GuildSettlementLog
.
status
:
data
.
status
,
GuildSettlementLog
.
update_time
:
time_int_timestamp
()})
db
.
commit
()
return
200
,{
"msg"
:
"操作成功"
}
else
:
...
...
@@ -606,12 +607,12 @@ def GuildSettlementmodify(db):
guild_data
=
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
work_id
==
item
.
get
(
"id"
))
.
first
()
if
guild_data
:
db
.
query
(
GuildSettlementLog
)
.
filter
(
GuildSettlementLog
.
work_id
==
item
.
get
(
"id"
))
.
update
(
{
GuildSettlementLog
.
status
:
item
.
get
(
"status"
),
GuildSettlementLog
.
update_time
:
get_now_datetime
(
)})
{
GuildSettlementLog
.
status
:
item
.
get
(
"status"
),
GuildSettlementLog
.
update_time
:
time_int_timestamp
(),
GuildSettlementLog
.
pearl
:
item
.
get
(
"pearl"
),
GuildSettlementLog
.
balance
:
item
.
get
(
"balance"
)})
db
.
commit
()
else
:
db_export
=
GuildSettlementLog
(
work_id
=
item
.
get
(
"id"
),
guild_id
=
item
.
get
(
"guild_id"
),
balance
=
item
.
get
(
"balance"
),
pearl
=
item
.
get
(
"pearl"
),
status
=
item
.
get
(
"status"
),
create_time
=
get_now_datetime
(),
update_time
=
get_now_datetime
(),
guild_name
=
item
.
get
(
"guild_name"
),
pearl
=
item
.
get
(
"pearl"
),
status
=
item
.
get
(
"status"
),
create_time
=
time_int_timestamp
(),
update_time
=
time_int_timestamp
(),
guild_name
=
item
.
get
(
"guild_name"
),
guild_per
=
item
.
get
(
"guild_per"
),
actual_money
=
item
.
get
(
"actual_money"
),
pledge_deposit_money
=
item
.
get
(
"pledge_deposit_money"
))
db
.
add
(
db_export
)
...
...
libs/functions.py
View file @
0aaca536
...
...
@@ -183,3 +183,11 @@ def get_date_list(start, end):
year_month
=
ym
.
strftime
(
'
%
Y
%
m'
)
data
.
append
(
year_month
)
return
tuple
(
set
(
data
))
from
datetime
import
datetime
def
time_int_timestamp
():
"""时间字符串类型 转为int"""
time_array
=
time
.
strptime
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S'
),
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
)
return
int
(
time
.
mktime
(
time_array
))
\ No newline at end of file
models/guild.py
View file @
0aaca536
...
...
@@ -146,7 +146,7 @@ class GuildSettlementLog(Base, SerializerMixin):
pearl
=
Column
(
DECIMAL
(
15
,
3
),
default
=
'0.000'
,
comment
=
"结算时候的珍珠,RMB单位"
)
status
=
Column
(
Integer
,
comment
=
"0待结算,1待结款,2已完成,3结算失败"
)
create_time
=
Column
(
Integer
,
default
=
'0'
,
comment
=
"创建时间"
)
update_time
=
Column
(
DateTime
,
default
=
'0'
,
comment
=
"修改时间"
)
update_time
=
Column
(
Integer
,
default
=
'0'
,
comment
=
"修改时间"
)
account_name
=
Column
(
String
(
122
),
comment
=
"户头名称"
)
guild_per
=
Column
(
String
(
122
),
comment
=
"公会比例"
)
actual_money
=
Column
(
DECIMAL
(
15
,
3
),
default
=
'0.000'
,
comment
=
"实际结款"
)
...
...
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