com.github.sdcxy:third-party-platform-wechat

这是一个第三方平台工具类

License

License

Categories

Categories

ORM Data
GroupId

GroupId

com.github.sdcxy
ArtifactId

ArtifactId

third-party-platform-wechat
Last Version

Last Version

0.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

这是一个第三方平台工具类

Download third-party-platform-wechat

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.sdcxy/third-party-platform-wechat/ -->
<dependency>
    <groupId>com.github.sdcxy</groupId>
    <artifactId>third-party-platform-wechat</artifactId>
    <version>0.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.sdcxy/third-party-platform-wechat/
implementation 'com.github.sdcxy:third-party-platform-wechat:0.0.2'
// https://jarcasting.com/artifacts/com.github.sdcxy/third-party-platform-wechat/
implementation ("com.github.sdcxy:third-party-platform-wechat:0.0.2")
'com.github.sdcxy:third-party-platform-wechat:jar:0.0.2'
<dependency org="com.github.sdcxy" name="third-party-platform-wechat" rev="0.0.2">
  <artifact name="third-party-platform-wechat" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.sdcxy', module='third-party-platform-wechat', version='0.0.2')
)
libraryDependencies += "com.github.sdcxy" % "third-party-platform-wechat" % "0.0.2"
[com.github.sdcxy/third-party-platform-wechat "0.0.2"]

Dependencies

compile (11)

Group / Artifact Type Version
org.springframework.boot : spring-boot-autoconfigure jar
org.springframework.boot : spring-boot-configuration-processor jar
org.projectlombok : lombok jar 1.18.8
org.apache.commons : commons-lang3 jar 3.9
org.apache.httpcomponents : httpclient jar 4.5.10
org.apache.httpcomponents : httpmime jar 4.5.10
com.alibaba : fastjson jar 1.2.60
cglib : cglib jar 3.3.0
com.thoughtworks.xstream : xstream jar 1.4.11.1
dom4j : dom4j jar 1.6.1
commons-beanutils : commons-beanutils jar 1.9.3

provided (1)

Group / Artifact Type Version
javax.servlet : javax.servlet-api jar 4.0.1

Project Modules

There are no modules declared in this project.

Third-Party-PlatForm

一 微信公众号工具类使用方法

  1. pom 文件添加依赖

        <dependency>
            <groupId>com.github.sdcxy</groupId>
            <artifactId>third-party-platform-wechat</artifactId>
            <version>0.0.1</version>
        </dependency>
    
  2. 配置类 application.yml 配置文件配置

     third-party-platform:
       wechat:
         enabled: true
         app-id: wxce9****1767870
         app-secret: 991c******18c526e25508488339
         token: l**
         wechat: gh*****c0432c
    
  3. 接入方法: com.github.sdcxy.wechat.service.impl.WeChatServiceImpl 的weChatIn

        @Autowired
        private WeChatService weChatService;
    
        @GetMapping(value = "/wechat/in")
        @ResponseBody
        public String WeChatIn(String signature,String timestamp,String nonce,String echostr ){
            SignatureConfig signatureConfig = new SignatureConfig(signature,timestamp,nonce,echostr);
            return weChatService.weChatIn(signatureConfig);
        }
       
    
  4. 响应消息方法: com.github.sdcxy.wechat.service.impl.WeChatServiceImpl 的weChatCallBack

        @PostMapping(value = "/wechat/in")
        @ResponseBody
        public String WeChatOut(HttpServletRequest request) {
            return weChatService.weChatCallBack(request);
        }
    
  5. 消息响应类处理: com.github.sdcxy.wechat.service.impl.MessageServiceImpl

        实现那种消息回复,直接实现对应消息类的接口的parseXXXMessage方法即可(XXX之接口类)
        文本消息: Text 接口 
        图片消息: Image 接口
        语音消息: Voice 接口
        视频消息: Video 接口
        短视频消息: ShortVideo 接口
        地理消息: Location 接口
        链接消息: Link 接口     
        .....event 事件处理方法与消息处理方法一致。详细请查看源码
    
        /**注意: 记得加@Primary注解 */ 
        @Service
        @Primary
        public class TextMessageService implements Text{
            @Override
                public String parseTextMessage(TextMessage textMessage) {
                    //.....
                }
        }
    
  6. 菜单管理 com.github.sdcxy.wechat.core.service.impl.CustomMenuServiceImpl

           String createCustomMenu(CustomButton customButton, String accessToken);
           // 查询自定义菜单
           String queryCustomMenu(String accessToken);
           // 删除自定义菜单
           String deleteCustomMenu(String  accessToken);
    
  7. 素材管理 com.github.sdcxy.wechat.core.service.impl.MaterialServiceImpl

Versions

Version
0.0.2