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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

微信客服系统开发SDK使用教程- 拉取当前微信个人号列表请求(立即)

發布時間:2025/4/14 windows 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 微信客服系统开发SDK使用教程- 拉取当前微信个人号列表请求(立即) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

微信客服系統開發SDK- 拉取當前微信個人號列表請求(立即)

case "GetWeChatsReq": {// 拉取當前微信個人號列表請求(立即)
log.debug("websocket:msgtype=GetWeChatsReq。。。。。");
getWeChatsReqWebsocketHandler.handleMsg(ctx, vo,contentJsonStr);
break;
}

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

import java.util.ArrayList;
import java.util.List;

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 Jubo.JuLiao.IM.Wx.Proto.GetWeChatsReq.GetWeChatsReqMessage;
import Jubo.JuLiao.IM.Wx.Proto.GetWeChatsRsp.GetWeChatsRspMessage;
import Jubo.JuLiao.IM.Wx.Proto.GetWeChatsRsp.WeChatRspMessage;
import Jubo.JuLiao.IM.Wx.Proto.TransportMessageOuterClass.EnumAccountType;
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 GetWeChatsReqWebsocketHandler{
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, String contentJsonStr) {
try {
log.info(contentJsonStr);
GetWeChatsReqMessage.Builder bd = GetWeChatsReqMessage.newBuilder();
JsonFormat.parser().merge(contentJsonStr, bd);
GetWeChatsReqMessage req = bd.build();
//1、校驗用戶信息
log.info("賬號:"+req.getUnionId());
if(null != req){
Integer id = (int) req.getUnionId();

AccountInfo account = accountService.findAccountInfoByid(id);if(null != account){List<WeChatAccountInfo> list = weChatAccountService.findWeChatAccountInfo(account.getCid(), account.getId());

// if(null == list || list.isEmpty()){
// list = weChatAccountService.findWeChatAccountInfo(account.getCid(), null);
// }
List weChatrspList = getWechatList(list);

GetWeChatsRspMessage.Builder builder = GetWeChatsRspMessage.newBuilder();builder.setUnionId(req.getUnionId());builder.setAccountType(EnumAccountType.SubUser);builder.setSupplierId(account.getCid());if(null != weChatrspList && weChatrspList.size()>0){builder.addAllWeChats(weChatrspList);}GetWeChatsRspMessage resp = builder.build();//3、告訴PC客戶端消息已收到MessageUtil.sendJsonMsg(ctx, EnumMsgType.GetWeChatsRsp, vo.getAccessToken(), vo.getId(), resp);}else{MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam,Constant.ERROR_MSG_PARAMERROR);}} } catch (Exception e) {e.printStackTrace();MessageUtil.sendJsonErrMsg(ctx, EnumErrorCode.InvalidParam, Constant.ERROR_MSG_DECODFAIL);} }/*** 封裝返回對象* @param list* @return*/ private static List<WeChatRspMessage> getWechatList(List<WeChatAccountInfo> list){List<WeChatRspMessage> weChatrspList = null;if(null != list && list.size()>0){weChatrspList = new ArrayList<>();for(int i=0;i<list.size();i++){WeChatAccountInfo info = list.get(i);boolean online = false;if(null != info.getIsonline() && info.getIsonline()==0){online = true;}boolean logined = false;if(null != info.getIslogined() && info.getIslogined()==0){logined = true;}WeChatRspMessage.Builder builder = WeChatRspMessage.newBuilder();if(null != info.getWechatid()){builder.setWeChatId(info.getWechatid());}if(null != info.getWechatno()){builder.setWeChatNo(info.getWechatno());}if(null !=info.getWechatnick()){builder.setWeChatNick(info.getWechatnick());}if(null != info.getAvatar()){builder.setAvatar(info.getAvatar());}if(null != info.getCountry()){builder.setCountry(info.getCountry());}if(null != info.getProvince()){builder.setProvince(info.getProvince());}if(null != info.getCity()){builder.setCity(info.getCity());}if(null != info.getGender()){builder.setGenderValue(info.getGender());}if(null != info.getLogin_time()){builder.setLoginTime(info.getLogin_time().getTime());}if(null != info.getModify_time()){builder.setModifyTime(info.getModify_time().getTime());}if(null != info.getDeviceid()){builder.setDeviceName(info.getDeviceid());}if(null != info.getAccountid()){builder.setLoginUnionId(info.getAccountid());}builder.setIsOnline(online);builder.setIsLogined(logined);builder.setIsDelete(false);builder.setIsUpgrading(false);weChatrspList.add(builder.build());}}return weChatrspList; }

}

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

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

總結

以上是生活随笔為你收集整理的微信客服系统开发SDK使用教程- 拉取当前微信个人号列表请求(立即)的全部內容,希望文章能夠幫你解決所遇到的問題。

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