feat(channel): 新增视频号小店商家客服 API(cosupload/sendmsg)#4037
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7e4e8b03a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| String COS_UPLOAD_URL = "https://api.weixin.qq.com/channels/ec/commkf/cosupload"; | ||
| /** 发送消息 */ | ||
| String SEND_MSG_URL = "https://api.weixin.qq.com/channels/ec/commkf/sendmsg"; |
There was a problem hiding this comment.
Use the documented KF endpoints
When clients call either new KF method, these constants send the request to /channels/ec/commkf/..., but the WeChat store KF APIs are exposed under /channels/ec/kf/cosupload and /channels/ec/kf/sendmsg. As written, both upload and send-message calls are routed to the wrong API path and will fail before the new request/response models can be used.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
该 PR 为 weixin-java-channel 新增视频号小店商家客服能力,补齐多媒体上传与客服消息发送两个基础 API 的服务入口、模型与常量。
Changes:
- 新增商家客服服务接口及实现,并接入
WxChannelService#getKfService()。 - 新增
cosupload/sendmsgAPI 常量及对应请求、响应模型。 - 新增 Bean 序列化与反序列化测试,覆盖客服消息参数和响应字段映射。
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java |
新增商家客服相关 API 地址常量。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java |
暴露商家客服子服务入口。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelKfService.java |
定义上传媒体与发送客服消息接口。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java |
懒加载并返回客服服务实现。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelKfServiceImpl.java |
实现 multipart 上传与消息发送调用。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfSendMsgParam.java |
新增发送客服消息请求模型。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfCosUploadResponse.java |
新增上传响应模型。 |
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfSendMsgResponse.java |
新增发送消息响应模型。 |
weixin-java-channel/src/test/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfBeanTest.java |
新增客服相关 Bean JSON 映射测试。 |
当前
weixin-java-channel缺少商家客服能力,无法覆盖微信小店官方文档中的两项基础接口:上传多媒体资源与发送客服消息。该变更补齐服务入口、请求/响应模型与 API 常量,实现对cosupload与sendmsg的标准化调用。变更概览
WxChannelKfService与实现WxChannelKfServiceImplWxChannelService/BaseWxChannelServiceImpl中接入getKfService(),保持与现有子服务一致的使用方式https://api.weixin.qq.com/channels/ec/commkf/cosuploadhttps://api.weixin.qq.com/channels/ec/commkf/sendmsg请求与响应模型
WxChannelKfCosUploadResponse(cos_url)WxChannelKfSendMsgParamtext/image/video/file/product_share/order_sharerequest_id、open_id、msg_typeWxChannelKfSendMsgResponse(msg_id)接口设计要点
open_id、msg_type表单字段Object content的弱类型与字段漂移风险