From 1231da091232a6507a0a4f113dcb1ca27ed45284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?cxxxxxxx=E8=AF=A6?= <286460656@qq.com> Date: Sun, 10 Sep 2023 15:34:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=96=E5=BA=97token=E5=88=B7=E6=96=B0?= =?UTF-8?q?=EF=BC=8C=E6=B5=8B=E8=AF=95=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- .../com/ms/api/task/RefreshTokenTimerTaskService.java | 11 +++++++---- ms-dal/src/main/resources/mapper/ShopMapper.xml | 4 ++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5c4bfd33..80825b32 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ curl --location --request POST 'localhost:8080/base/cloud/spi' \ --data-raw '{ "appId":"7264840234423027259", "authId":"4463798", -"method":"testTime", +"method":"RefreshTokenTimer", "data":"{\"moveShopSettingId\":6}" }' diff --git a/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java b/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java index f50d0b2a..285607b4 100644 --- a/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java +++ b/ms-biz/src/main/java/com/ms/api/task/RefreshTokenTimerTaskService.java @@ -115,16 +115,19 @@ public class RefreshTokenTimerTaskService extends TaskBaseService { if (ObjectUtil.isEmpty(newAccessToken)) { E.throwMSException("获取accessToken失败"); } - if (ObjectUtil.isEmpty(newAccessToken)) { + if (newAccessToken.equals(oldAccessToken)) { + log.info("accessToken无需更新"); Map result = new HashMap(); result.put("msg", "accessToken无需更新"); - return R.ok(Ret.success()); + return true; } shop.setExpiresIn(newExpires.toString()); shop.setRefreshToken(SecurityTool.encodeByAES(newRefreshToken)); shop.setAccessToken(SecurityTool.encodeByAES(newAccessToken)); - shop.setGmtExpire(new Date(TimeTool.getDateTimeBySeconds(new Long(newExpires).intValue()))); - shop.setGmtModified(new Date(TimeTool.getDateTimeBySeconds(0))); + log.info("oldAccessToken:"+oldAccessToken); + log.info("newAccessToken"+newAccessToken); + shop.setGmtExpire(DateUtil.parseDateTime(TimeTool.getDateTimeBySeconds(new Long(newExpires).intValue()))); + shop.setGmtModified(DateUtil.parseDateTime(TimeTool.getDateTimeBySeconds(0))); shopService.updateByPrimaryKey(shop); } return true; diff --git a/ms-dal/src/main/resources/mapper/ShopMapper.xml b/ms-dal/src/main/resources/mapper/ShopMapper.xml index 1960f5dd..a8d9bd45 100644 --- a/ms-dal/src/main/resources/mapper/ShopMapper.xml +++ b/ms-dal/src/main/resources/mapper/ShopMapper.xml @@ -151,10 +151,10 @@ gmt_modified = #{gmtModified,jdbcType=TIMESTAMP} where shop_id = #{shopId,jdbcType=BIGINT} - select from shop - where gmt_expire < #{gmtExpireStart,jdbcType=TIMESTAMP} and gmt_expire > #{gmtExpireEnd,jdbcType=TIMESTAMP} + where gmt_expire < #{gmtExpireStart} and gmt_expire > #{gmtExpireEnd}