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

鉴权加密修改

上级 657f704e
...@@ -100,7 +100,7 @@ export async function getTransformApi(url) { // ...@@ -100,7 +100,7 @@ export async function getTransformApi(url) { //
let apiUrl = ''; let apiUrl = '';
let needTransform = true; let needTransform = true;
const t = getToken(); const t = getToken();
const TRANSFORM_BIN = window.CONFIG?.TRANSFORM_BIN || true; const TRANSFORM_BIN = window.CONFIG?.TRANSFORM_BIN;
if(!TRANSFORM_BIN){ if(!TRANSFORM_BIN){
needTransform = false; needTransform = false;
} }
......
...@@ -17,7 +17,7 @@ import { offline } from '../location/Toast'; ...@@ -17,7 +17,7 @@ import { offline } from '../location/Toast';
import { giveBase16EnCode, requestFileInfo } from '@/webPublic/one_stop_public/Base16'; import { giveBase16EnCode, requestFileInfo } from '@/webPublic/one_stop_public/Base16';
import objectToFormData from '@/webPublic/zyd_public/utils/object-to-formdata-custom'; import objectToFormData from '@/webPublic/zyd_public/utils/object-to-formdata-custom';
import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils'; import { getUrlInfo } from '@/webPublic/one_stop_public/DetailForAudit/utils';
import { getHeaders } from '@/webPublic/zyd_public/utils/utils'; import { getHeaders, getIsBei_Dian } from '@/webPublic/zyd_public/utils/utils';
import { proxyChangeUrl } from '@/webPublic/zyd_public/request/proxyChangeUrl'; import { proxyChangeUrl } from '@/webPublic/zyd_public/request/proxyChangeUrl';
import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform'; import { getTransformApi } from '@/webPublic/one_stop_public/2022beidianke/localstorageTransform';
...@@ -269,16 +269,21 @@ export async function requestOrigin(url, data, options = {}){ ...@@ -269,16 +269,21 @@ export async function requestOrigin(url, data, options = {}){
} }
let trueUrl = (options.prefix || '') + url; let trueUrl = (options.prefix || '') + url;
const { transformApi, headersApi } = await getTransformApi(trueUrl); const { transformApi, headersApi } = await getTransformApi(trueUrl);
if(options.headers){ if(getIsBei_Dian()){
options.headers = { if(options.headers){
...options.headers, options.headers = {
apis: headersApi, ...options.headers,
}; apis: headersApi,
}else{ };
options.headers = { }else{
apis: headersApi, options.headers = {
}; apis: headersApi,
};
}
} }
delete options.prefix; delete options.prefix;
// POST请求 // POST请求
return fetchRequest(transformApi, { return fetchRequest(transformApi, {
......
...@@ -16,17 +16,18 @@ export function getHeaders(url = '', headersApi = undefined) { ...@@ -16,17 +16,18 @@ export function getHeaders(url = '', headersApi = undefined) {
const res = { const res = {
headers: {}, headers: {},
}; };
if(headersApi){
res.headers.apis = headersApi;
}
if(!token || token === 'null'){ if(!token || token === 'null'){
return res; return res;
} }
res.headers.Authorization = `bearer ${token}`;
if (getIsBei_Dian() && userId if (getIsBei_Dian() && userId
) { ) {
res.headers.Authorization = `bearer ${token}`;
res.headers.auth = gg5xxxxx(secretString); res.headers.auth = gg5xxxxx(secretString);
res.headers.timestamp = timestamp; res.headers.timestamp = timestamp;
if(headersApi){
res.headers.apis = headersApi;
}
} }
return res; return res;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论