提交 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 = '') { ...@@ -343,7 +343,7 @@ export function getHeaders(url = '') {
const token = getToken(); const token = getToken();
const currentInfo = getCurrentUser(); const currentInfo = getCurrentUser();
const timestamp = window.serviceCurrentDate || new Date().getTime(); const timestamp = window.serviceCurrentDate || new Date().getTime();
const secretString = token + currentInfo.userid + currentInfo.typeString + timestamp; const secretString = token + currentInfo.xgUserId + timestamp;
const res = { const res = {
headers: { headers: {
...@@ -351,7 +351,7 @@ export function getHeaders(url = '') { ...@@ -351,7 +351,7 @@ export function getHeaders(url = '') {
}, },
}; };
if(getIsBei_Dian() && currentInfo?.userid){ if(getIsBei_Dian() && currentInfo?.userid){
res.headers.auto = Md5(secretString); res.headers.auth = Md5(secretString);
res.headers.timestamp = timestamp; res.headers.timestamp = timestamp;
if (isTest) { if (isTest) {
console.log( console.log(
...@@ -359,7 +359,7 @@ export function getHeaders(url = '') { ...@@ -359,7 +359,7 @@ export function getHeaders(url = '') {
secretString, secretString,
md5S: Md5(secretString), md5S: Md5(secretString),
timestamp, timestamp,
userId: currentInfo.userid, xgUserId: currentInfo.xgUserId,
typeString: currentInfo.typeString, typeString: currentInfo.typeString,
}, },
); );
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论