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

团委H5修改

上级 d86ca888
// import { getCurrentUser, getToken } from '@/webPublic/one_stop_public/utils/token'; // import { getCurrentUser, getToken } from '@/webPublic/one_stop_public/utils/token';
import Md5 from 'js-md5';
import {getCurrentUser, getUserInfo} from '@/H5Public/utils/2022new/currentUser'; // import {getCurrentUser, getUserInfo} from '@/H5Public/utils/2022new/currentUser';
import { getIsBei_Dian, getToken } from '@/H5Public/utils/authority'; import { getIsBei_Dian, getToken } from '@/H5Public/utils/authority';
import { getUrlParams } from '@/H5Public/utils/handleString'; // import { getUrlParams } from '@/H5Public/utils/handleString';
const isTest = getUrlParams().test;
export function getHeaders(url = '') { export function getHeaders(url = '') {
const token = getToken(); const token = getToken();
const currentInfo = getCurrentUser(); // const currentInfo = getCurrentUser();
const onestopInfo = getUserInfo(); // const onestopInfo = getUserInfo();
const id = onestopInfo.id || currentInfo.xgUserId; // const id = onestopInfo.id || currentInfo.xgUserId;
const timestamp = onestopInfo.differenceBetweenServerAndClientTime ? new Date().getTime() + onestopInfo.differenceBetweenServerAndClientTime : new Date().getTime(); // const timestamp = onestopInfo.differenceBetweenServerAndClientTime ? new Date().getTime() + onestopInfo.differenceBetweenServerAndClientTime : new Date().getTime();
const secretString = token + id + timestamp; // const secretString = token + id + timestamp;
const res = { const res = {
headers: { headers: {
Authorization: `bearer ${token}`, Authorization: `bearer ${token}`,
}, },
}; };
//
if(getIsBei_Dian() && id){ // if(getIsBei_Dian() && process.env.){
res.headers.auth = Md5(secretString); // }
res.headers.timestamp = timestamp;
}
return res; return res;
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论