微信开发——服务器的基本配置

Posted by Cchua on 2017-04-19

  最近在弄微信开发,这里讲下服务器的基本配置   

设置

  https://mp.weixin.qq.com/
  
  开发->基本配置->服务器配置->启用
  
  Url:设置自己要接入的URL (例:http://XXX.XXXcom/api/wechat/pushserver)
  
  Token:自己随便填写
  
  EncodingAESKey:使用微信随机生成就好
  
  加解密方式:建议采用安全模式   

接口

  这采用java进行示范 根据:https://mp.weixin.qq.com/wiki 文档的描写
  微信服务器将发送GET请求到填写的服务器地址URL上  
  我们只需要写好GET接口,并且把GET来的echostr回调,就可以通过他的设置!   

Java代码  

  

>  @RequestMapping(value = "/pushserver", method = { RequestMethod.GET })
>  @ResponseBody
>  public String validateserver(
>   @RequestParam(value = "signature", required = true) String signature,
>  @RequestParam(value = "timestamp", required = true) String timestamp,
>   @RequestParam(value = "nonce", required = true) String nonce,
>  @RequestParam(value = "echostr", required = true) String echostr
>  )  {
>  return echostr;
>  }

  


世界上本没有坑,都是自己挖的!……