if (token) { wx.checkSession({ success: function (){ console.log( 'hasSession' ) self.getHomeData() }, fail: function (res){ console.log(res) console.log( 'noSession' ) self.login(); } }) } else { console.log( 'noToken' ) self.login(); } |
Object {errMsg: "checkSession:fail session time out, need relogin"}errMsg: "checkSession:fail session time out, need relogin"__proto__: Object
index.js [sm]:63 noSession
每次都是走fail,请问是什么原因
用户登录应该是有个过期时间啊,在很短的时间内我checkSession都是fail
走 fail 说明用户登录失效了,需要 relogin。参看文档 https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-login.html#wxchecksessionobject