mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-06 21:57:48 +08:00
🎨 #3142 【公众号】订阅通知下发接口返回消息id
This commit is contained in:
parent
49d73f003f
commit
bf49c9a152
@ -134,8 +134,9 @@ public interface WxMpSubscribeMsgService {
|
|||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param subscribeMessage 订阅消息
|
* @param subscribeMessage 订阅消息
|
||||||
|
* @return 下发消息id,与下发结果回调的msgId对应
|
||||||
* @throws WxErrorException .
|
* @throws WxErrorException .
|
||||||
*/
|
*/
|
||||||
void send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;
|
String send(WxMpSubscribeMessage subscribeMessage) throws WxErrorException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -103,11 +103,12 @@ public class WxMpSubscribeMsgServiceImpl implements WxMpSubscribeMsgService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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());
|
String responseContent = this.service.post(SEND_SUBSCRIBE_MESSAGE_URL, subscribeMessage.toJson());
|
||||||
JsonObject jsonObject = GsonParser.parse(responseContent);
|
JsonObject jsonObject = GsonParser.parse(responseContent);
|
||||||
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
if (jsonObject.get(ERR_CODE).getAsInt() != 0) {
|
||||||
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP));
|
throw new WxErrorException(WxError.fromJson(responseContent, WxType.MP));
|
||||||
}
|
}
|
||||||
|
return jsonObject.get("msgid").getAsString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user