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
82395212
Commit
82395212
authored
Mar 30, 2023
by
xianyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化转账
parent
4b479e33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
guild.py
app/api/statement/guild.py
+8
-4
No files found.
app/api/statement/guild.py
View file @
82395212
...
...
@@ -248,7 +248,7 @@ def query_token(db, h_list):
return
user_info
def
transfer_trigger_task
(
uuid
,
user_id
,
balance
,
type
,
amount_type
=
1
,
remark
=
'用户转账'
,
money_data
=
[],
def
transfer_trigger_task
(
uuid
,
user_id
,
balance
,
type
,
amount_type
,
remark
=
'用户转账'
,
money_data
=
[],
isUser
=
1
,
dst_uuid
=
False
,
referNum
=
''
):
"""转账验证"""
...
...
@@ -269,8 +269,8 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type=1, remark='
if
res
[
'status'
]
==
0
:
errmsg
=
json
.
dumps
(
res
[
'data'
])
status
=
3
add_sql
=
f
"insert into all_record_table(user_id, type, status, reference_number, remark, money, is_add, money_data,create_time) "
\
f
"values({user_id}, '{type}', {status},'{get_order()}','{remark}', {balance * 10 if amount_type == 1 else balance * 100},1,'{json.dumps(money_data)}',{get_now_timestamp()});"
add_sql
=
f
"insert into all_record_table(user_id, type, status, reference_number, remark, money, is_add, money_data,create_time
,amount_type
) "
\
f
"values({user_id}, '{type}', {status},'{get_order()}','{remark}', {balance * 10 if amount_type == 1 else balance * 100},1,'{json.dumps(money_data)}',{get_now_timestamp()}
,{amount_type}
);"
LinkMysql
(
env
.
DB_3YV2
)
.
perform_mysql
(
add_sql
)
return
res
...
...
@@ -278,10 +278,12 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type=1, remark='
def
transfer_money
(
db
:
Session
,
param
,
h_list
):
"""转账"""
user_id
=
0
amount_type_dict
=
{
'withdrawable'
:
2
,
'consumable'
:
1
}
if
param
.
type
==
0
:
# 系统转系统
out_sql
=
f
"select name from fi_account where uuid='{param.dst_id}' limit 0,1"
out
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
out_sql
)
dst_name
=
out
[
0
][
'name'
]
amount_type
=
1
if
param
.
type
==
1
:
# 系统转个人/公会
out_sql
=
f
"select name from fi_account where uuid='{param.dst_id}' limit 0,1"
out
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
out_sql
)
...
...
@@ -291,6 +293,7 @@ def transfer_money(db: Session, param, h_list):
if
income
:
user_id
=
income
[
0
][
'user_id'
]
dst_name
=
out
[
0
][
'name'
]
amount_type
=
amount_type_dict
.
get
(
param
.
transfer_type
)
if
amount_type_dict
.
get
(
param
.
transfer_type
)
else
1
if
param
.
type
==
2
:
# 个人/公会转系统
out_sql
=
f
"select nick_name from v2_user where uuid='{param.dst_id}' limit 0,1"
out
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
out_sql
)
...
...
@@ -300,10 +303,11 @@ def transfer_money(db: Session, param, h_list):
out_guild_sql
=
f
"select guild_name from guild where uuid='{param.transfer_id}'"
out_guild
=
LinkMysql
(
env
.
DB_3YV2
)
.
query_mysql
(
out_guild_sql
)
dst_name
=
out_guild
[
0
][
'guild_name'
]
if
out_guild
else
""
amount_type
=
amount_type_dict
.
get
(
param
.
transfer_type
)
if
amount_type_dict
.
get
(
param
.
transfer_type
)
else
1
try
:
# 转账
is_success
=
transfer_trigger_task
(
param
.
dst_id
,
0
,
param
.
amount
,
'platformRecharge'
,
1
,
is_success
=
transfer_trigger_task
(
param
.
dst_id
,
0
,
param
.
amount
,
'platformRecharge'
,
amount_type
,
f
"{param.dst_id}给{param.transfer_id}转账"
,
[],
0
,
param
.
transfer_id
)
if
not
is_success
[
'status'
]:
return
is_success
...
...
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