提交 2d109825 authored 作者: ch's avatar ch

加密前调接口获取替换key

上级 4bd25459
import baseX from 'base-x';
import { isEmpty, template } from 'lodash';
import { apiRequest } from '../utils/request';
var BASE16 = '0123456789abcdef';
var bs16 = baseX(BASE16);
......@@ -27,18 +28,23 @@ const encryptApiList = [
{
api: 'DataColumnApi/getLabels',
key: ['allValues'],
query: true,
setNull: true,
},
{
api: 'DataColumnApi/getSqlOptions',
key: ['allValues'],
query: true,
},
{
api: 'DataColumnApi/getSqlLabels',
key: ['allValues'],
query: true,
},
{
api: 'DataColumnApi/getSqlData',
key: ['allValues', 'sqlKey'],
query: true,
},
{
api: 'DataRightApi/add',
......@@ -85,13 +91,38 @@ const encryptApiList = [
key: ['content'],
},
]
export function giveBase16EnCode(datas, url) { // 全局加解密函数.
export async function giveBase16EnCode(datas, url) { // 全局加解密函数.
if (url && typeof url === 'string') {
for(let item of encryptApiList){
if(url.indexOf(item.api) > -1){
for(let g of item.key){
datas = giveKey(g, datas);
for (let item of encryptApiList) {
if (url.indexOf(item.api) > -1) {
for (let g of item.key) {
if (g == "allValues") {
if (item.setNull) {
datas.allValues = "{}";
} else {
if (item.query) {
if (datas.sqlKey.length < 13) {
const response = await apiRequest("/SqlManageEntityApi/findParamsKey", { sqlKey: datas.sqlKey });
if (response.length == 0) {
datas.allValues = "{}";
} else {
const x = JSON.parse(allValues);
const y = {};
for (var i in response) {
if (x[i]) {
y[i] = x[i]
}
datas.allValues = JSON.stringify(y);
}
}
} else {
datas.allValues = "{}";
}
}
}
datas = giveKey(g, datas);
}
}
return datas;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论