//图片 WXAllMsg model = new WXAllMsg() { filter = new WXFiter() { group_id = gid, is_to_all = true }, msgtype = "image", image = new WXMsgMedia() { media_id = obj["media_id"].ToString() } }; //图文 WXAllMsg model = new WXAllMsg() { filter = new WXFiter() { group_id = gid, is_to_all = true }, msgtype = "mpnews", mpnews = new WXMsgMedia() { media_id = "" } }; public string SendAll(M_WXAllMsg model, bool flag = true) { string result = APIHelper.GetWebResult(apiurl + "message/mass/sendall?access_token=" + AccessToken, "POST", model.ToJson()); if (result.Contains("errcode") && flag) { ErroMsg(result); } return(result); }
//群发文本 public string SendAll(string content, string gid = "") { M_WXAllMsg model = new M_WXAllMsg() { filter = new M_WXFiter() { group_id = gid, is_to_all = string.IsNullOrEmpty(gid) }, text = new WXMsgText() { content = content }, msgtype = "text" }; //string data = JsonConvert.SerializeObject(model); //return GetWebResult(apiurl + "message/mass/sendall?access_token=" + AccessToken, "POST", data); return(SendAll(model)); }