Commit 20563565 by liang ce

token 判断问题

parent 8551d7d0
...@@ -15,7 +15,7 @@ const $http = (url, data, type, loadingType) => { ...@@ -15,7 +15,7 @@ const $http = (url, data, type, loadingType) => {
let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data
// 时间戳未过期 // 时间戳未过期
// if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime < hasToken.expires_in * 1000)){ // if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime < hasToken.expires_in * 1000)){
if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime)< 1 * 1000){ if(!!hasToken && ((new Date()).getTime() - hasToken.loginTime)< (hasToken.expires_in-300) * 1000){
data.orgId = dd.corpId; data.orgId = dd.corpId;
let sendData = ''; let sendData = '';
for(let key in data){ for(let key in data){
......
const login = () => { const login = () => {
const app = getApp() const app = getApp()
let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data let mingUserId = dd.getStorageSync({ key: 'mingUserId' }).data
// 有token // 有token
if((dd.getStorageSync({ key: 'token' }).data && dd.getStorageSync({ key: 'token' }).data.access_token)) { if(dd.getStorageSync({ key: 'token' }).data && dd.getStorageSync({ key: 'token' }).data.access_token) {
let hasToken = dd.getStorageSync({ key: 'token' }).data; // token let hasToken = dd.getStorageSync({ key: 'token' }).data; // token
let expires_in = hasToken.expires_in || ''; // 过期时效 let expires_in = hasToken.expires_in || ''; // 过期时效
let loginTime = hasToken.expires_in || ''; // 用户登陆时间 let loginTime = hasToken.expires_in || ''; // 用户登陆时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment