Commit 6d220f00 authored by xianyang's avatar xianyang

代码优化

parent 8200adaf
...@@ -270,7 +270,7 @@ class FinanceFix(object): ...@@ -270,7 +270,7 @@ class FinanceFix(object):
count_sql = f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}" count_sql = f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
data_sql = f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log where {' and '.join(finance_filters)} order by id DESC limit {(int(page) - 1) * size},{size}" data_sql = f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log where {' and '.join(finance_filters)} order by id DESC limit {(int(page) - 1) * size},{size}"
else: else:
count_sql = f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}" count_sql = f"select count(id) as num from finance_fix_log"
data_sql = f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log order by id DESC limit {(int(page) - 1) * size},{size}" data_sql = f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log order by id DESC limit {(int(page) - 1) * size},{size}"
with ThreadPoolExecutor(max_workers=2) as pool: with ThreadPoolExecutor(max_workers=2) as pool:
future1 = pool.submit(LinkMysql(env.DB_3YV2).query_mysql, count_sql) future1 = pool.submit(LinkMysql(env.DB_3YV2).query_mysql, count_sql)
......
...@@ -6,7 +6,7 @@ from concurrent.futures.thread import ThreadPoolExecutor ...@@ -6,7 +6,7 @@ from concurrent.futures.thread import ThreadPoolExecutor
from sqlalchemy import and_, func, engine from sqlalchemy import and_, func, engine
from sqlalchemy.orm import Session from sqlalchemy.orm import Session
from core.config.env import env from core.config.env import env, COS_PATH, COS_RERURN_PATH
from libs.db_link import LinkMysql 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
from libs.orm import QueryAllData from libs.orm import QueryAllData
...@@ -127,7 +127,7 @@ def paymentset_guild_data(page, size,start_time,end_time): ...@@ -127,7 +127,7 @@ def paymentset_guild_data(page, size,start_time,end_time):
payment_list = LinkMysql(env.DB_3YV2).query_mysql(list_sql) payment_list = LinkMysql(env.DB_3YV2).query_mysql(list_sql)
list = [] list = []
for item in range(len(payment_list)): for item in range(len(payment_list)):
payment_list[item]['url'] = env.oss_url + payment_list[item].get("url") payment_list[item]['url'] = COS_PATH + payment_list[item].get("url")
items = payment_list[item] items = payment_list[item]
list.append(items) list.append(items)
return list, total return list, total
...@@ -490,8 +490,8 @@ def transfer_query(data): ...@@ -490,8 +490,8 @@ def transfer_query(data):
''' '''
调用 调用
''' '''
payment_sql=f"insert into payment_log(cont,money,url,uuid) values('{data.cont}','{data.money}','{data.url}','{data.uuid}')" payment_sql=f"insert into payment_log(cont,money,create_time,url,uuid) values('{data.cont}','{data.money}',{get_now_timestamp()},'{data.url}','{data.uuid}')"
LinkMysql(env.DB_3YV2).excete_mysql(payment_sql) LinkMysql(env.DB_3YV2).perform_mysql(payment_sql)
params = {} params = {}
if data.money > 0: if data.money > 0:
method = 'Server.BaseExecute.Increase' method = 'Server.BaseExecute.Increase'
......
...@@ -145,7 +145,7 @@ def finance_fix(page: int, ...@@ -145,7 +145,7 @@ def finance_fix(page: int,
start_time: Optional[str] = "", start_time: Optional[str] = "",
end_time: Optional[str] = "", end_time: Optional[str] = "",
token=Depends(login_required)): token=Depends(login_required)):
"""账户修复报表列表""" """财务修复报表列表"""
res, num = crud.FinanceFix.get_finance_fix_data(page, size, start_time, end_time) res, num = crud.FinanceFix.get_finance_fix_data(page, size, start_time, end_time)
return HttpResultResponse(total=num, data=res) return HttpResultResponse(total=num, data=res)
......
...@@ -81,8 +81,7 @@ def new_upload_file(file_object,filename): ...@@ -81,8 +81,7 @@ def new_upload_file(file_object,filename):
return "" return ""
if response is None: if response is None:
print("上传成功") print("上传成功")
cos_path = COS_PATH + filename return filename
return cos_path
def random_number(): def random_number():
......
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