日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

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

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

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));// 把消息轉發給pc端// a、根據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) {// 轉發給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

轉載于:https://www.cnblogs.com/wuliaokankan/p/10607880.html

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。