feat: 补齐客户端/管理端服务模块与数据库 schema,完善登录短信、法大大签署及公共函数

This commit is contained in:
2026-10-14 21:55:08 +08:00
parent 3481fda7a0
commit 55bcf96889
545 changed files with 28151 additions and 415 deletions
@@ -0,0 +1,29 @@
'use strict';
function normalizeSortType(type) {
if (type === 'ascending') return 'asc';
if (type === 'descending') return 'desc';
type = typeof type === 'string' ? type.toLowerCase() : type;
return ['asc', 'desc'].includes(type) ? type : '';
}
function normalizeSortRule(sortRule, defaultSortArr, allowNames) {
const allowSet = allowNames && allowNames.length ? new Set(allowNames) : null;
const rules = Array.isArray(sortRule)
? sortRule
: (sortRule && typeof sortRule === 'object' ? [sortRule] : []);
const sortArr = rules
.map(item => {
const name = item && (item.name || item.prop || item.field || item.key);
const type = normalizeSortType(item && (item.type || item.order || item.sort));
if (!name || !type) return null;
if (allowSet && !allowSet.has(name)) return null;
return {name, type};
})
.filter(Boolean);
return sortArr.length ? sortArr : defaultSortArr;
}
module.exports = normalizeSortRule;