From 3d70db464b6d97a89f57527ff782dd1f8c00ca51 Mon Sep 17 00:00:00 2001 From: han0 Date: Tue, 26 Oct 2021 15:45:22 +0800 Subject: [PATCH] =?UTF-8?q?feat(func):=20=E6=96=B0=E5=A2=9E=E5=87=BD?= =?UTF-8?q?=E6=95=B0=20get=5Fsorting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nc_http/core/func.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/nc_http/core/func.py b/nc_http/core/func.py index e878e77..0e8a26e 100644 --- a/nc_http/core/func.py +++ b/nc_http/core/func.py @@ -7,7 +7,7 @@ from six import string_types def strip_value(data): """ - + 递归处理字符占位符 :param data: :return: """ @@ -92,6 +92,20 @@ def get_paging(limit=10): } +def get_sorting(): + """ + 获取排序参数 + :return: + """ + data = get_request_json() + if not data.get('order_field'): + return None + return { + 'order': data.get('order') or 'asc', + 'order_field': uncamelize(data.get('order_field')), + } + + def send_excel(file_handler, file_name, suffix='xlsx'): """ 发送 excel 文件