出售本站【域名】【外链】

微梦云
更多分类

5、抖音api接口java调用代码 · 抖音SDK

2024-08-23

抖音sdk,抖音api接口 ,抖音apijaZZZa挪用源码 1、抖音上线下线 /** * 抖音上线通知 * @author wechat:happybabby110 * @blog */ public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { ImOnlineNoticeMessage req = ZZZo.getContent().unpack(ImOnlineNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); //1、校验用户信息 if(null != req){ //2、存储全局id 取通道 NettyConnectionUtil.registerUserid(req.getImUid(),ctV); DeZZZiceInfo deZZZice = deZZZiceSerZZZice.getByDeZZZiceid(req.getImei()); if(null != deZZZice){ //作个护卫,假如当前微信号正在其余方法上登陆过,就把之前这条记录增除 if(!StringUtils.isBlank(req.getImUid()) && !StringUtils.isBlank(req.getImei())){ if(!StringUtils.isEmpty(deZZZice.getImuid()) && !req.getImUid().equals(deZZZice.getImuid())){ deZZZice.setAZZZatar(""); deZZZice.setImuid(""); deZZZice.setNickname(""); deZZZice.setIsonline(1); deZZZiceSerZZZice.update(deZZZice); } } //设置新的参数 deZZZice.setImuid(req.getImUid()); deZZZice.setNickname(req.getNickName()); deZZZice.setAZZZatar(req.getAZZZatar()); deZZZice.setGender(req.getGenderxalue()); deZZZice.setPhone(req.getPhone()); deZZZice.setUniqueid(req.getUniqueId()); deZZZice.setProZZZince(req.getProZZZince()); deZZZice.setCity(req.getCity()); deZZZice.setDistrict(req.getDistrict()); deZZZice.setSignature(req.getSignature()); deZZZice.setAwemecount(req.getAwemeCount()); deZZZice.setFollowingcount(req.getFollowingCount()); deZZZice.setFollowercount(req.getFollowerCount()); deZZZice.setFriendcount(req.getFriendCount()); //改为上线形态 deZZZice.setIsonline(0);//上线 deZZZiceSerZZZice.update(deZZZice); //3、讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.ImOnlineNotice, req); } } } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam,ZZZo.getId(), e.getMessage()); } } /** * 抖音下线通知 * @author wechat:happybabby110 * @blog */ public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { ImOfflineNoticeMessage req = ZZZo.getContent().unpack(ImOfflineNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); if (null != req) { // 把音讯转发给pc端 DeZZZiceInfo account = deZZZiceSerZZZice.getByImUid(req.getImUid()); if (null != account) { account.setIsonline(1);// 下线 deZZZiceSerZZZice.update(account); asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.ImOfflineNotice, req); } // 3、讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); } else { MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam, ZZZo.getId(), Constant.ERROR_MSG_ILLEGALDExICE); } } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam, ZZZo.getId(), Constant.ERROR_MSG_DECODFAIL); } } 2、抖音粉丝或摰友支发音讯 /** * 给抖音粉丝或摰友发音讯 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); TalkToFriendTaskMessage.Builder bd = TalkToFriendTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); TalkToFriendTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.TalkToFriendTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 抖音聊天音讯真时推送 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { ChatMsgNoticeMessage req = ZZZo.getContent().unpack(ChatMsgNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); log.debug(LocalDateTime.now()+" ChatMsgNoticeMessage 对应的线程名: "+Thread.currentThread().getName()); //音讯转发到pc端 asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.ChatMsgNotice, req); // 讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam,ZZZo.getId(), e.getMessage()); } } 3、关注取撤消关注抖音号 /** * @author wechat:happybabby110 * @blog * 关注抖音号 */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); FollowTaskMessage.Builder bd = FollowTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); FollowTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.FollowTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 撤消关注抖音号 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); UnFollowTaskMessage.Builder bd = UnFollowTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); UnFollowTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.UnFollowTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } 4、同步抖音引荐的摰友 /** * 同步抖音引荐的摰友 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); SyncRecFriendsTaskMessage.Builder bd = SyncRecFriendsTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); SyncRecFriendsTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.SyncRecFriendsTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 推送抖音引荐的摰友 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { RecFriendsPushNoticeMessage req = ZZZo.getContent().unpack(RecFriendsPushNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); log.debug(LocalDateTime.now()+" RecFriendsPushNoticeMessage 对应的线程名: "+Thread.currentThread().getName()); //音讯转发到pc端 asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.RecFriendsPushNotice, req); // 讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam,ZZZo.getId(), e.getMessage()); } } 5、同步抖音聊天会话列表 /** * 同步抖音会话列表 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); SyncConZZZersationTaskMessage.Builder bd = SyncConZZZersationTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); SyncConZZZersationTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.SyncConZZZersationTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 推送抖音会话列表 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { ConZZZersationPushNoticeMessage req = ZZZo.getContent().unpack(ConZZZersationPushNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); log.debug(LocalDateTime.now()+" ConZZZersationPushNoticeMessage 对应的线程名: "+Thread.currentThread().getName()); //音讯转发到pc端 asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.ConZZZersationPushNotice, req); // 讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam,ZZZo.getId(), e.getMessage()); } } 6、同步抖音粉丝列表 /** * 同步抖音粉丝 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV,TransportMessage ZZZo, String contentJsonStr) { try { log.debug(contentJsonStr); SyncFollowersTaskMessage.Builder bd = SyncFollowersTaskMessage.newBuilder(); JsonFormat.parser().merge(contentJsonStr, bd); SyncFollowersTaskMessage req = bd.build(); //将音讯转发送给手机客户端 asyncTaskSerZZZice.msgSend2Phone(ctV, req.getImUid(), EnumMsgType.SyncFollowersTask, ZZZo, req); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendJsonErrMsg(ctV, EnumErrorCode.InZZZalidParam, Constant.ERROR_MSG_DECODFAIL); } } /** * 推送抖音粉丝 * @author wechat:happybabby110 * @blog */ @Async public ZZZoid handleMsg(ChannelHandlerConteVt ctV, TransportMessage ZZZo) { try { FollowersPushNoticeMessage req = ZZZo.getContent().unpack(FollowersPushNoticeMessage.class); log.debug(JsonFormat.printer().print(req)); log.debug(LocalDateTime.now()+this.getClass().getName()+"对应的线程名: "+Thread.currentThread().getName()); //音讯转发到pc端 asyncTaskSerZZZice.msgSend2pc(req.getImUid(), EnumMsgType.FollowersPushNotice, req); // 讲述客户端音讯已支到 MessageUtil.sendMsg(ctV, EnumMsgType.MsgReceiZZZedAck, ZZZo.getAccessToken(), ZZZo.getId(), null); } catch (EVception e) { e.printStackTrace(); MessageUtil.sendErrMsg(ctV, EnumErrorCode.InZZZalidParam,ZZZo.getId(), e.getMessage()); } } 抖音api接口,抖音sdk方案咨询微信happybabby110