Skip to content

Commit 8e6f58e

Browse files
committed
docs: 记录商家客服 API 设计与计划
1 parent ade05b7 commit 8e6f58e

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# 视频号小店商家客服 API Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:**`weixin-java-channel` 增加商家客服媒体上传和消息发送 API。
6+
7+
**Architecture:** 以独立的客服子服务封装两条官方 API,通过既有 `BaseWxChannelServiceImpl` 完成鉴权、JSON 请求与 multipart 上传。请求模型保持强类型,服务层测试使用可记录调用的测试替身,避免真实网络依赖。
8+
9+
**Tech Stack:** Java 8、Maven、TestNG、Lombok、Jackson 注解。
10+
11+
## Global Constraints
12+
13+
- Java 8 兼容,不新增依赖。
14+
- API 路径固定为 `/channels/ec/commkf/cosupload``/channels/ec/commkf/sendmsg`
15+
- 使用 TestNG,所有新增测试不使用真实微信凭据。
16+
17+
---
18+
19+
### Task 1: 请求与响应模型
20+
21+
**Files:**
22+
- Create: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfCosUploadResponse.java`
23+
- Create: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfSendMsgParam.java`
24+
- Create: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfSendMsgResponse.java`
25+
- Test: `weixin-java-channel/src/test/java/me/chanjar/weixin/channel/bean/kf/WxChannelKfBeanTest.java`
26+
27+
- [ ] Write JSON encode/decode tests for `request_id`, `open_id`, `msg_type`, `text.content`, `cos_url` and `msg_id`.
28+
- [ ] Run the test and verify it fails because the classes do not exist.
29+
- [ ] Add the minimal annotated model classes and nested message content types.
30+
- [ ] Run the test and verify it passes.
31+
32+
### Task 2: 服务入口与请求执行
33+
34+
**Files:**
35+
- Create: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelKfService.java`
36+
- Create: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/WxChannelKfServiceImpl.java`
37+
- Modify: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelService.java`
38+
- Modify: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/impl/BaseWxChannelServiceImpl.java`
39+
- Modify: `weixin-java-channel/src/main/java/me/chanjar/weixin/channel/constant/WxChannelApiUrlConstants.java`
40+
- Test: `weixin-java-channel/src/test/java/me/chanjar/weixin/channel/api/impl/WxChannelKfServiceImplTest.java`
41+
42+
- [ ] Write tests proving the service uses the documented URLs, uploads `file`, `open_id`, `msg_type`, decodes both responses, and caches `getKfService()`.
43+
- [ ] Run the test and verify it fails because the API is absent.
44+
- [ ] Add the minimal service API, implementation, constants and cached service entry point.
45+
- [ ] Run the focused tests and module test suite, then inspect `git diff --check`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# 视频号小店商家客服 API 设计
2+
3+
## 目标
4+
5+
实现 Issue #3991 所列的商家客服媒体上传与消息发送 API,并使调用入口、请求模型和响应解析与现有 `weixin-java-channel` 服务保持一致。
6+
7+
## 设计
8+
9+
-`WxChannelService` 暴露 `getKfService()`,由 `BaseWxChannelServiceImpl` 缓存并懒加载 `WxChannelKfServiceImpl`
10+
- `WxChannelKfService` 提供媒体上传(带文件名和便捷重载)以及接收强类型请求参数的消息发送方法。上传请求通过既有 `CommonUploadParam` 发送 multipart 数据。
11+
- 消息模型用 `@JsonProperty` 显式映射微信字段,支持 text、image、video、file、product_share 和 order_share 六类内容;响应继承项目既有基础响应。
12+
- API 常量使用官方文档确认的 `/channels/ec/commkf/cosupload``/channels/ec/commkf/sendmsg` 路径。
13+
14+
## 质量边界
15+
16+
- 保持 Java 8 兼容,不增加依赖,不变更现有公共 API。
17+
- 使用 TestNG 覆盖请求/响应 JSON 映射、服务 URL、上传表单字段及服务入口缓存;测试不依赖真实微信凭据。
18+
- PR 使用 `Closes #3991` 关联并关闭原始 Issue;旧 PR #4037 在新 PR 创建后以替代说明关闭。

0 commit comments

Comments
 (0)