java调用个人微信API接口发朋友圈,评论和删除朋友圈
java调用个人微信API接口发朋友圈,评论和删除朋友圈
/**
* 发送朋友圈任务
* @author wechatno:tangjinjinwx
* @param ctx
* @param vo
*/
@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);
}
}
//接口参考http://www.wlkankan.cn/cate40/247.html
/**
* 删除朋友圈
* @author wechatno:tangjinjinwx
* @param ctx
* @param vo
*/
@Async
public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
DeleteSNSNewsTaskMessage.Builder bd = DeleteSNSNewsTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
DeleteSNSNewsTaskMessage req = bd.build();
asyncTaskService.msgSend2Phone(ctx, req.getWeChatId(), EnumMsgType.DeleteSNSNewsTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
//接口参考http://www.wlkankan.cn/cate40/247.html
/**
* 触发手机推送朋友圈列表任务
*
* @author wechatno:tangjinjinwx
* @param ctx
* @param vo
*/
@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);
}
}