Commit de23b162 authored by xianyang's avatar xianyang

优化转账金额不足问题

parent 82395212
...@@ -264,6 +264,10 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type, remark='用 ...@@ -264,6 +264,10 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type, remark='用
"notify_url": "" "notify_url": ""
} }
res = search(request_data, 'Server.UserExecute.Transfer') res = search(request_data, 'Server.UserExecute.Transfer')
if not res['data']['result']['status']:
if 'Insufficient assets' in res['data']['result']['msg']:
return "资产不足,无法转账"
return res['data']['result']['msg']
print(res) print(res)
status = 2 status = 2
if res['status'] == 0: if res['status'] == 0:
...@@ -272,7 +276,7 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type, remark='用 ...@@ -272,7 +276,7 @@ def transfer_trigger_task(uuid, user_id, balance, type, amount_type, remark='用
add_sql = f"insert into all_record_table(user_id, type, status, reference_number, remark, money, is_add, money_data,create_time,amount_type) " \ 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});" 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) LinkMysql(env.DB_3YV2).perform_mysql(add_sql)
return res return ''
def transfer_money(db: Session, param, h_list): def transfer_money(db: Session, param, h_list):
...@@ -309,7 +313,7 @@ def transfer_money(db: Session, param, h_list): ...@@ -309,7 +313,7 @@ def transfer_money(db: Session, param, h_list):
# 转账 # 转账
is_success = transfer_trigger_task(param.dst_id, 0, param.amount, 'platformRecharge', amount_type, 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) f"{param.dst_id}给{param.transfer_id}转账", [], 0, param.transfer_id)
if not is_success['status']: if is_success:
return is_success return is_success
user = query_token(db, h_list) user = query_token(db, h_list)
transfer_sql = f"insert into fi_transfer_log(amount, dst_name, create_time, transfer_uuid, dst_uuid, user_id, remarks, operator,operator_id) " \ transfer_sql = f"insert into fi_transfer_log(amount, dst_name, create_time, transfer_uuid, dst_uuid, user_id, remarks, operator,operator_id) " \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment