8000 :art: #3142 【公众号】订阅通知下发接口返回消息id · binarywang/WxJava@bf49c9a · GitHub
[go: up one dir, main page]

Skip to content

Commit bf49c9a

Browse files
authored
🎨 #3142 【公众号】订阅通知下发接口返回消息id
1 parent 49d73f0 commit bf49c9a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpSubscribeMsgService.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,9 @@ public interface WxMpSubscribeMsgService {
134134
* </pre>
135135
*
136136
* @param subscribeMessage 订阅消息
137+
* @return 下发消息id,与下发结果回调的msgId对应
137138
* @throws WxErrorException .
138139
*/
139-
void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;
140+
String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;
140141

141142
}

weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpSubscribeMsgServiceImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,12 @@ public List<CategoryData> getCategory() throws WxErrorException {
103103
}
104104

105105
@Override
106-
public void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException {
106+
public String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException {
107107
String responseContent = this.service.post(SEND_SUBSCRIBE_MESSAGE_URL, subscribeMessage.toJson());
108108
JsonObject jsonObject = GsonParser.parse(responseContent);
109109
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
110110
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP));
111111
}
112+
return jsonObject.get("msgid").getAsString();
112113
}
113114
}

0 commit comments

Comments
 (0)
0