Class WeChatMpRestNotification

java.lang.Object
com.bytedesk.wechat.mp.WeChatMpRestNotification

@RestController @RequestMapping("/wechat/mp") public class WeChatMpRestNotification extends Object
公众号:直接通过提供URL对接公众号 测试号:https://mp.weixin.qq.com/debug/cgi-bin/sandboxinfo?action=showinfo&t=sandbox/index 接收到‘安全模式’的消息,需要解密,可能遇到下面问题: java.security.invalidkeyexception: illegal key size 由于受到美国对出口软件的限制,我们需要手动[下载jdk加密jar包](http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html), 解压之后,需要将local_policy.jar和US_export_policy.jar放到jdk安装文件夹jre/lib/security文件夹,比如:
  • Field Details

  • Constructor Details

    • WeChatMpRestNotification

      public WeChatMpRestNotification()
  • Method Details

    • authGet

      @GetMapping("/push/{token}") public String authGet(@PathVariable String token, @RequestParam(name="signature",required=false) String signature, @RequestParam(name="timestamp",required=false) String timestamp, @RequestParam(name="nonce",required=false) String nonce, @RequestParam(name="echostr",required=false) String echostr)
      Parameters:
      token - token
      signature - sign
      timestamp - timestamp
      nonce - nonce
      echostr - echostr
      Returns:
      string
      See Also:
    • post

      @PostMapping("/push/{token}") public String post(@PathVariable String token, @RequestBody String requestBody, @RequestParam("signature") String signature, @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam("openid") String openid, @RequestParam(name="encrypt_type",required=false) String encType, @RequestParam(name="msg_signature",required=false) String msgSignature)
      Parameters:
      token - token
      requestBody - body
      signature - sign
      timestamp - time
      nonce - nonce
      openid - ip
      encType - type
      msgSignature - sign
      Returns:
      string
      See Also:
    • refreshAccessToken

      @GetMapping("/refreshAccessToken") public void refreshAccessToken()
    • oauthCallback

      @PostMapping("/oauth/callback") public Object oauthCallback(@RequestBody(required=false) String requestBody, @RequestParam("timestamp") String timestamp, @RequestParam("nonce") String nonce, @RequestParam("signature") String signature, @RequestParam(name="encrypt_type",required=false) String encType, @RequestParam(name="msg_signature",required=false) String msgSignature, jakarta.servlet.http.HttpSession session)
      处理授权事件POST 授权事件接收URL wechat.bytedesk.com/wechat/mp/oauth/callback 授权过程中: 1. 首先接收到POST请求结果, 2. 最后是GET请求,在GET函数里面执行页面跳转
      Parameters:
      requestBody - body
      timestamp - time
      nonce - nonce
      signature - sign
      encType - enc
      msgSignature - sign
      session - session
      Returns:
      object