Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持私有安装版企业微信. #1065

Merged
merged 4 commits into from Jun 2, 2019

Conversation

Projects
None yet
2 participants
@crazycode
Copy link

commented Jun 2, 2019

项目中有接触到客户部署了私有化部署的企业微信,而WxJava中服务地址 https://qyapi.weixin.qq.com 是固定写死的,导致无法使用WxJava。

产品说明见:https://work.weixin.qq.com/server

为此,对项目做了修改,供您参考。

使用方法:

通过 wxCpConfigStorage.setBaseApiUrl("http://local_server:port"); 设置私有化部署的企业微信服务地址.

默认值是 https://qyapi.weixin.qq.com , 如果使用默认值,则不需要调用 setBaseApiUrl(baseUrl).

支持私有安装版企业微信.
通过 wxCpConfigStorage.setBaseApiUrl("http://local_server:port"); 设置私有化部署的企业微信服务地址.

默认值是 https://qyapi.weixin.qq.com , 如果使用默认值,则不需要调用 setBaseApiUrl(baseUrl).
@crazycode

This comment has been minimized.

Copy link
Author

commented Jun 2, 2019

Caused by: java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at java.util.Formatter.parse(Formatter.java:2547)
at java.util.Formatter.format(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl.getAccessToken(WxCpServiceApacheHttpClientImpl.java:51)
at me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl.getAccessToken(BaseWxCpServiceImpl.java:100)

这里出错了:
String url = String.format(this.configStorage.getApiUrl(WxCpService.GET_TOKEN), this.configStorage.getCorpId(), this.configStorage.getCorpSecret());

是因为format中有null值吧?

@binarywang

This comment has been minimized.

Copy link
Member

commented Jun 2, 2019

Caused by: java.lang.NullPointerException
at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
at java.util.regex.Matcher.reset(Matcher.java:309)
at java.util.regex.Matcher.(Matcher.java:229)
at java.util.regex.Pattern.matcher(Pattern.java:1093)
at java.util.Formatter.parse(Formatter.java:2547)
at java.util.Formatter.format(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at me.chanjar.weixin.cp.api.impl.WxCpServiceApacheHttpClientImpl.getAccessToken(WxCpServiceApacheHttpClientImpl.java:51)
at me.chanjar.weixin.cp.api.impl.BaseWxCpServiceImpl.getAccessToken(BaseWxCpServiceImpl.java:100)

这里出错了:
String url = String.format(this.configStorage.getApiUrl(WxCpService.GET_TOKEN), this.configStorage.getCorpId(), this.configStorage.getCorpSecret());

是因为format中有null值吧?

你代码写错了

Update WxCpAgentService.java
删除多余的字符
@crazycode

This comment has been minimized.

Copy link
Author

commented Jun 2, 2019

你代码写错了

是指定业务代码吗?还是指这一块写的不对?

@binarywang

This comment has been minimized.

Copy link
Member

commented Jun 2, 2019

你代码写错了

是指定业务代码吗?还是指这一块写的不对?

看报错信息,像是你里面的代码的问题,具体我没看

@binarywang binarywang merged commit 97e88bd into Wechat-Group:develop Jun 2, 2019

1 check failed

continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
@crazycode

This comment has been minimized.

Copy link
Author

commented Jun 2, 2019

你代码写错了

是指定业务代码吗?还是指这一块写的不对?

看报错信息,像是你里面的代码的问题,具体我没看

的确是,我自己项目中有一个WxCpConfigStorage的实现,getApiUrl返回null了。
谢谢!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.