Skip to content

Commit ebf30b7

Browse files
committed
Update sdk to 3.4.0
1 parent 0f2d263 commit ebf30b7

File tree

3 files changed

+22
-42
lines changed

3 files changed

+22
-42
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<description>基于 WxJava 和 Spring Boot 实现的微信公众号后端开发演示项目</description>
1919

2020
<properties>
21-
<weixin-java-mp.version>3.3.8.B</weixin-java-mp.version>
21+
<weixin-java-mp.version>3.4.0</weixin-java-mp.version>
2222

2323
<maven.compiler.source>1.8</maven.compiler.source>
2424
<maven.compiler.target>1.8</maven.compiler.target>

src/main/java/com/github/binarywang/demo/wx/mp/config/WxMpConfiguration.java

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.github.binarywang.demo.wx.mp.handler.*;
44
import com.google.common.collect.Maps;
5+
import lombok.AllArgsConstructor;
56
import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage;
67
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
78
import me.chanjar.weixin.mp.api.WxMpService;
@@ -23,42 +24,21 @@
2324
*
2425
* @author Binary Wang(https://github.com/binarywang)
2526
*/
27+
@AllArgsConstructor
2628
@Configuration
2729
@EnableConfigurationProperties(WxMpProperties.class)
2830
public class WxMpConfiguration {
29-
private LogHandler logHandler;
30-
private NullHandler nullHandler;
31-
private KfSessionHandler kfSessionHandler;
32-
private StoreCheckNotifyHandler storeCheckNotifyHandler;
33-
private LocationHandler locationHandler;
34-
private MenuHandler menuHandler;
35-
private MsgHandler msgHandler;
36-
private UnsubscribeHandler unsubscribeHandler;
37-
private SubscribeHandler subscribeHandler;
38-
private ScanHandler scanHandler;
39-
40-
private WxMpProperties properties;
41-
42-
private static Map<String, WxMpMessageRouter> routers = Maps.newHashMap();
43-
private static Map<String, WxMpService> mpServices = Maps.newHashMap();
44-
45-
@Autowired
46-
public WxMpConfiguration(LogHandler logHandler, NullHandler nullHandler, KfSessionHandler kfSessionHandler,
47-
StoreCheckNotifyHandler storeCheckNotifyHandler, LocationHandler locationHandler,
48-
MenuHandler menuHandler, MsgHandler msgHandler, UnsubscribeHandler unsubscribeHandler,
49-
SubscribeHandler subscribeHandler, ScanHandler scanHandler, WxMpProperties properties) {
50-
this.logHandler = logHandler;
51-
this.nullHandler = nullHandler;
52-
this.kfSessionHandler = kfSessionHandler;
53-
this.storeCheckNotifyHandler = storeCheckNotifyHandler;
54-
this.locationHandler = locationHandler;
55-
this.menuHandler = menuHandler;
56-
this.msgHandler = msgHandler;
57-
this.unsubscribeHandler = unsubscribeHandler;
58-
this.subscribeHandler = subscribeHandler;
59-
this.scanHandler = scanHandler;
60-
this.properties = properties;
61-
}
31+
private final LogHandler logHandler;
32+
private final NullHandler nullHandler;
33+
private final KfSessionHandler kfSessionHandler;
34+
private final StoreCheckNotifyHandler storeCheckNotifyHandler;
35+
private final LocationHandler locationHandler;
36+
private final MenuHandler menuHandler;
37+
private final MsgHandler msgHandler;
38+
private final UnsubscribeHandler unsubscribeHandler;
39+
private final SubscribeHandler subscribeHandler;
40+
private final ScanHandler scanHandler;
41+
private final WxMpProperties properties;
6242

6343
@Bean
6444
public WxMpService wxMpService() {

src/main/java/com/github/binarywang/demo/wx/mp/controller/WxMenuController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public WxMenuController(WxMpService wxService) {
4343
*/
4444
@PostMapping("/create")
4545
public String menuCreate(@PathVariable String appid, @RequestBody WxMenu menu) throws WxErrorException {
46-
return this.wxService.switchover1(appid).getMenuService().menuCreate(menu);
46+
return this.wxService.switchoverTo(appid).getMenuService().menuCreate(menu);
4747
}
4848

4949
@GetMapping("/create")
@@ -92,7 +92,7 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
9292
if (servletRequestAttributes != null) {
9393
HttpServletRequest request = servletRequestAttributes.getRequest();
9494
URL requestURL = new URL(request.getRequestURL().toString());
95-
String url = this.wxService.switchover1(appid).oauth2buildAuthorizationUrl(
95+
String url = this.wxService.switchoverTo(appid).oauth2buildAuthorizationUrl(
9696
String.format("%s://%s/wx/redirect/%s/greet", requestURL.getProtocol(), requestURL.getHost(), appid),
9797
WxConsts.OAuth2Scope.SNSAPI_USERINFO, null);
9898
button34.setUrl(url);
@@ -119,7 +119,7 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
119119
*/
120120
@PostMapping("/createByJson")
121121
public String menuCreate(@PathVariable String appid, @RequestBody String json) throws WxErrorException {
122-
return this.wxService.switchover1(appid).getMenuService().menuCreate(json);
122+
return this.wxService.switchoverTo(appid).getMenuService().menuCreate(json);
123123
}
124124

125125
/**
@@ -130,7 +130,7 @@ public String menuCreate(@PathVariable String appid, @RequestBody String json) t
130130
*/
131131
@GetMapping("/delete")
132132
public void menuDelete(@PathVariable String appid) throws WxErrorException {
133-
this.wxService.switchover1(appid).getMenuService().menuDelete();
133+
this.wxService.switchoverTo(appid).getMenuService().menuDelete();
134134
}
135135

136136
/**
@@ -143,7 +143,7 @@ public void menuDelete(@PathVariable String appid) throws WxErrorException {
143143
*/
144144
@GetMapping("/delete/{menuId}")
145145
public void menuDelete(@PathVariable String appid, @PathVariable String menuId) throws WxErrorException {
146-
this.wxService.switchover1(appid).getMenuService().menuDelete(menuId);
146+
this.wxService.switchoverTo(appid).getMenuService().menuDelete(menuId);
147147
}
148148

149149
/**
@@ -154,7 +154,7 @@ public void menuDelete(@PathVariable String appid, @PathVariable String menuId)
154154
*/
155155
@GetMapping("/get")
156156
public WxMpMenu menuGet(@PathVariable String appid) throws WxErrorException {
157-
return this.wxService.switchover1(appid).getMenuService().menuGet();
157+
return this.wxService.switchoverTo(appid).getMenuService().menuGet();
158158
}
159159

160160
/**
@@ -167,7 +167,7 @@ public WxMpMenu menuGet(@PathVariable String appid) throws WxErrorException {
167167
*/
168168
@GetMapping("/menuTryMatch/{userid}")
169169
public WxMenu menuTryMatch(@PathVariable String appid, @PathVariable String userid) throws WxErrorException {
170-
return this.wxService.switchover1(appid).getMenuService().menuTryMatch(userid);
170+
return this.wxService.switchoverTo(appid).getMenuService().menuTryMatch(userid);
171171
}
172172

173173
/**
@@ -187,6 +187,6 @@ public WxMenu menuTryMatch(@PathVariable String appid, @PathVariable String user
187187
*/
188188
@GetMapping("/getSelfMenuInfo")
189189
public WxMpGetSelfMenuInfoResult getSelfMenuInfo(@PathVariable String appid) throws WxErrorException {
190-
return this.wxService.switchover1(appid).getMenuService().getSelfMenuInfo();
190+
return this.wxService.switchoverTo(appid).getMenuService().getSelfMenuInfo();
191191
}
192192
}

0 commit comments

Comments
 (0)