mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-05-03 20:27:46 +08:00
🎨 #3142 【公众号】订阅通知下发接口返回消息id
This commit is contained in:
parent
49d73f003f
commit
bf49c9a152
@ -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;
|
||||
|
||||
}
|
||||
|
@ -103,11 +103,12 @@ public class WxMpSubscribeMsgServiceImpl implements WxMpSubscribeMsgService {
|
||||
}
|
||||
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user