From ec625b66a629b00add26bb15b84d9d7bf127bd16 Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Thu, 26 Dec 2019 11:48:33 +0800 Subject: [PATCH] =?UTF-8?q?[WxJava][=E9=99=8D=E7=BA=A7]:=E9=99=8D=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E3.3.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mallinkAdmin/pom.xml | 4 ++-- .../main/java/com/iformall/config/WechatMpConfig.java | 7 ++++--- mallinkBApi/src/main/resources/application-test.yml | 2 +- mallinkCallback/pom.xml | 4 ++-- .../service/wechat/FmOpenInRedisDBConfigStorage.java | 10 +++++----- .../src/main/java/com/iformall/utils/MaUtil.java | 4 ++-- mallinkSysAdmin/pom.xml | 4 ++-- pom.xml | 10 +++++----- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/mallinkAdmin/pom.xml b/mallinkAdmin/pom.xml index 781777ca8..4c0dfa3ed 100644 --- a/mallinkAdmin/pom.xml +++ b/mallinkAdmin/pom.xml @@ -13,8 +13,8 @@ mallinkAdmin - 3.6.0 - 3.6.0 + 3.3.0 + 3.3.0 diff --git a/mallinkAdmin/src/main/java/com/iformall/config/WechatMpConfig.java b/mallinkAdmin/src/main/java/com/iformall/config/WechatMpConfig.java index 4433386c9..4dff6c762 100644 --- a/mallinkAdmin/src/main/java/com/iformall/config/WechatMpConfig.java +++ b/mallinkAdmin/src/main/java/com/iformall/config/WechatMpConfig.java @@ -1,9 +1,9 @@ package com.iformall.config; +import me.chanjar.weixin.mp.api.WxMpConfigStorage; +import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; import me.chanjar.weixin.mp.api.WxMpService; import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; -import me.chanjar.weixin.mp.config.WxMpConfigStorage; -import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.stereotype.Component; @@ -23,8 +23,9 @@ public class WechatMpConfig { return wxMpService; } + @Bean public WxMpConfigStorage wxConfigProvider(){ - WxMpDefaultConfigImpl wxConfigProvider = new WxMpDefaultConfigImpl(); + WxMpInMemoryConfigStorage wxConfigProvider = new WxMpInMemoryConfigStorage(); wxConfigProvider.setAppId(wechatWebProperties.getAppId()); wxConfigProvider.setSecret(wechatWebProperties.getSecret()); return wxConfigProvider; diff --git a/mallinkBApi/src/main/resources/application-test.yml b/mallinkBApi/src/main/resources/application-test.yml index 1602fa193..10d1ff6ef 100644 --- a/mallinkBApi/src/main/resources/application-test.yml +++ b/mallinkBApi/src/main/resources/application-test.yml @@ -91,7 +91,7 @@ fm: exception: true exception_emails: houtaikaifa@iformall.com deploy: 2 - open: true + open: false upload_dir: /home/ec2-user/server/uploads/ pos: diff --git a/mallinkCallback/pom.xml b/mallinkCallback/pom.xml index 1feccd436..2a4dba723 100644 --- a/mallinkCallback/pom.xml +++ b/mallinkCallback/pom.xml @@ -13,8 +13,8 @@ mallinkCallback - 3.6.0 - 3.6.0 + 3.3.0 + 3.3.0 diff --git a/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java index 905604d6b..eb5228cc1 100644 --- a/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java +++ b/mallinkService/src/main/java/com/iformall/service/wechat/FmOpenInRedisDBConfigStorage.java @@ -8,7 +8,6 @@ import com.iformall.mapper.WxComponentVerifyTicketMapper; import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; -import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -108,15 +107,16 @@ public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { jedis.expire(this.componentAccessTokenKey, 0); } } + @Override - public void updateComponentAccessToken(WxOpenComponentAccessToken componentAccessToken) { + public void updateComponentAccessTokent(String componentAccessToken, int expiresInSeconds) { try (Jedis jedis = this.jedisPool.getResource()) { - jedis.setex(this.componentAccessTokenKey, componentAccessToken.getExpiresIn() - 200, componentAccessToken.getComponentAccessToken()); + jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); ticket.setComponentAppid(getComponentAppId()); - ticket.setAccessToken(componentAccessToken.getComponentAccessToken()); - ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (componentAccessToken.getExpiresIn() * 1000)))); + ticket.setAccessToken(componentAccessToken); + ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (expiresInSeconds * 1000)))); int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); logger.info("updateComponentVerifyTicketAccessToken rows: " + num); } diff --git a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java index 53e7fd1a2..83e813084 100644 --- a/mallinkService/src/main/java/com/iformall/utils/MaUtil.java +++ b/mallinkService/src/main/java/com/iformall/utils/MaUtil.java @@ -2,7 +2,7 @@ package com.iformall.utils; import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; -import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import cn.binarywang.wx.miniapp.config.WxMaInMemoryConfig; import com.iformall.common.FmHttpClientBuilder; import com.iformall.domain.po.WxAppinfo; import org.apache.commons.lang3.StringUtils; @@ -10,7 +10,7 @@ import org.apache.commons.lang3.StringUtils; public class MaUtil { static public WxMaService getWeappService(WxAppinfo appinfo) { - WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + WxMaInMemoryConfig config = new WxMaInMemoryConfig(); config.setAppid(appinfo.getAppId()); config.setSecret(appinfo.getSecret()); config.setToken(appinfo.getToken()); diff --git a/mallinkSysAdmin/pom.xml b/mallinkSysAdmin/pom.xml index f99b954fb..e006b484e 100644 --- a/mallinkSysAdmin/pom.xml +++ b/mallinkSysAdmin/pom.xml @@ -13,8 +13,8 @@ mallinkSysAdmin - 3.6.0 - 3.6.0 + 3.3.0 + 3.3.0 diff --git a/pom.xml b/pom.xml index b8b442dcb..efd02d83b 100644 --- a/pom.xml +++ b/pom.xml @@ -32,11 +32,11 @@ - 3.6.0 - 3.6.0 - 3.6.0 - 3.6.0 - 3.6.0 + 3.3.0 + 3.3.0 + 3.3.0 + 3.3.0 + 3.3.0 2.3.0