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

修改鉴权代码

上级 e77c2307
import request from '@/webPublic/zyd_public/request/request';
import config from '@/config/config';
const getTime = () => {
return request(`${config.mockServer}/${config.gateWayUrl.zydxg}/InstructorConfigApi/getCurrentDate`, {
method: 'POST',
body: {},
});
};
export async function queryCurrent() {
let t = await getTime();
if (t) {
window.serviceCurrentDate = t; // 服务器时间
setInterval(() => {
window.serviceCurrentDate += 1000;
}, 1000);
}
return request(`${config.mockServer}/${config.gateWayUrl.zydxg}/UserApi/queryCurrent`, {
method: 'POST',
body: {
},
});
}
......@@ -343,7 +343,7 @@ export function getHeaders(url = '') {
const token = getToken();
const currentInfo = getCurrentUser();
const timestamp = window.serviceCurrentDate || new Date().getTime();
const secretString = token + currentInfo.userid + currentInfo.typeString + timestamp;
const secretString = token + currentInfo.xgUserId + timestamp;
const res = {
headers: {
......@@ -351,7 +351,7 @@ export function getHeaders(url = '') {
},
};
if(getIsBei_Dian() && currentInfo?.userid){
res.headers.auto = Md5(secretString);
res.headers.auth = Md5(secretString);
res.headers.timestamp = timestamp;
if (isTest) {
console.log(
......@@ -359,7 +359,7 @@ export function getHeaders(url = '') {
secretString,
md5S: Md5(secretString),
timestamp,
userId: currentInfo.userid,
xgUserId: currentInfo.xgUserId,
typeString: currentInfo.typeString,
},
);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论