调用个人微信SDK的API接口收发消息,发朋友圈

//调用参考http://www.wlkankan.cn/cate40/229.html

} catch (Exception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL); } }

/** * 发送朋友圈任务 * @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

经验分享 程序员 微信小程序 职场和发展