200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > java 朋友圈分享接口_微信发朋友圈api接口调用代码

java 朋友圈分享接口_微信发朋友圈api接口调用代码

时间:2018-09-17 05:30:07

相关推荐

java 朋友圈分享接口_微信发朋友圈api接口调用代码

微信发朋友圈api接口调用代码,推送微信朋友圈、发朋友圈

/**

* 触发推送朋友圈列表

* @author wechatno:tangjinjinwx

* startTime传秒

* @blog

*/

@Async

public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo, String contentJsonStr) {

try {

log.debug(contentJsonStr);

TriggerCirclePushTaskMessage.Builder bd = TriggerCirclePushTaskMessage.newBuilder();

JsonFormat.parser().merge(contentJsonStr, bd);

TriggerCirclePushTaskMessage req = bd.build();

// TriggerCirclePushTaskMessage req =

// vo.getContent().unpack(TriggerCirclePushTaskMessage.class);

// 将消息转发送给手机客户端

asyncTaskService.msgSend2Phone(ctx, req.getWeChatId(), EnumMsgType.TriggerCirclePushTask, vo, req);

} catch (Exception e) {

e.printStackTrace();

MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);

}

}

/**

* 回传手机微信朋友圈数据

* @author wechatno:tangjinjinwx

* @blog

*/

@Async

public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {

try {

CirclePushNoticeMessage req = vo.getContent().unpack(CirclePushNoticeMessage.class);

log.debug(JsonFormat.printer().print(req));

//把消息转发给pc端

asyncTaskService.msgSend2pc(req.getWeChatId(), EnumMsgType.CirclePushNotice, req);

//保存朋友圈信息

asyncTaskService.asyncSaveCircleMsg(req, circleService, weChatContactService);

//告诉客户端消息已收到

MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);

} catch (Exception e) {

e.printStackTrace();

MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), Constant.ERROR_MSG_DECODFAIL);

}

}

/**

* 发微信朋友圈

* @author wechatno:tangjinjinwx

* @blog

*/

@Async

public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {

try {

log.debug(contentJsonStr);

PostSNSNewsTaskMessage.Builder bd = PostSNSNewsTaskMessage.newBuilder();

JsonFormat.parser().merge(contentJsonStr, bd);

PostSNSNewsTaskMessage req = bd.build();

//PostSNSNewsTaskMessage req = vo.getContent().unpack(PostSNSNewsTaskMessage.class);

asyncTaskService.msgSend2Phone(ctx, req.getWeChatId(), EnumMsgType.PostSNSNewsTask, vo, req);

} catch (Exception e) {

e.printStackTrace();

MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。