调用群发接口没问题,返回数据中有media_id,然后使用这个id群发,或预览时返回的数据都是44003 图文消息为空,最主要是预览文本也是一样的返回值! 贴代码如下
Wxapi.UpLoadInfo info = Wxapi.WeiXinHelper.WxUpLoad(@"d:\1.jpg", AccessToken.Instance.Access_Token, MediaType.image); // 调用图片上传接口上传图片获取media_id // 拼接群发json StringBuilder sbArticlesJson = new StringBuilder(); sbArticlesJson.Append("{"articles":["); sbArticlesJson.Append("{"); sbArticlesJson.Append(""thumb_media_id":"" + info.media_id + "","); sbArticlesJson.Append(""author":"" + "dark_yx"+ "","); sbArticlesJson.Append(""title":"" + "title" + "","); sbArticlesJson.Append(""content_source_url":"" +"http://baidu.com"+ "","); sbArticlesJson.Append(""content":"" +"测试数据\b加\b" + "","); sbArticlesJson.Append(""digest":"" + "测试"+ "","); sbArticlesJson.Append(""show_cover_pic":"1"}"); sbArticlesJson.Append("]}"); // 这里的result是获取到media_id的 string result = Wxapi.HttpClientHelper.PostResponse(Wxapi.WeiXinConst.WeiXin_Article_Url, sbArticlesJson.ToString()); // 调试使用的openid string openid = "oYq5_juOqEXEesH_Sb4gNFSj6xZU"; // 拼接预览json string articleid = Wxapi.JsonHelp.GetJsonValue(result, "media_id"); StringBuilder testJson = new StringBuilder(); testJson.Append("{"touser":"" + openid + "", "); testJson.Append(""mpnews":{ "); testJson.Append(""media_id":"" + articleid + """); testJson.Append("}, "msgtype":"mpnews"}"); // 这里的result就是44003 string result2 = Wxapi.HttpClientHelper.PostResponse(Wxapi.WeiXinConst.WeiXin_Article_Url, testJson.ToString());
解决方案