抖音api介面呼叫-同步抖音聊天會話列表
阿新 • • 發佈:2020-12-15
抖音sdk介面API呼叫-同步抖音聊天會話列表
/** * 同步抖音會話列表 * @author wechat:happybabby110 * @blog http://www.wlkankan.cn */ @Async public void handleMsg(ChannelHandlerContext ctx,TransportMessage vo, String contentJsonStr) { try { log.debug(contentJsonStr); SyncConversationTaskMessage.Builder bd = SyncConversationTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); SyncConversationTaskMessage req = bd.build(); //將訊息轉發送給手機客戶端 asyncTaskService.msgSend2Phone(ctx, req.getImUid(), EnumMsgType.SyncConversationTask, vo, req); } catch (Exception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 推送抖音會話列表 * @author wechat:happybabby110 * @blog http://www.wlkankan.cn */ @Async public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) { try { ConversationPushNoticeMessage req = vo.getContent().unpack(ConversationPushNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); log.debug(LocalDateTime.now()+" ConversationPushNoticeMessage 對應的執行緒名: "+Thread.currentThread().getName()); //訊息轉發到pc端 asyncTaskService.msgSend2pc(req.getImUid(), EnumMsgType.ConversationPushNotice, req); // 告訴客戶端訊息已收到 MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null); } catch (Exception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam,vo.getId(), e.getMessage()); } }