Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
507a2bf1
提交
507a2bf1
authored
7月 15, 2022
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
优化代码
上级
75ca2362
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
70 行删除
+23
-70
token.js
one_stop_public/utils/token.js
+4
-0
utils.js
one_stop_public/utils/utils.js
+4
-3
getHeaders.js
zyd_public/utils/getHeaders.js
+1
-61
queryCurrent.js
zyd_public/utils/queryCurrent.js
+14
-6
没有找到文件。
one_stop_public/utils/token.js
浏览文件 @
507a2bf1
...
...
@@ -37,6 +37,7 @@ export function getToken() {
}
const
y
=
localStorage
.
getItem
(
'antd-pro-token'
);
if
(
y
&&
y
.
length
>
11
)
{
setCookie
(
'token'
,
x
,
1
);
return
y
;
}
...
...
@@ -63,11 +64,13 @@ export const getUserInfo = () => {
x
=
JSON
.
parse
(
x
);
if
(
!
x
.
groupsId
)
{
x
.
groupsId
=
'pub'
;
x
.
differenceBetweenServerAndClientTime
=
0
;
}
return
x
;
}
else
{
return
{
groupsId
:
'pub'
,
differenceBetweenServerAndClientTime
:
0
,
};
}
};
...
...
@@ -99,6 +102,7 @@ export function getCurrentUser() {
export
function
setCurrentUser
(
v
)
{
if
(
v
&&
typeof
v
===
'object'
)
{
v
.
token
=
getToken
();
sessionStorage
.
setItem
(
'currentUser'
,
JSON
.
stringify
(
v
));
}
}
one_stop_public/utils/utils.js
浏览文件 @
507a2bf1
...
...
@@ -63,9 +63,10 @@ export const getOneStopMyInfo = (params = {}) => {
if
(
!
res
.
groupsId
){
res
.
groupsId
=
'pub'
;
}
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
res
));
getTime
();
return
res
;
return
getTime
().
then
((
t
)
=>
{
res
.
differenceBetweenServerAndClientTime
=
t
;
localStorage
.
setItem
(
'user'
,
JSON
.
stringify
(
res
));
});
}
});
};
zyd_public/utils/getHeaders.js
浏览文件 @
507a2bf1
...
...
@@ -3,73 +3,14 @@ import gg5xxxxx from 'js-md5';
import
{
getIsBei_Dian
}
from
'@/webPublic/zyd_public/utils/utils'
;
import
{
getUrlInfo
}
from
'@/webPublic/one_stop_public/DetailForAudit/utils'
;
const
isTest
=
getUrlInfo
().
test
;
window
.
differenceBetweenServerAndClientTime
=
window
.
differenceBetweenServerAndClientTime
||
0
;
// /**
// * 混淆代码
// * 2022年7月12日
// * 钟是志
// * */
// function _0x202e(_0x548f51, _0x50b3ff) {
// const _0x568ad8 = _0x568a();
// return _0x202e = function (_0x202e02, _0x19f086) {
// _0x202e02 = _0x202e02 - 0x7d;
// let _0x29770a = _0x568ad8[_0x202e02];
// return _0x29770a;
// }, _0x202e(_0x548f51, _0x50b3ff);
// }
//
// (function (_0x4c31fc, _0x463010) {
// const _0x552fa4 = _0x202e,
// _0x1cd81c = _0x4c31fc();
// while (!![]) {
// try {
// const _0xcda188 = -parseInt(_0x552fa4(0x8e)) / 0x1 * (parseInt(_0x552fa4(0x84)) / 0x2) + -parseInt(_0x552fa4(0x7d)) / 0x3 + parseInt(_0x552fa4(0x7f)) / 0x4 + -parseInt(_0x552fa4(0x86)) / 0x5 + parseInt(_0x552fa4(0x88)) / 0x6 * (parseInt(_0x552fa4(0x82)) / 0x7) + -parseInt(_0x552fa4(0x80)) / 0x8 + parseInt(_0x552fa4(0x8a)) / 0x9 * (parseInt(_0x552fa4(0x85)) / 0xa);
// if (_0xcda188 === _0x463010) break; else _0x1cd81c['push'](_0x1cd81c['shift']());
// } catch (_0x1d86df) {
// _0x1cd81c['push'](_0x1cd81c['shift']());
// }
// }
// }(_0x568a, 0xb25c4));
//
// function _0x568a() {
// const _0x292465 = ['differenceBetweenServerAndClientTime', '823318RXJXMw', '457340BzvYDX', '3527100qnMDjU', 'xgUserId', '6362418YdxbkN', 'getTime', '639OXEuzj', 'headers', 'bearer\x20', 'timestamp', '1HcmGrw', '3967845wgMCjN', 'log', '151716ARnHER', '9401504aZEgWQ', 'auth', '7SfPUZN'];
// _0x568a = function () {
// return _0x292465;
// };
// return _0x568a();
// }
//
//
// export function getHeaders(_0x586d90 = '') {
// const _0x489a38 = _0x202e,
// _0x4fc1a2 = getToken(),
// _0x37ba84 = getCurrentUser() || {},
// _0x1db761 = getUserInfo() || {},
// _0x4e0063 = _0x1db761['id'] || _0x37ba84[_0x489a38(0x87)],
// _0x5a5180 = new Date()[_0x489a38(0x89)]() + window[_0x489a38(0x83)],
// _0x297709 = _0x4fc1a2 + _0x4e0063 + _0x5a5180,
// _0xd71cea = { 'headers': { 'Authorization': _0x489a38(0x8c) + _0x4fc1a2 } };
// return getIsBei_Dian() && _0x4e0063 && (_0xd71cea[_0x489a38(0x8b)][_0x489a38(0x81)] = gg5xxxxx(_0x297709), _0xd71cea['headers'][_0x489a38(0x8d)] = _0x5a5180, isTest && console[_0x489a38(0x7e)]({
// })), _0xd71cea;
// }
// /**
// * 混淆代码
// * 2022年7月12日
// * 钟是志
// * */
export
function
getHeaders
(
url
=
''
)
{
const
token
=
getToken
();
console
.
log
(
url
,
token
);
const
currentInfo
=
getCurrentUser
()
||
{};
const
user
=
getUserInfo
()
||
{};
const
userId
=
user
.
id
||
currentInfo
.
xgUserId
;
const
timestamp
=
new
Date
().
getTime
()
+
window
.
differenceBetweenServerAndClientTime
;
const
timestamp
=
new
Date
().
getTime
()
+
user
.
differenceBetweenServerAndClientTime
;
const
secretString
=
token
+
userId
+
timestamp
;
if
(
!
token
||
token
===
'null'
){
return
{
...
...
@@ -92,7 +33,6 @@ export function getHeaders(url = '') {
md5S
:
gg5xxxxx
(
secretString
),
timestamp
,
userId
:
userId
,
differenceBetweenServerAndClientTime
:
window
.
differenceBetweenServerAndClientTime
,
},
);
}
...
...
zyd_public/utils/queryCurrent.js
浏览文件 @
507a2bf1
import
request
from
'@/webPublic/zyd_public/request/request'
;
import
{
getCurrentUser
,
getToken
}
from
'@/webPublic/one_stop_public/utils/token'
;
window
.
differenceBetweenServerAndClientTime
=
0
;
export
const
getTime
=
()
=>
{
const
config
=
window
.
specialImportantSystemConfig
||
{};
if
(
config
.
mockServer
)
{
...
...
@@ -13,21 +13,29 @@ export const getTime = () => {
)
.
then
(
t
=>
{
if
(
t
)
{
window
.
differenceBetweenServerAndClientTime
=
t
-
new
Date
().
getTime
();
// 服务器时间 与 客户端时间的差值
return
t
-
new
Date
().
getTime
();
// 服务器时间 与 客户端时间的差值;
}
else
{
return
0
;
}
return
true
;
});
}
else
{
return
new
Promise
((
resolve
)
=>
{
window
.
differenceBetweenServerAndClientTime
=
0
;
resolve
(
true
);
resolve
(
0
);
});
}
};
export
async
function
queryCurrent
()
{
let
t
=
await
getTime
();
//
let t = await getTime();
const
config
=
window
.
specialImportantSystemConfig
||
{};
let
token
=
getToken
();
let
userInfo
=
getCurrentUser
();
if
(
token
&&
userInfo
.
token
===
token
)
{
return
new
Promise
((
resolve
)
=>
{
resolve
(
userInfo
);
return
userInfo
;
});
}
if
(
config
.
mockServer
)
{
return
request
(
`
${
config
.
mockServer
}
/
${
config
.
gateWayUrl
.
zydxg
}
/UserApi/queryCurrent`
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论