企业微信SDK接口API调用-通过手机号或微信好友添加客户
/**
* 企业微信搜索手机号添加微信
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
public void handleMsg(ChannelHandlerContext ctx ,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
AddCustomerFromSearchTaskMessage.Builder bd = AddCustomerFromSearchTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
AddCustomerFromSearchTaskMessage req = bd.build();
// 将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.AddCustomerFromSearchTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}
/**
* 从企业微信好友中添加客户
* @author wechat:happybabby110
* @blog http://www.wlkankan.cn
*/
public void handleMsg(ChannelHandlerContext ctx ,TransportMessage vo, String contentJsonStr) {
try {
log.debug(contentJsonStr);
AddCustomerFromWxTaskMessage.Builder bd = AddCustomerFromWxTaskMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
AddCustomerFromWxTaskMessage req = bd.build();
// 将消息转发送给手机客户端
asyncTaskService.msgSend2Phone(ctx, String.valueOf(req.getWxId()), EnumMsgType.AddCustomerFromWxTask, vo, req);
} catch (Exception e) {
e.printStackTrace();
MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);
}
}