| @@ -8,6 +8,7 @@ import com.iformall.mapper.WxComponentVerifyTicketMapper; | |||||
| import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder; | ||||
| import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; | import me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage; | ||||
| import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; | import me.chanjar.weixin.open.bean.WxOpenAuthorizerAccessToken; | ||||
| import me.chanjar.weixin.open.bean.WxOpenComponentAccessToken; | |||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| @@ -107,15 +108,15 @@ public class FmOpenInRedisDBConfigStorage extends WxOpenInMemoryConfigStorage { | |||||
| jedis.expire(this.componentAccessTokenKey, 0); | jedis.expire(this.componentAccessTokenKey, 0); | ||||
| } | } | ||||
| } | } | ||||
| public void updateComponentAccessTokent(String componentAccessToken, int expiresInSeconds) { | |||||
| @Override | |||||
| public void updateComponentAccessToken(WxOpenComponentAccessToken componentAccessToken) { | |||||
| try (Jedis jedis = this.jedisPool.getResource()) { | try (Jedis jedis = this.jedisPool.getResource()) { | ||||
| jedis.setex(this.componentAccessTokenKey, expiresInSeconds - 200, componentAccessToken); | |||||
| jedis.setex(this.componentAccessTokenKey, componentAccessToken.getExpiresIn() - 200, componentAccessToken.getComponentAccessToken()); | |||||
| WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); | WxComponentVerifyTicket ticket = new WxComponentVerifyTicket(); | ||||
| ticket.setComponentAppid(getComponentAppId()); | ticket.setComponentAppid(getComponentAppId()); | ||||
| ticket.setAccessToken(componentAccessToken); | |||||
| ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (expiresInSeconds * 1000)))); | |||||
| ticket.setAccessToken(componentAccessToken.getComponentAccessToken()); | |||||
| ticket.setAccessTokenExpire(new Date(Long.valueOf(System.currentTimeMillis() + (componentAccessToken.getExpiresIn() * 1000)))); | |||||
| int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); | int num = wxComponentVerifyTicketMapper.updateAccessToken(ticket); | ||||
| logger.info("updateComponentVerifyTicketAccessToken rows: " + num); | logger.info("updateComponentVerifyTicketAccessToken rows: " + num); | ||||
| } | } | ||||