Skip to content

feat(miniapp): 新增微信小程序服务卡片消息接口#3952

Draft
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-service-card-message-api
Draft

feat(miniapp): 新增微信小程序服务卡片消息接口#3952
Copilot wants to merge 2 commits intodevelopfrom
copilot/add-service-card-message-api

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

微信小程序服务卡片消息(订阅消息2.0)缺少服务端 API 支持。新增 setUserNotifysetUserNotifyExtgetUserNotify 三个接口。

变更

  • URL 常量:在 WxMaApiUrlConstants.Subscribe 中新增三个接口地址
  • 请求/响应 Bean
    • WxMaServiceNotifyRequest:激活与更新服务卡片(含可选的 checkJson 微信支付校验字段)
    • WxMaServiceNotifyExtRequest:更新服务卡片扩展信息
    • WxMaGetUserNotifyRequest / WxMaGetUserNotifyResult:查询卡片状态,响应含 NotifyInfocodeStatecodeExpireTime 等)
  • 接口与实现WxMaSubscribeService 新增三个方法,WxMaSubscribeServiceImpl 对应实现

用法示例

// 激活服务卡片
WxMaServiceNotifyRequest req = WxMaServiceNotifyRequest.builder()
  .openid("oGZUI0egBJY1zhBYw2KhdUfwVJJE")
  .notifyType(1)
  .notifyCode("CODE_FROM_FRONTEND")
  .contentJson("{\"status\":1}")
  .build();
wxMaService.getSubscribeService().setUserNotify(req);

// 查询卡片状态
WxMaGetUserNotifyResult result = wxMaService.getSubscribeService()
  .getUserNotify(WxMaGetUserNotifyRequest.builder()
    .openid("oGZUI0egBJY1zhBYw2KhdUfwVJJE")
    .notifyCode("CODE_FROM_FRONTEND")
    .notifyType(1)
    .build());
// result.getNotifyInfo().getCodeState() — 0:正常, 1:有风险, 2:异常, 10:用户拒收

官方文档:setUserNotify | setUserNotifyExt | getUserNotify

Copilot AI linked an issue Apr 7, 2026 that may be closed by this pull request
实现以下三个服务卡片消息 API:
- 激活与更新服务卡片(setUserNotify)
- 更新服务卡片扩展信息(setUserNotifyExt)
- 查询服务卡片状态(getUserNotify)

Agent-Logs-Url: https://github.com/binarywang/WxJava/sessions/63aeccb8-2684-4ea7-8b6b-9db7d362044a

Co-authored-by: binarywang <1343140+binarywang@users.noreply.github.com>
Copilot AI changed the title [WIP] Add service card message API for WeChat Mini Programs feat(miniapp): 新增微信小程序服务卡片消息接口 Apr 7, 2026
Copilot AI requested a review from binarywang April 7, 2026 09:20
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.

微信小程序服务卡片消息

2 participants