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

鉴权加密修改

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