日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

微信二次开发SDK使用教程--手机检测到有人点赞/取消点赞通知服务端

發(fā)布時間:2025/3/14 39 豆豆
生活随笔 收集整理的這篇文章主要介紹了 微信二次开发SDK使用教程--手机检测到有人点赞/取消点赞通知服务端 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

微信二次開發(fā)SDK使用教程--手機檢測到有人點贊/取消點贊通知服務(wù)端

case CircleLikeNotice : {//手機檢測到有人點贊/取消點贊通知
log.debug("socket:msgtype=CircleLikeNotice");
circleLikeNoticeHandler.handleMsg(ctx, msgVo);
break;
}

package com.jubotech.framework.netty.handler.socket;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.google.protobuf.util.JsonFormat;
import com.jubotech.business.web.domain.AccountInfo;
import com.jubotech.business.web.domain.WeChatAccountInfo;
import com.jubotech.business.web.service.AccountService;
import com.jubotech.business.web.service.WeChatAccountService;
import com.jubotech.framework.netty.common.Constant;
import com.jubotech.framework.netty.utils.MessageUtil;
import com.jubotech.framework.netty.utils.NettyConnectionUtil;

import Jubo.JuLiao.IM.Wx.Proto.CircleLikeNotice.CircleLikeNoticeMessage;
import Jubo.JuLiao.IM.Wx.Proto.TransportMessageOuterClass.EnumErrorCode;
import Jubo.JuLiao.IM.Wx.Proto.TransportMessageOuterClass.EnumMsgType;
import Jubo.JuLiao.IM.Wx.Proto.TransportMessageOuterClass.TransportMessage;
import io.netty.channel.ChannelHandlerContext;

@Service
public class CircleLikeNoticeHandler{
private final Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private WeChatAccountService weChatAccountService;
@Autowired
private AccountService accountService;

/*** 手機檢測到有人點贊/取消點贊通知* @author wechatno:tangjinjinwx* @param ctx* @param vo*/ public void handleMsg(ChannelHandlerContext ctx, TransportMessage vo) {try {CircleLikeNoticeMessage req = vo.getContent().unpack(CircleLikeNoticeMessage.class);log.info(JsonFormat.printer().print(req));// 把消息轉(zhuǎn)發(fā)給pc端// a、根據(jù)wechatId找到accountid// b、通過accountid找到account// c、通過account賬號找到通道WeChatAccountInfo account = weChatAccountService.findWeChatAccountInfoByWeChatId(req.getWeChatId());if (null != account && null != account.getAccountid() && 1 != account.getIslogined()) {AccountInfo accInfo = accountService.findAccountInfoByid(account.getAccountid());if (null != accInfo) {// 轉(zhuǎn)發(fā)給pc端ChannelHandlerContext chx = NettyConnectionUtil.getClientChannelHandlerContextByUserId(accInfo.getAccount());if (null != chx) {MessageUtil.sendJsonMsg(chx, EnumMsgType.CircleLikeNotice, NettyConnectionUtil.getNettyId(chx),null, req);}}// 告訴客戶端消息已收到MessageUtil.sendMsg(ctx, EnumMsgType.MsgReceivedAck, vo.getAccessToken(), vo.getId(), null);} else {// 對方不在線MessageUtil.sendErrMsg(ctx, EnumErrorCode.TargetNotOnline, Constant.ERROR_MSG_NOTONLINE);}} catch (Exception e) {e.printStackTrace();MessageUtil.sendErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);} }

}

項目地址:https://www.wuliaokankan.cn/url301/138.html
接口參考:http://www.yunlauncher.com/Blog/articles/119.html

轉(zhuǎn)載于:https://www.cnblogs.com/wuliaokankan/p/10607880.html

總結(jié)

以上是生活随笔為你收集整理的微信二次开发SDK使用教程--手机检测到有人点赞/取消点赞通知服务端的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。