コード例 #1
0
        public List <common.MemberList> GetALLUser(common.Noumenon_GetGroupUser info, int WxorWx2, System.Net.CookieContainer myCookieContainer)
        {
            List <common.MemberList> Group_MemberList = new List <common.MemberList>();
            string  froupname = info.ToUserName;
            JObject job       = new JObject();

            if (WxorWx2 == 1) //老微信
            {
                job = common.WXService.SendPostRequest_Old(info.Url, info.PostData, myCookieContainer);
            }
            if (WxorWx2 == 2) //新微信
            {
                job = common.WXService.SendPostRequest(info.Url, info.PostData, myCookieContainer);
            }
            try
            {
                var     BaseResponse = job["BaseResponse"];
                var     Count        = job["Count"];
                var     ContactList  = job["ContactList"];
                var     arr          = ContactList.Last.ToString();
                JObject json1        = (JObject)JsonConvert.DeserializeObject(arr);
                JArray  MemberList   = (JArray)json1["MemberList"];
                for (int i = 0; i < MemberList.Count; i++)
                {
                    common.MemberList infoM = new common.MemberList();
                    infoM.UserName      = MemberList[i]["UserName"].ToString();
                    infoM.NickName      = MemberList[i]["NickName"].ToString();
                    infoM.GroupUserName = froupname;
                    if (!Group_MemberList.Contains(infoM))
                    {
                        Group_MemberList.Add(infoM);
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Group_MemberList);
        }
コード例 #2
0
        /// <summary>
        ///  获得请求群组的信息
        /// </summary>
        /// <param name="myCookiesContainer"></param>
        /// <param name="wxorwx2"></param>
        /// <returns></returns>
        public common.Noumenon_GetGroupUser GetGroupInfo(string GroupUserName, System.Net.CookieContainer myCookiesContainer, int wxorwx2, LoginRedirectResult loginRedirectResult)
        {
            string post_Uin       = loginRedirectResult.wxuin;
            string post_Sid       = loginRedirectResult.wxsid;
            string post_Skey      = loginRedirectResult.skey;
            string post_DeviceID  = CreateNewDeviceID();
            string post_GroupName = GroupUserName;
            string ur1l           = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxbatchgetcontact?type=ex&r=";

            if (wxorwx2 == 1)
            {
                ur1l = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxbatchgetcontact?type=ex&r=";
            }
            else
            {
                ur1l = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxbatchgetcontact?type=ex&r=";
            }

            common.Noumenon_GetGroupUser info = new common.Noumenon_GetGroupUser();
            info.Url        = String.Format(ur1l + "{0}&lang=zh_CN&pass_ticket={1}", getR().ToString(), loginRedirectResult.pass_ticket);
            info.ToUserName = GroupUserName;
            info.PostData   = "{\"BaseRequest\":{\"Uin\":" + post_Uin + ",\"Sid\":\"" + post_Sid + "\",\"Skey\":\"" + post_Skey + "\",\"DeviceID\":\"" + post_DeviceID + "\"},\"Count\":1,\"List\":[{\"UserName\":\"" + GroupUserName + "\",\"EncryChatRoomId\":\"" + "" + "\"}]}";
            return(info);
        }