From 288b1f143606edc7d52b013a75d67a60368a3153 Mon Sep 17 00:00:00 2001 From: vipcgh <84012482@qq.com> Date: Wed, 16 Mar 2016 15:44:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1token=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E5=92=8CexpireTime=E6=97=B6=E9=97=B4=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E5=AE=9A=E4=B8=80=E8=87=B4=EF=BC=8C=E6=94=B6=E5=88=B040001?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 微信token过期和expireTime时间不一定一致,收到40001后,需要重新获取token --- lib/api_common.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/api_common.js b/lib/api_common.js index 1c81812..57de5a6 100644 --- a/lib/api_common.js +++ b/lib/api_common.js @@ -191,6 +191,11 @@ API.prototype.preRequest = function (method, args, retryed) { if (err) { return callback(err); } + //重发时清除token,重新获取 + if(retryed){ + token = null; + } + var accessToken; // 有token并且token有效直接调用 if (token && (accessToken = AccessToken(token.accessToken, token.expireTime)).isValid()) { From 41d0646ca354eed7ee3c5dd504e63b3145eadb5b Mon Sep 17 00:00:00 2001 From: vipcgh <84012482@qq.com> Date: Mon, 21 Mar 2016 14:00:22 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=8C=81=E7=BB=AD=E6=94=B6=E5=88=B040001=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=BD=93=E6=94=B6=E5=88=B040001=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E9=87=8D=E6=96=B0=E8=8E=B7=E5=8F=96token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重发时清除token,重新获取 --- lib/api_common.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/api_common.js b/lib/api_common.js index 57de5a6..43846f4 100644 --- a/lib/api_common.js +++ b/lib/api_common.js @@ -192,8 +192,8 @@ API.prototype.preRequest = function (method, args, retryed) { return callback(err); } //重发时清除token,重新获取 - if(retryed){ - token = null; + if (retryed) { + token = null; } var accessToken;