Commit 1dac305d authored by xianyang's avatar xianyang

优化礼物类型配置列表

parent cee829a2
......@@ -268,13 +268,16 @@ def get_account_type(**data):
condition.append(f" type={data.get('type')}")
if condition:
total_sql = f"select count(id) as num from fi_account_type where {' and '.join(condition)}"
gift_sql = f"select id,keyName,keyValue,type from fi_account_type where {' and '.join(condition)} limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
gift_sql = f"select id,keyName,keyValue,type,createTime as create_time from fi_account_type where {' and '.join(condition)} limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
else:
total_sql = f"select count(id) as num from fi_account_type"
gift_sql = f"select id,keyName,keyValue,type from fi_account_type limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
gift_sql = f"select id,keyName,keyValue,type,createTime as create_time from fi_account_type limit {(int(data.get('page')) - 1) * data.get('size')},{data.get('size')}"
total = LinkMysql(env.DB_3YV2).query_mysql(total_sql)
output = LinkMysql(env.DB_3YV2).query_mysql(gift_sql)
if output:
for i in output:
time_array = time.localtime(i['create_time'])
i['create_time'] = time.strftime("%Y-%m-%d %H:%M:%S", time_array)
return output, total[0]['num']
return [], 0
......
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