提交 1cb0aa08 authored 作者: 钟是志's avatar 钟是志

加密函数剥离出来在最外层处理

上级 0f2901b8
...@@ -19,16 +19,18 @@ const giveKey = (key, datas) => { ...@@ -19,16 +19,18 @@ const giveKey = (key, datas) => {
}; };
export function giveBase16EnCode(datas, url) { export function giveBase16EnCode(datas, url) {
if (url) { if (url && typeof url === 'string') {
if (url.indexOf('DataColumnApi/getOptions') > -1) {
return giveKey('filterSql', datas); const apiList = ['DataColumnApi', 'DataRightApi', 'DataObjApi', 'UserApi', 'UnifiedAppFormApi', 'DataObjApi'];
} const filiterList = apiList.filter((g) => {
return url.indexOf(g) > -1;
if (url.indexOf('DataRightApi/add') > -1) { });
return giveKey('filterSql', datas); if(!filiterList || !filiterList.length){
// console.log(url);
return datas;
} }
if (url.indexOf('DataRightApi/addBatch') > -1) { if (url.indexOf('DataColumnApi/getOptions') > -1) {
return giveKey('filterSql', datas); return giveKey('filterSql', datas);
} }
...@@ -48,6 +50,14 @@ export function giveBase16EnCode(datas, url) { ...@@ -48,6 +50,14 @@ export function giveBase16EnCode(datas, url) {
return giveKey('sqlKey', datas); return giveKey('sqlKey', datas);
} }
if (url.indexOf('DataRightApi/add') > -1) {
return giveKey('filterSql', datas);
}
if (url.indexOf('DataRightApi/addBatch') > -1) {
return giveKey('filterSql', datas);
}
if (url.indexOf('DataObjApi/add') > -1) { if (url.indexOf('DataObjApi/add') > -1) {
return giveKey('sqlScript', datas); return giveKey('sqlScript', datas);
} }
......
...@@ -117,7 +117,7 @@ const loginUmiRequest = extend({ ...@@ -117,7 +117,7 @@ const loginUmiRequest = extend({
const getUrl = url => (url.startsWith('/') ? url : '/' + url); const getUrl = url => (url.startsWith('/') ? url : '/' + url);
export const request = (url, data, options = {}) => { export const request = (url, data, options = {}) => {
data = giveBase16EnCode(url, data); data = giveBase16EnCode(data, url);
let version = let version =
localStorage.getItem('version') && localStorage.getItem('version') !== 'undefined' localStorage.getItem('version') && localStorage.getItem('version') !== 'undefined'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论