Skip to content

Commit 9d2923e

Browse files
committed
完善Demo,保证其中一个公众号可以正常使用,close binarywang#7
1 parent 62988c1 commit 9d2923e

6 files changed

Lines changed: 150 additions & 12 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.binarywang.demo.spring.handler.gzh1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
5+
import org.springframework.context.annotation.Scope;
6+
import org.springframework.stereotype.Component;
7+
8+
import com.github.binarywang.demo.spring.config.WxConfig;
9+
import com.github.binarywang.demo.spring.config.WxGzh1Config;
10+
import com.github.binarywang.demo.spring.handler.LocationHandler;
11+
12+
@Component
13+
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14+
public class Gzh1LocationHandler extends LocationHandler {
15+
@Autowired
16+
private WxGzh1Config wxConfig;
17+
18+
@Override
19+
protected WxConfig getWxConfig() {
20+
return this.wxConfig;
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.binarywang.demo.spring.handler.gzh1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
5+
import org.springframework.context.annotation.Scope;
6+
import org.springframework.stereotype.Component;
7+
8+
import com.github.binarywang.demo.spring.config.WxConfig;
9+
import com.github.binarywang.demo.spring.config.WxGzh1Config;
10+
import com.github.binarywang.demo.spring.handler.MenuHandler;
11+
12+
@Component
13+
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14+
public class Gzh1MenuHadler extends MenuHandler {
15+
@Autowired
16+
private WxGzh1Config wxConfig;
17+
18+
@Override
19+
protected WxConfig getWxConfig() {
20+
return this.wxConfig;
21+
}
22+
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.binarywang.demo.spring.handler.gzh1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
5+
import org.springframework.context.annotation.Scope;
6+
import org.springframework.stereotype.Component;
7+
8+
import com.github.binarywang.demo.spring.config.WxConfig;
9+
import com.github.binarywang.demo.spring.config.WxGzh1Config;
10+
import com.github.binarywang.demo.spring.handler.MsgHandler;
11+
12+
@Component
13+
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14+
public class Gzh1MsgHadler extends MsgHandler {
15+
@Autowired
16+
private WxGzh1Config wxConfig;
17+
18+
@Override
19+
protected WxConfig getWxConfig() {
20+
return this.wxConfig;
21+
}
22+
23+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.github.binarywang.demo.spring.handler.gzh1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
5+
import org.springframework.context.annotation.Scope;
6+
import org.springframework.stereotype.Component;
7+
8+
import com.github.binarywang.demo.spring.config.WxConfig;
9+
import com.github.binarywang.demo.spring.config.WxGzh1Config;
10+
import com.github.binarywang.demo.spring.handler.SubscribeHandler;
11+
12+
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
13+
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
14+
15+
@Component
16+
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
17+
public class Gzh1SubscribeHadler extends SubscribeHandler {
18+
@Autowired
19+
private WxGzh1Config wxConfig;
20+
21+
@Override
22+
protected WxConfig getWxConfig() {
23+
return this.wxConfig;
24+
}
25+
26+
@Override
27+
protected WxMpXmlOutMessage handleSpecial(WxMpXmlMessage wxMessage)
28+
throws Exception {
29+
return null;
30+
}
31+
32+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.github.binarywang.demo.spring.handler.gzh1;
2+
3+
import org.springframework.beans.factory.annotation.Autowired;
4+
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
5+
import org.springframework.context.annotation.Scope;
6+
import org.springframework.stereotype.Component;
7+
8+
import com.github.binarywang.demo.spring.config.WxConfig;
9+
import com.github.binarywang.demo.spring.config.WxGzh1Config;
10+
import com.github.binarywang.demo.spring.handler.UnsubscribeHandler;
11+
12+
@Component
13+
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
14+
public class Gzh1UnSubscribeHadler extends UnsubscribeHandler {
15+
@Autowired
16+
private WxGzh1Config wxConfig;
17+
18+
@Override
19+
protected WxConfig getWxConfig() {
20+
return this.wxConfig;
21+
}
22+
23+
}

‎weixin-java-demo-with-spring/src/main/java/com/github/binarywang/demo/spring/service/Gzh1WxService.java‎

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
import com.github.binarywang.demo.spring.handler.MsgHandler;
1111
import com.github.binarywang.demo.spring.handler.SubscribeHandler;
1212
import com.github.binarywang.demo.spring.handler.UnsubscribeHandler;
13+
import com.github.binarywang.demo.spring.handler.gzh1.Gzh1LocationHandler;
14+
import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MenuHadler;
15+
import com.github.binarywang.demo.spring.handler.gzh1.Gzh1MsgHadler;
16+
import com.github.binarywang.demo.spring.handler.gzh1.Gzh1SubscribeHadler;
17+
import com.github.binarywang.demo.spring.handler.gzh1.Gzh1UnSubscribeHadler;
1318

1419
/**
1520
*
@@ -19,46 +24,55 @@
1924
@Service
2025
public class Gzh1WxService extends BaseWxService {
2126
@Autowired
22-
private WxGzh1Config wxConfig;
27+
private WxGzh1Config wxConfig;
28+
29+
@Autowired
30+
private Gzh1LocationHandler locationHandler;
31+
32+
@Autowired
33+
private Gzh1MenuHadler menuHadler;
34+
35+
@Autowired
36+
private Gzh1MsgHadler msgHadler;
37+
38+
@Autowired
39+
private Gzh1UnSubscribeHadler unSubscribeHadler;
2340

41+
@Autowired
42+
private Gzh1SubscribeHadler subscribeHadler;
43+
2444
@Override
2545
protected WxConfig getServerConfig() {
2646
return this.wxConfig;
2747
}
2848

2949
@Override
3050
protected MenuHandler getMenuHandler() {
31-
// TODO Auto-generated method stub
32-
return null;
51+
return this.menuHadler;
3352
}
3453

3554
@Override
3655
protected SubscribeHandler getSubscribeHandler() {
37-
// TODO Auto-generated method stub
38-
return null;
56+
return this.subscribeHadler;
3957
}
4058

4159
@Override
4260
protected UnsubscribeHandler getUnsubscribeHandler() {
43-
// TODO Auto-generated method stub
44-
return null;
61+
return this.unSubscribeHadler;
4562
}
4663

4764
@Override
4865
protected AbstractHandler getLocationHandler() {
49-
// TODO Auto-generated method stub
50-
return null;
66+
return this.locationHandler;
5167
}
5268

5369
@Override
5470
protected MsgHandler getMsgHandler() {
55-
// TODO Auto-generated method stub
56-
return null;
71+
return this.msgHadler;
5772
}
5873

5974
@Override
6075
protected AbstractHandler getScanHandler() {
61-
// TODO Auto-generated method stub
6276
return null;
6377
}
6478

0 commit comments

Comments
 (0)