Skip to content

feat: 拆分微信小店独立模块 - #4117

Open
binarywang wants to merge 4 commits into
developfrom
feature/issue-4004-store-module
Open

feat: 拆分微信小店独立模块#4117
binarywang wants to merge 4 commits into
developfrom
feature/issue-4004-store-module

Conversation

@binarywang

Copy link
Copy Markdown
Owner

变更内容

  • 新增独立 weixin-java-store SDK,Java 包名为 com.binarywang.wxjava.store.*,不依赖 weixin-java-channel
  • 新增 Spring Boot/Solon 的单账号、多账号 Store 集成模块,配置前缀为 wx.store
  • 保留原 weixin-java-channel 的小店服务和模型,行为不变,并统一标记为 @Deprecated
  • 移除新 Store 模块中的直播、Finder、联盟分销、留资、罗盘达人版等 Channel 专属能力。
  • 增加迁移指南与新旧 API 边界回归测试。

验证

  • mvn -pl weixin-java-channel,weixin-java-store,spring-boot-starters/wx-java-store-spring-boot-starter,spring-boot-starters/wx-java-store-multi-spring-boot-starter,solon-plugins/wx-java-store-solon-plugin,solon-plugins/wx-java-store-multi-solon-plugin -am test -Dmaven.test.skip=false
    • Channel:58 tests passed
    • Store:3 tests passed
  • git diff --check

Copilot AI lite review requested due to automatic review settings August 30, 2026 09:38
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-30T09:51:53.908397Z da31b5d PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@augmentcode

augmentcode Bot commented Aug 30, 2026

Copy link
Copy Markdown

This pull request is too large for Augment to review. The PR exceeds the maximum size limit of 75000 tokens (approximately 300000 characters) for automated code review. Please consider breaking this PR into smaller, more focused changes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

BOM 目前未对本 PR 新增的 Store Starter / Solon 插件 artifact 做版本托管,可能影响依赖 BOM 的用户集成与升级体验。

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

该 PR 将“微信小店(Store)”能力从 weixin-java-channel 中拆分为独立的 weixin-java-store SDK,并新增对应的 Spring Boot / Solon 集成模块;同时对 weixin-java-channel 中保留的小店相关 API/模型进行 @Deprecated 标记,以引导用户迁移且保持既有行为不变。

Changes:

  • 新增 weixin-java-store 模块,并在根聚合构建中注册该模块。
  • 新增 Store 的 Spring Boot Starter(单账号/多账号)与 Solon 插件(单账号/多账号)的自动装配/插件声明资源。
  • weixin-java-channel 中对小店相关接口与大量请求/响应/模型类增加 @Deprecated 标记。
File summaries
File Description
pom.xml 在根聚合模块中加入 weixin-java-store,纳入统一构建/发布链路。
wx-java-bom/pom.xml BOM 增加 weixin-java-store 的版本托管入口(但目前未覆盖 Store Starter/Solon 插件,见评论)。
spring-boot-starters/pom.xml 注册 Store 的 Spring Boot Starter 两个子模块。
spring-boot-starters/wx-java-store-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 声明 Store 单账号 Starter 的 AutoConfiguration 导入。
spring-boot-starters/wx-java-store-spring-boot-starter/src/main/resources/META-INF/spring.factories 兼容 Spring Boot 旧机制的自动装配声明。
spring-boot-starters/wx-java-store-multi-spring-boot-starter/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports 声明 Store 多账号 Starter 的 AutoConfiguration 导入。
spring-boot-starters/wx-java-store-multi-spring-boot-starter/src/main/resources/META-INF/spring.factories 兼容 Spring Boot 旧机制的自动装配声明。
solon-plugins/pom.xml 注册 Store 的 Solon 插件两个子模块。
solon-plugins/wx-java-store-solon-plugin/src/main/resources/META-INF/solon/wx-java-store-solon-plugin.properties 声明 Solon 插件入口与优先级。
solon-plugins/wx-java-store-solon-plugin/src/test/resources/app.yml Store Solon 插件测试资源(当前为空文件)。
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelKfService.java 将 Channel 内小店客服服务接口标记为 @Deprecated(建议补充迁移指引,见评论)。
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelAfterSaleService.java 将 Channel 内小店售后服务接口标记为 @Deprecated
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/api/WxChannelProductService.java 将 Channel 内小店商品服务接口标记为 @Deprecated
weixin-java-channel/src/main/java/me/chanjar/weixin/channel/bean/** 大量小店相关 Bean/Param/Response 增加 @Deprecated,用于迁移引导与边界划分。
Review details
  • Files reviewed: 299/1242 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wx-java-bom/pom.xml

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: da31b5dd85

ℹ️ 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".

@binarywang

Copy link
Copy Markdown
Owner Author

@copilot 再次review最新代码

Copilot AI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

@copilot 再次review最新代码

以下是最新代码的 Review 报告:


BOM 完整性 ✅

wx-java-bom/pom.xml 已补齐所有 Store 模块条目,包括:

  • wx-java-store-spring-boot-starterwx-java-store-multi-spring-boot-starter
  • wx-java-store-solon-pluginwx-java-store-multi-solon-plugin

发现问题

🔴 P0 — HTTP Response Body 双读 Bug(功能缺陷)

文件ApacheHttpStoreMediaDownloadRequestExecutor.javaHttpComponentsStoreMediaDownloadRequestExecutor.java

两个 executor 在 try-with-resources 中同时声明 responseinputStreamInputStreamResponseHandler.handleResponse(response) 已消费了 entity 字节流,之后再调用 Utf8ResponseHandler.handleResponse(response) 读取 JSON 只能得到空字符串。当微信接口返回错误 JSON(如 access_token 过期)时,错误码无法被解析,WxErrorException 无法抛出,错误被静默吞掉。

修复建议:先检查 Content-Type,若为 JSON 则只用 Utf8ResponseHandler,否则只用 InputStreamResponseHandler,两者不能共存。


🟠 P1 — OkHttp response.body() 无空指针保护

文件OkHttpStoreMediaDownloadRequestExecutor.java L33、L43

Response.body() 标注为 @Nullable,L33 和 L43 直接调用而无 null 检查,网络异常时会触发 NPE。


🟠 P1 — InterruptedException 未恢复中断状态

文件WxStoreMessageRouter.java L167~176

异步监控任务捕获 InterruptedException 后未调用 Thread.currentThread().interrupt(),可能导致线程池关闭逻辑失效。


🟡 P2 — Content-Disposition 正则贪婪导致文件名截取错误

文件StoreMediaDownloadRequestExecutor.java L28

Pattern.compile(".*filename=\"(.*)\"") 中捕获组使用贪婪匹配,当 header 含多个参数时会截取过多内容。建议改为 ([^\"]+)


🟡 P2 — CategoryQualification.brandQua 缺少 @deprecated 迁移说明

该字段仅有 @Deprecated 注解,没有配套的 Javadoc @deprecated 标签说明废弃原因和替代方案。


🟡 P2 — WxStoreMessageRouter@Data 不合适 + 冗余赋值

  • @Data 会为含 ExecutorServiceList<Rule> 的路由器类生成 equals()/hashCode(),不合适,建议改为 @Getter @Setter
  • 构造函数中 sessionManager 被重复赋值两次(L55、L58),第一个实例立即被 GC。

总结:P0 的双读 Bug 会导致 getImg() 在接口报错时静默失败,建议优先修复后再合并。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants