binarywang / weixin-java-cp-demo

基于Spring Boot 和 WxJava 实现的微信企业号/企业微信 后端Demo
366 stars 245 forks source link

WxCpConfigStorage wxCpConfigStorage = this.wxCpService.getWxCpConfigStorage(); #12

Open steadyliu opened 3 years ago

steadyliu commented 3 years ago

这个获取就会是空的 ,不知为何

binarywang commented 3 years ago

设置了吗?是否修改过demo?

steadyliu commented 3 years ago

private WxCpService wxCpService = new WxCpServiceImpl(); @Autowired private WxCpProperties wxCpProperties ; @RequestMapping("authorize") public void authorize(HttpServletRequest request, HttpServletResponse response) throws IOException, WxErrorException { WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl(); config.setCorpId(wxCpProperties.getCorpId()); config.setCorpSecret(wxCpProperties.getAppConfigs().get(0).getSecret()); config.setAgentId(wxCpProperties.getAppConfigs().get(0).getAgentId()); config.setToken(wxCpProperties.getAppConfigs().get(0).getToken()); config.setAesKey(wxCpProperties.getAppConfigs().get(0).getAesKey()); String redirectUri ="http://" +request.getServerName()+"/wx/cp/oauth2/getUserInfo"; 我通过这个来设置的。就行了 里面封装的太多了 如果有详细的教程就好了

binarywang commented 3 years ago

不要每次请求时去设置参数,你参考demo的做法就不会有问题

steadyliu commented 3 years ago

demo我直接放到项目了 ,没有看到这块是怎么设置的