Exemple #1
0
        public SendMsgImgResponse SendMsgImg(ImgMsg msg, string pass_ticket, BaseRequest baseReq)
        {
            string url = "https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg?fun=async&f=json&pass_ticket={0}";

            url = string.Format(url, pass_ticket);
            SendMsgImgRequest req = new SendMsgImgRequest();

            req.BaseRequest = baseReq;
            req.Msg         = msg;
            req.Scene       = 0;
            string requestJson = JsonConvert.SerializeObject(req);
            string repJsonStr  = http.POST_UTF8String(url, requestJson);
            var    rep         = JsonConvert.DeserializeObject <SendMsgImgResponse>(repJsonStr);

            return(rep);
        }
Exemple #2
0
        public SendMsgImgResponse SendMsgImg(ImgMsg msg, string pass_ticket, BaseRequest baseReq)
        {
            string url = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg?fun=async&f=json&lang=zh_CN&pass_ticket={0}";

            url = string.Format(url, pass_ticket);
            SendMsgImgRequest req = new SendMsgImgRequest
            {
                BaseRequest = baseReq,
                Msg         = msg,
                Scene       = 0
            };
            string requestJson = JsonConvert.SerializeObject(req);
            string repJsonStr  = PostString(url, requestJson);

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

            return(rep);
        }
        public void SendMsgImg(ImgMsg msg, string pass_ticket, BaseRequest baseReq, Action <SendMsgImgResponse> CallBack)
        {
            string url = "https://wx2.qq.com/cgi-bin/mmwebwx-bin/webwxsendmsgimg?fun=async&f=json&lang=zh_CN&pass_ticket={0}";

            url = string.Format(url, pass_ticket);
            SendMsgImgRequest req = new SendMsgImgRequest
            {
                BaseRequest = baseReq,
                Msg         = msg,
                Scene       = 0
            };
            string requestJson = JsonConvert.SerializeObject(req);

            http.GetHtml(url, "post", requestJson, callBack: (x) => {
                var repJsonStr = x.response.DataString();
                if (repJsonStr == null)
                {
                    CallBack?.Invoke(null);
                }
                var rep = JsonConvert.DeserializeObject <SendMsgImgResponse>(repJsonStr);
                CallBack?.Invoke(rep);
            });
        }