refactor:

This commit is contained in:
han0
2020-11-19 09:31:05 +08:00
parent dc2160a0c9
commit 20a1505bfe
2 changed files with 13 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
from decimal import Decimal from decimal import Decimal
from types import SimpleNamespace from types import SimpleNamespace
from nc_http.tools.helpers import list_to_tree
class HandleType: class HandleType:
SWITCH = 1 # 值交换 SWITCH = 1 # 值交换
@@ -169,11 +171,12 @@ class FESucks:
return rs return rs
@classmethod @staticmethod
def _parse_keys(cls, key, keys): def _parse_keys(key, keys):
keys = keys or [] keys = keys or []
if key: if key:
keys.append(key) keys.append(key)
return keys return keys
@staticmethod @staticmethod
@@ -186,12 +189,7 @@ class FESucks:
:param i: :param i:
:return: :return:
""" """
data = [] return list_to_tree(rows, id_key, parent_id_key, i)
for row in rows:
if row[parent_id_key] == i:
row['children'] = FESucks.list_to_tree(rows, id_key, parent_id_key, row[id_key])
data.append(row)
return data
''' '''

View File

@@ -1,2 +1,8 @@
pycman pycman
coverage coverage
flask
werkzeug
xlsxwriter
xlrd
captcha
six