/// <summary>
 /// 修改永久图文素材
 /// </summary>
 /// <param name="accessToken"></param>
 /// <param name="mediaId">要修改的图文消息的id</param>
 /// <param name="index">要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为0</param>
 /// <param name="timeOut">代理请求超时时间(毫秒)</param>
 /// <param name="news">图文素材</param>
 /// <returns></returns>
 public static WxJsonResult UpdateForeverNews(string accessToken, string mediaId, int? index, NewsModel news, int timeOut = Config.TIME_OUT)
 {
     string url = "https://api.weixin.qq.com/cgi-bin/material/update_news?access_token={0}";
     var data = new
     {
         media_id = mediaId,
         index = index,
         articles = news
     };
     return CommonJsonSend.Send<WxJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut);
 }
        private SendResult push(wx_requestRule rule, string[] openIds)
        {
            SendResult result = new SendResult();
            var contentlist = wx_requestRuleContentService.instance().GetByRuleID(rule.ID);
            switch (rule.responseType)
            {

                //文本1,图文2,语音3,视频4
                case 1:
                    result = Services.Weixin.CommonApi.SendTextGroupMessageByOpenId(GetToken(),
                       contentlist.First().rContent, openIds);
                    break;
                case 2:

                    //var newtemp = Services.Weixin.CommonApi.Upload(GetToken(), Entity.Weixin.UploadMediaFileType.news, contentlist.First().picUrl);
                    var file = @"D:\1.jpg";
                    var fileresult = Services.Weixin.CommonApi.UploadForeverMedia(GetToken(), file);
                    var new1 = new NewsModel()
                    {
                        author = "test",
                        content = "test",
                        content_source_url = "http://qy.weiweihi.com/Content/Images/app/qyhelper.png",
                        digest = "test",
                        show_cover_pic = "1",
                        thumb_media_id = fileresult.media_id,
                        title = "test"
                    };

                    var new2 = new NewsModel()
                    {
                        author = "test",
                        content = "test111",
                        content_source_url = "http://qy.weiweihi.com/Content/Images/app/qyhelper.png",
                        digest = "test",
                        show_cover_pic = "1",
                        thumb_media_id = fileresult.media_id,
                        title = "test"
                    };

                    var newtemp = Services.Weixin.CommonApi.UploadNews(GetToken(), 10000, new1, new2);

                    result = Services.Weixin.CommonApi.SendGroupMessageByOpenId(GetToken(), GroupMessageType.mpnews, newtemp.media_id, openIds);



                    break;
                case 3:
                    var voicetempre = Services.Weixin.CommonApi.Upload(GetToken(), Entity.Weixin.UploadMediaFileType.voice, contentlist.First().mediaUrl);
                    if (voicetempre.errcode == Entity.Weixin.ReturnCode.请求成功)
                    {
                        result = Services.Weixin.CommonApi.SendGroupMessageByOpenId(GetToken(),
                                                                               GroupMessageType.voice,
                                                                               voicetempre.media_id,
                                                                               openIds);
                    }
                    break;
                case 4:
                    var videotempre = Services.Weixin.CommonApi.Upload(GetToken(), Entity.Weixin.UploadMediaFileType.video, contentlist.First().meidaHDUrl);
                    if (videotempre.errcode == Entity.Weixin.ReturnCode.请求成功)
                    {
                        result = Services.Weixin.CommonApi.SendVideoGroupMessageByOpenId(GetToken(),
                                                                                contentlist.First().rContent,
                                                                                contentlist.First().rContent2,
                                                                                videotempre.media_id,
                                                                                openIds);
                    }
                    break;

            }
            return result;
        }