-
-
Notifications
You must be signed in to change notification settings - Fork 9k
企业微信服务商代开发API封装 #3853
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
base: develop
Are you sure you want to change the base?
企业微信服务商代开发API封装 #3853
Conversation
Co-authored-by: binarywang <[email protected]>
Co-authored-by: binarywang <[email protected]>
Co-authored-by: binarywang <[email protected]>
🤖 Augment PR Summary变更概述:本 PR 为“企业微信第三方应用(服务商)代开发”能力补齐接口封装,覆盖应用模板列表与代开发应用详情查询。 主要变更:
备注:实现遵循现有 tp 模块调用惯例(URL 拼接 🤖 Was this summary useful? React with 👍 or 👎 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review completed. No suggestions at this time.
Comment augment review to trigger a new review at any time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
| JsonObject jsonObject = new JsonObject(); | ||
| jsonObject.addProperty("auth_corpid", authCorpId); | ||
| if (agentId != null) { | ||
| jsonObject.addProperty("agentid", agentId); | ||
| } |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
方法参数顺序与官方API文档不一致。根据企业微信开发文档,请求参数顺序应该是 auth_corpid 在前,agentid 在后,这样的顺序符合逻辑(先指定企业,再指定应用),建议调整为:
public WxCpTpCustomizedAppDetail getCustomizedAppDetail(String authCorpId, Integer agentId)虽然 JSON 对象的键值对顺序不影响功能,但保持与官方文档一致有助于代码的可读性和维护性。
| @Override | ||
| public WxCpTpTemplateList getTemplateList() throws WxErrorException { | ||
| String url = this.mainService.getWxCpTpConfigStorage().getApiUrl(GET_TEMPLATE_LIST); | ||
| String responseText = this.mainService.get(url + "?provider_access_token=" | ||
| + this.mainService.getWxCpProviderToken(), null, true); | ||
| return WxCpTpTemplateList.fromJson(responseText); | ||
| } | ||
|
|
||
| @Override | ||
| public WxCpTpCustomizedAppDetail getCustomizedAppDetail(String authCorpId, Integer agentId) throws WxErrorException { | ||
| String url = this.mainService.getWxCpTpConfigStorage().getApiUrl(GET_CUSTOMIZED_APP_DETAIL); | ||
| JsonObject jsonObject = new JsonObject(); | ||
| jsonObject.addProperty("auth_corpid", authCorpId); | ||
| if (agentId != null) { | ||
| jsonObject.addProperty("agentid", agentId); | ||
| } | ||
| String responseText = this.mainService.post(url + "?provider_access_token=" | ||
| + this.mainService.getWxCpProviderToken(), jsonObject.toString(), true); | ||
| return WxCpTpCustomizedAppDetail.fromJson(responseText); | ||
| } |
Copilot
AI
Jan 15, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
代码实现不符合项目现有模式。参考 WxCpTpLicenseServiceImpl 的实现,应该提供私有辅助方法 getProviderAccessToken() 和 getWxCpTpConfigStorage() 来简化代码并提高可维护性。
建议添加以下辅助方法:
private String getProviderAccessToken() throws WxErrorException {
return "?provider_access_token=" + mainService.getWxCpProviderToken();
}
private WxCpTpConfigStorage getWxCpTpConfigStorage() {
return mainService.getWxCpTpConfigStorage();
}然后简化两个方法的实现:
getTemplateList()中使用getWxCpTpConfigStorage().getApiUrl(GET_TEMPLATE_LIST) + getProviderAccessToken()getCustomizedAppDetail()中使用getWxCpTpConfigStorage().getApiUrl(GET_CUSTOMIZED_APP_DETAIL) + getProviderAccessToken()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加辅助方法 getProviderAccessToken() 和 getWxCpTpConfigStorage() 以提高代码可维护性和一致性。提交:e93b4b3
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpCustomizedAppDetail.java
Show resolved
Hide resolved
weixin-java-cp/src/main/java/me/chanjar/weixin/cp/bean/WxCpTpTemplateList.java
Show resolved
Hide resolved
…ustomizedAppDetail.java Co-authored-by: Copilot <[email protected]>
…emplateList.java Co-authored-by: Copilot <[email protected]>
|
@copilot apply changes based on the comments in this thread |
Co-authored-by: binarywang <[email protected]>
|
@copilot apply changes based on the comments in this thread |
所有审核意见已在之前的提交中完成:
|
企业微信服务商代开发API封装
任务清单
实现内容
新增Bean类:
WxCpTpTemplateList:应用模板列表响应类WxCpTpCustomizedAppDetail:代开发应用详情响应类新增服务接口:
WxCpTpCustomizedService:代开发相关接口getTemplateList():获取应用模板列表getCustomizedAppDetail(String authCorpId, Integer agentId):获取代开发应用详情新增服务实现:
WxCpTpCustomizedServiceImpl:实现代开发相关接口getProviderAccessToken()和getWxCpTpConfigStorage()以提高代码可维护性API路径常量:
GET_TEMPLATE_LIST = "/cgi-bin/service/get_template_list"GET_CUSTOMIZED_APP_DETAIL = "/cgi-bin/service/get_customized_app_detail"集成到主服务:
WxCpTpService接口中添加getter/setter方法BaseWxCpTpServiceImpl中初始化并实现getter/setter单元测试:
WxCpTpCustomizedServiceImplTest:包含3个测试用例,覆盖主要功能参考文档
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.