| @@ -13,8 +13,8 @@ | |||||
| <artifactId>mallinkAdmin</artifactId> | <artifactId>mallinkAdmin</artifactId> | ||||
| <properties> | <properties> | ||||
| <weixin-java-mp.version>3.3.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.3.0</weixin-java-open.version> | |||||
| <weixin-java-mp.version>3.6.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.6.0</weixin-java-open.version> | |||||
| </properties> | </properties> | ||||
| <dependencies> | <dependencies> | ||||
| @@ -1,9 +1,9 @@ | |||||
| package com.iformall.config; | 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.WxMpService; | ||||
| import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | 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.beans.factory.annotation.Autowired; | ||||
| import org.springframework.context.annotation.Bean; | import org.springframework.context.annotation.Bean; | ||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||
| @@ -23,9 +23,8 @@ public class WechatMpConfig { | |||||
| return wxMpService; | return wxMpService; | ||||
| } | } | ||||
| @Bean | |||||
| public WxMpConfigStorage wxConfigProvider(){ | public WxMpConfigStorage wxConfigProvider(){ | ||||
| WxMpInMemoryConfigStorage wxConfigProvider = new WxMpInMemoryConfigStorage(); | |||||
| WxMpDefaultConfigImpl wxConfigProvider = new WxMpDefaultConfigImpl(); | |||||
| wxConfigProvider.setAppId(wechatWebProperties.getAppId()); | wxConfigProvider.setAppId(wechatWebProperties.getAppId()); | ||||
| wxConfigProvider.setSecret(wechatWebProperties.getSecret()); | wxConfigProvider.setSecret(wechatWebProperties.getSecret()); | ||||
| return wxConfigProvider; | return wxConfigProvider; | ||||
| @@ -13,8 +13,8 @@ | |||||
| <artifactId>mallinkCallback</artifactId> | <artifactId>mallinkCallback</artifactId> | ||||
| <properties> | <properties> | ||||
| <weixin-java-mp.version>3.3.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.3.0</weixin-java-open.version> | |||||
| <weixin-java-mp.version>3.6.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.6.0</weixin-java-open.version> | |||||
| </properties> | </properties> | ||||
| <dependencies> | <dependencies> | ||||
| @@ -1,33 +0,0 @@ | |||||
| 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 org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Bean; | |||||
| import org.springframework.stereotype.Component; | |||||
| @Component | |||||
| public class WechatMpConfig { | |||||
| @Autowired | |||||
| private WechatWebProperties wechatWebProperties; | |||||
| @Bean | |||||
| public WxMpService wxMpService() { | |||||
| //创建WxMpService实例并设置appid和sectret | |||||
| WxMpService wxMpService = new WxMpServiceImpl(); | |||||
| //这里的设置方式是跟着这个sdk的文档写的 | |||||
| wxMpService.setWxMpConfigStorage(wxConfigProvider()); | |||||
| return wxMpService; | |||||
| } | |||||
| @Bean | |||||
| public WxMpConfigStorage wxConfigProvider(){ | |||||
| WxMpInMemoryConfigStorage wxConfigProvider = new WxMpInMemoryConfigStorage(); | |||||
| wxConfigProvider.setAppId(wechatWebProperties.getAppId()); | |||||
| wxConfigProvider.setSecret(wechatWebProperties.getSecret()); | |||||
| return wxConfigProvider; | |||||
| } | |||||
| } | |||||
| @@ -1,59 +0,0 @@ | |||||
| package com.iformall.config; | |||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||||
| import org.springframework.stereotype.Component; | |||||
| /** | |||||
| * Stormeye | |||||
| */ | |||||
| @Component | |||||
| @ConfigurationProperties(prefix = "wechat.web") | |||||
| public class WechatWebProperties { | |||||
| /** | |||||
| * 设置微信第三方平台-微信登录的web应用appid | |||||
| */ | |||||
| private String appId; | |||||
| /** | |||||
| * 设置微信第三方平台-微信登录的web应用app secret | |||||
| */ | |||||
| private String secret; | |||||
| /** | |||||
| * 网页URL | |||||
| * @return | |||||
| */ | |||||
| private String url; | |||||
| public String getAppId() { | |||||
| return appId; | |||||
| } | |||||
| public void setAppId(String appId) { | |||||
| this.appId = appId; | |||||
| } | |||||
| public String getSecret() { | |||||
| return secret; | |||||
| } | |||||
| public void setSecret(String secret) { | |||||
| this.secret = secret; | |||||
| } | |||||
| public String getUrl() { | |||||
| return url; | |||||
| } | |||||
| public void setUrl(String url) { | |||||
| this.url = url; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringBuilder.reflectionToString(this, | |||||
| ToStringStyle.MULTI_LINE_STYLE); | |||||
| } | |||||
| } | |||||
| @@ -117,6 +117,5 @@ fm: | |||||
| logging: | logging: | ||||
| level: | level: | ||||
| tk.mybatis: debug | |||||
| com.iformall: debug | com.iformall: debug | ||||
| path: ./logs/admin | path: ./logs/admin | ||||
| @@ -13,8 +13,8 @@ | |||||
| <artifactId>mallinkSysAdmin</artifactId> | <artifactId>mallinkSysAdmin</artifactId> | ||||
| <properties> | <properties> | ||||
| <weixin-java-mp.version>3.3.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.3.0</weixin-java-open.version> | |||||
| <weixin-java-mp.version>3.6.0</weixin-java-mp.version> | |||||
| <weixin-java-open.version>3.6.0</weixin-java-open.version> | |||||
| </properties> | </properties> | ||||
| <dependencies> | <dependencies> | ||||
| @@ -1,33 +0,0 @@ | |||||
| 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 org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.context.annotation.Bean; | |||||
| import org.springframework.stereotype.Component; | |||||
| @Component | |||||
| public class WechatMpConfig { | |||||
| @Autowired | |||||
| private WechatWebProperties wechatWebProperties; | |||||
| @Bean | |||||
| public WxMpService wxMpService() { | |||||
| //创建WxMpService实例并设置appid和sectret | |||||
| WxMpService wxMpService = new WxMpServiceImpl(); | |||||
| //这里的设置方式是跟着这个sdk的文档写的 | |||||
| wxMpService.setWxMpConfigStorage(wxConfigProvider()); | |||||
| return wxMpService; | |||||
| } | |||||
| @Bean | |||||
| public WxMpConfigStorage wxConfigProvider(){ | |||||
| WxMpInMemoryConfigStorage wxConfigProvider = new WxMpInMemoryConfigStorage(); | |||||
| wxConfigProvider.setAppId(wechatWebProperties.getAppId()); | |||||
| wxConfigProvider.setSecret(wechatWebProperties.getSecret()); | |||||
| return wxConfigProvider; | |||||
| } | |||||
| } | |||||
| @@ -1,59 +0,0 @@ | |||||
| package com.iformall.config; | |||||
| import org.apache.commons.lang3.builder.ToStringBuilder; | |||||
| import org.apache.commons.lang3.builder.ToStringStyle; | |||||
| import org.springframework.boot.context.properties.ConfigurationProperties; | |||||
| import org.springframework.stereotype.Component; | |||||
| /** | |||||
| * Stormeye | |||||
| */ | |||||
| @Component | |||||
| @ConfigurationProperties(prefix = "wechat.web") | |||||
| public class WechatWebProperties { | |||||
| /** | |||||
| * 设置微信第三方平台-微信登录的web应用appid | |||||
| */ | |||||
| private String appId; | |||||
| /** | |||||
| * 设置微信第三方平台-微信登录的web应用app secret | |||||
| */ | |||||
| private String secret; | |||||
| /** | |||||
| * 网页URL | |||||
| * @return | |||||
| */ | |||||
| private String url; | |||||
| public String getAppId() { | |||||
| return appId; | |||||
| } | |||||
| public void setAppId(String appId) { | |||||
| this.appId = appId; | |||||
| } | |||||
| public String getSecret() { | |||||
| return secret; | |||||
| } | |||||
| public void setSecret(String secret) { | |||||
| this.secret = secret; | |||||
| } | |||||
| public String getUrl() { | |||||
| return url; | |||||
| } | |||||
| public void setUrl(String url) { | |||||
| this.url = url; | |||||
| } | |||||
| @Override | |||||
| public String toString() { | |||||
| return ToStringBuilder.reflectionToString(this, | |||||
| ToStringStyle.MULTI_LINE_STYLE); | |||||
| } | |||||
| } | |||||