Ejemplo n.º 1
0
        /// <summary>
        /// 发送文本。
        /// </summary>
        /// <param name="openId"></param>
        /// <param name="text"></param>
        /// <returns></returns>
        public string SendText(string openId, string text)
        {
            string access_token = this.Get_Access_Token();
            string url          = string.Format(CUSTOM_SEND_URL, access_token);
            var    json         = new
            {
                touser  = openId,
                msgtype = "text",
                text    = new
                {
                    content = text
                }
            };
            string respJson = MyHttpUtility.SendPost(url, JsonConvert.SerializeObject(json));

            return(respJson);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 群发图片
        /// </summary>
        /// <param name="openIdList"></param>
        /// <param name="media_id"></param>
        /// <returns></returns>
        public string Image(int tagId, string media_id)
        {
            var data = new
            {
                filter = new
                {
                    is_to_all = false,
                    tag_id    = tagId
                },
                image = new
                {
                    media_id = media_id,
                },
                msgtype = "image"
            };
            string url      = string.Format(MESSAGE_SENDALL_URL, this.Get_Access_Token());
            string respJson = MyHttpUtility.SendPost(url, JsonConvert.SerializeObject(data));

            return(respJson);
        }
Ejemplo n.º 3
0
        public string Send(string MediaId, int tagId)
        {
            var data = new
            {
                filter = new
                {
                    is_to_all = false,
                    tag_id    = tagId
                },
                mpnews = new
                {
                    media_id = MediaId,
                },
                msgtype             = "mpnews",
                send_ignore_reprint = 0,
            };
            string url      = string.Format(MESSAGE_SENDALL_URL, this.Get_Access_Token());
            string respJson = MyHttpUtility.SendPost(url, JsonConvert.SerializeObject(data));

            return(respJson);
        }