|
@@ -2,9 +2,11 @@ package com.izouma.walkchina.configuration;
|
|
|
|
|
|
|
|
import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
|
import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
|
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
|
import cn.binarywang.wx.miniapp.util.json.WxMaGsonBuilder;
|
|
|
|
|
+import lombok.Data;
|
|
|
import me.chanjar.weixin.common.bean.WxAccessToken;
|
|
import me.chanjar.weixin.common.bean.WxAccessToken;
|
|
|
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
|
|
import me.chanjar.weixin.common.util.http.apache.ApacheHttpClientBuilder;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
+import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
@@ -14,18 +16,20 @@ import java.util.Map;
|
|
|
import java.util.concurrent.locks.Lock;
|
|
import java.util.concurrent.locks.Lock;
|
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
import java.util.concurrent.locks.ReentrantLock;
|
|
|
|
|
|
|
|
|
|
+@Data
|
|
|
@Component
|
|
@Component
|
|
|
-public class WxMaRedisConfig implements WxMaConfig {
|
|
|
|
|
|
|
+@ConfigurationProperties(prefix = "wx.miniapp")
|
|
|
|
|
+public class MiniAppConfig implements WxMaConfig {
|
|
|
private final String REDIS_KEY = "miniAppAccessToken";
|
|
private final String REDIS_KEY = "miniAppAccessToken";
|
|
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private RedisTemplate redisTemplate;
|
|
private RedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
- private volatile String msgDataFormat;
|
|
|
|
|
- private volatile String appid;
|
|
|
|
|
- private volatile String secret;
|
|
|
|
|
- private volatile String token;
|
|
|
|
|
- private volatile String aesKey;
|
|
|
|
|
|
|
+ private String appId;
|
|
|
|
|
+ private String appSecret;
|
|
|
|
|
+ private String msgToken;
|
|
|
|
|
+ private String msgAesKey;
|
|
|
|
|
+ private String msgFormat;
|
|
|
|
|
|
|
|
private volatile String httpProxyHost;
|
|
private volatile String httpProxyHost;
|
|
|
private volatile int httpProxyPort;
|
|
private volatile int httpProxyPort;
|
|
@@ -158,20 +162,20 @@ public class WxMaRedisConfig implements WxMaConfig {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getSecret() {
|
|
public String getSecret() {
|
|
|
- return this.secret;
|
|
|
|
|
|
|
+ return this.appSecret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void setSecret(String secret) {
|
|
public void setSecret(String secret) {
|
|
|
- this.secret = secret;
|
|
|
|
|
|
|
+ this.appSecret = secret;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getToken() {
|
|
public String getToken() {
|
|
|
- return this.token;
|
|
|
|
|
|
|
+ return this.msgToken;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void setToken(String token) {
|
|
public void setToken(String token) {
|
|
|
- this.token = token;
|
|
|
|
|
|
|
+ this.msgToken = token;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -186,20 +190,20 @@ public class WxMaRedisConfig implements WxMaConfig {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getAesKey() {
|
|
public String getAesKey() {
|
|
|
- return this.aesKey;
|
|
|
|
|
|
|
+ return this.msgAesKey;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void setAesKey(String aesKey) {
|
|
public void setAesKey(String aesKey) {
|
|
|
- this.aesKey = aesKey;
|
|
|
|
|
|
|
+ this.msgAesKey = aesKey;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getMsgDataFormat() {
|
|
public String getMsgDataFormat() {
|
|
|
- return this.msgDataFormat;
|
|
|
|
|
|
|
+ return this.msgFormat;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void setMsgDataFormat(String msgDataFormat) {
|
|
public void setMsgDataFormat(String msgDataFormat) {
|
|
|
- this.msgDataFormat = msgDataFormat;
|
|
|
|
|
|
|
+ this.msgFormat = msgDataFormat;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -259,10 +263,10 @@ public class WxMaRedisConfig implements WxMaConfig {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public String getAppid() {
|
|
public String getAppid() {
|
|
|
- return appid;
|
|
|
|
|
|
|
+ return appId;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public void setAppid(String appid) {
|
|
public void setAppid(String appid) {
|
|
|
- this.appid = appid;
|
|
|
|
|
|
|
+ this.appId = appid;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|