public void Statusnotify(string formUser, string toUser, string pass_ticket, BaseRequest baseReq, Action <StatusnotifyResponse> CallBack)
        {
            string url = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN&pass_ticket=" + pass_ticket;
            StatusnotifyRequest req = new StatusnotifyRequest
            {
                BaseRequest  = baseReq,
                ClientMsgId  = GetR(),
                FromUserName = formUser,
                ToUserName   = toUser,
                Code         = 3
            };
            string requestJson = JsonConvert.SerializeObject(req);

            http.Item.Request.HeadersDic["Accept"] = "application/json, text/plain, */*";
            http.Item.Request.HeadersDic["Origin"] = "https://wx2.qq.com";
            http.GetHtml(url, "post", requestJson, referer: "https://wx2.qq.com/", callBack: (x) => {
                var repJsonStr = x.response.DataString();
                if (repJsonStr == null)
                {
                    CallBack?.Invoke(null);
                }
                var rep = JsonConvert.DeserializeObject <StatusnotifyResponse>(repJsonStr);               //此处掉线时会报格式不正确
                CallBack?.Invoke(rep);
            });
        }
Beispiel #2
0
        public StatusnotifyResponse Statusnotify(string formUser, string toUser, string pass_ticket, BaseRequest baseReq)
        {
            SetHttpHeader("Accept", "application/json, text/plain, */*");
            SetHttpHeader("Connection", "keep-alive");
            SetHttpHeader("Accept-Encoding", "gzip, deflate, br");
            SetHttpHeader("Origin", this.root_uri);

            string url = this.root_uri + "/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN&pass_ticket=" + pass_ticket;
            StatusnotifyRequest req = new StatusnotifyRequest();

            req.BaseRequest  = baseReq;
            req.ClientMsgId  = getR();
            req.FromUserName = formUser;
            req.ToUserName   = toUser;
            req.Code         = 3;
            string requestJson = JsonConvert.SerializeObject(req);
            string repJsonStr  = PostString(url, requestJson);

            if (repJsonStr == null)
            {
                return(null);
            }
            var rep = JsonConvert.DeserializeObject <StatusnotifyResponse>(repJsonStr);

            return(rep);
        }
Beispiel #3
0
        public StatusnotifyResponse Statusnotify(string formUser, string toUser, string pass_ticket, BaseRequest baseReq)
        {
            SetHttpHeader("Accept", "application/json, text/plain, */*");
            SetHttpHeader("Connection", "keep-alive");
            SetHttpHeader("Accept-Encoding", "gzip, deflate, br");
            SetHttpHeader("Origin", "https://wx2.qq.com");

            string url = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN&pass_ticket=" + pass_ticket;
            StatusnotifyRequest req = new StatusnotifyRequest
            {
                BaseRequest  = baseReq,
                ClientMsgId  = GetR(),
                FromUserName = formUser,
                ToUserName   = toUser,
                Code         = 3
            };
            string requestJson = JsonConvert.SerializeObject(req);
            string repJsonStr  = PostString(url, requestJson);

            if (repJsonStr == null)
            {
                return(null);
            }
            var rep = JsonConvert.DeserializeObject <StatusnotifyResponse>(repJsonStr);//此处掉线时会报格式不正确

            return(rep);
        }
Beispiel #4
0
        public StatusnotifyResponse Statusnotify(string formUser, string toUser, string pass_ticket, BaseRequest baseReq)
        {
            string url = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxstatusnotify?lang=zh_CN&pass_ticket=" + pass_ticket;
            StatusnotifyRequest req = new StatusnotifyRequest();

            req.BaseRequest  = baseReq;
            req.ClientMsgId  = getTimestamp(DateTime.Now);
            req.FromUserName = formUser;
            req.ToUserName   = toUser;
            req.Code         = 3;
            string requestJson = JsonConvert.SerializeObject(req);
            string repJsonStr  = http.POST_UTF8String(url, requestJson);
            var    rep         = JsonConvert.DeserializeObject <StatusnotifyResponse>(repJsonStr);

            return(rep);
        }