系统的模块间跳转登出问题
今天新落地了一个城市,但是出现了一个问题,我们的项目是嵌在一个大系统里面的,这个大系统里有很多的模块,每个模块都是一个项目。在由我们的数据中心跳转到其他模块时,比如客源模块。跳转过去后就登出。直接显示了登录页面。给大家看下图
一、跳转失败的原因
刚开始我以为是域名跳转的问题。后来发现并不是。
拿我自己本地后端连前端是可以正常跳转的,但测试环境的后端连本地的前端,就不能跳转了。
后来想截取到跳转过去的链接串(带有参数的那种),对比下两种有什么区别
于是开始找链接串怎么截取。
1、F12 发现有访问user/goToAplus这个方法,于是在项目里全局搜索到这个方法。然后一步步打断点找到了链接串
2、找到了gotoAplus方法
3、最后从href这里找到了拼接的链接串
http://shagency-test.centaline.com.cn/property/war-zone?urlParams={"userKeyId":"533b3edd-f19c-c2f8-b60c-08d9da565771","userNo":"2019070197","departmentKeyId":"99999999-9999-9999-9999-999999999999","checkTime":1645499411047,"secretKey":"12990df1c50f03000d60e91e58ab3b84","sourceType":1,"navUrl":"property/war-zone","navName":"房源管理"}
http://shagency-test.centaline.com.cn/customer/all-customer?urlParams={"userKeyId":"533b3edd-f19c-c2f8-b60c-08d9da565771","userNo":"2019070197","departmentKeyId":"99999999-9999-9999-9999-999999999999","checkTime":1645499151944,"secretKey":"34328e2bf36c2922d97adc8293d66737","sourceType":1,"navUrl":"customer/all-customer","navName":"客源管理"}
4、于是对比了它俩之间的不同,发现除了方法名和checkTime之外都一样
然后不知道该怎么办,就随意把checkTime时间戳转换了一下,这一转换不得了了!
我明明是刚刚截出来串,怎么转换后的时间是2022-02-22 11:10:49呢?现在可是11:17分啊。
5、于是忽然想到可能是服务器的时间不对。去linux上一看,果然时间提前了5分钟…
怪不得连我本地的后端就可以正常跳转,而连测试环境的就不可以!
6、修改完时间果然可以正常跳转了。
二、彻底解决时间问题
经公司大佬指点发现Centos中可以自动校验时间
具体命令我也贴到这里啦!我用了完全好用!
# date -R
# timedatectl set-timezone Asia/Shanghai
# yum -y install ntp
# ntpdate ntp1.aliyun.com
这里是执行的流程与结果,可以参考一下。
[root@TJTV-ODC-Docker01 ~]# date -R
Tue, 22 Feb 2022 14:00:18 +0800
[root@TJTV-ODC-Docker01 ~]# timedatectl set-timezone Asia/Shanghai
[root@TJTV-ODC-Docker01 ~]# yum -y install ntp
Loaded plugins: fastestmirror
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/3): docker-ce-stable/x86_64/primary_db | 70 kB 00:00:00
(2/3): extras/7/x86_64/primary_db | 243 kB 00:00:00
(3/3): updates/7/x86_64/primary_db | 13 MB 00:00:05
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package ntp.x86_64 0:4.2.6p5-29.el7.centos.2 will be installed
--> Processing Dependency: ntpdate = 4.2.6p5-29.el7.centos.2 for package: ntp-4.2.6p5-29.el7.centos.2.x86_64
--> Processing Dependency: libopts.so.25()(64bit) for package: ntp-4.2.6p5-29.el7.centos.2.x86_64
--> Running transaction check
---> Package autogen-libopts.x86_64 0:5.18-5.el7 will be installed
---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
============================================================================================================================================================
Package Arch Version Repository Size
============================================================================================================================================================
Installing:
ntp x86_64 4.2.6p5-29.el7.centos.2 base 549 k
Installing for dependencies:
autogen-libopts x86_64 5.18-5.el7 base 66 k
ntpdate x86_64 4.2.6p5-29.el7.centos.2 base 87 k
Transaction Summary
============================================================================================================================================================
Install 1 Package (+2 Dependent packages)
Total download size: 701 k
Installed size: 1.6 M
Downloading packages:
(1/3): autogen-libopts-5.18-5.el7.x86_64.rpm | 66 kB 00:00:00
(2/3): ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm | 87 kB 00:00:02
ntp-4.2.6p5-29.el7.centos.2.x8 FAILED
http://mirror.lzu.edu.cn/centos/7.9.2009/os/x86_64/Packages/ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm: [Errno 14] curl#7 - "Failed to connect to 2001:da8:c000::160: Network is unreachable"
Trying other mirror.
(3/3): ntp-4.2.6p5-29.el7.centos.2.x86_64.rpm | 549 kB 00:00:01
------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 42 kB/s | 701 kB 00:00:16
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : autogen-libopts-5.18-5.el7.x86_64 1/3
Installing : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 2/3
Installing : ntp-4.2.6p5-29.el7.centos.2.x86_64 3/3
Verifying : ntpdate-4.2.6p5-29.el7.centos.2.x86_64 1/3
Verifying : ntp-4.2.6p5-29.el7.centos.2.x86_64 2/3
Verifying : autogen-libopts-5.18-5.el7.x86_64 3/3
Installed:
ntp.x86_64 0:4.2.6p5-29.el7.centos.2
Dependency Installed:
autogen-libopts.x86_64 0:5.18-5.el7 ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2
Complete!
[root@TJTV-ODC-Docker01 ~]# ntpdate ntp1.aliyun.com
22 Feb 14:01:36 ntpdate[5933]: step time server 120.25.115.20 offset 7.942989 sec
[root@TJTV-ODC-Docker01 ~]#
[root@TJTV-ODC-Docker01 ~]#
[root@TJTV-ODC-Docker01 ~]# date
Tue Feb 22 14:02:40 CST 2022