Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat:订阅通知下发返回消息id
  • Loading branch information
JTongChen committed Oct 1, 2023
commit cef2bfc6c122090c8258adb1ec933746c2d61a61
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ public interface WxMpSubscribeMsgService {
* </pre>
*
* @param subscribeMessage 订阅消息
* @return 下发消息id,与下发结果回调的msgId对应
* @throws WxErrorException .
*/
void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;
String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;

}
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ public List<CategoryData> getCategory() throws WxErrorException {
}

@Override
public void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException {
public String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException {
String responseContent = this.service.post(SEND_SUBSCRIBE_MESSAGE_URL, subscribeMessage.toJson());
JsonObject jsonObject = GsonParser.parse(responseContent);
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP));
}
return jsonObject.get("msgid").getAsString();
}
}