public ActionResult Delete(string mediaid)
        {
            WX_MediaManager manager = new WX_MediaManager();
            var             json    = JObject.Parse(new MediaService(WXAPP.AppId, WXAPP.AppSecret).Delete(mediaid));

            if (json["errcode"].ToString().Equals("0"))
            {
                var info = manager.GetByMediaId(mediaid, WXAPP.AppId);
                var r    = manager.Delete(info.MyMediaId);
                return(Json(r, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        public ActionResult SyncImage()
        {
            string  json = new MediaService(WXAPP.AppId, WXAPP.AppSecret).Get("image");
            JObject jo   = JObject.Parse(json);

            if (jo["errcode"] != null)
            {
                return(Content("<script> alert('错误:" + jo["errmsg"].ToString() + "');</script>"));
            }
            int total_count = Convert.ToInt32(jo["total_count"]); // 该类型素材总数
            int item_count  = Convert.ToInt32(jo["item_count"]);  // 本次获取的素材数量

            if (total_count > item_count)                         //如果总数大于单次获取的量,那么循环调用
            {
            }
            else
            {
                WX_MediaManager manager = new WX_MediaManager();
                foreach (var i in jo["item"].Children())
                {
                    var media = new WX_Media()
                    {
                        AppId        = WXAPP.AppId,
                        MediaId      = i["media_id"].ToString(),
                        MediaName    = i["name"].ToString(),
                        MediaType    = "image",
                        MediaContent = i["url"].ToString(),
                        //UploadTime = DateTime_EX.GetDateTime(Convert.ToInt32(i["update_Time"].ToString()))
                    };
                    var info = manager.GetByMediaId(media.MediaId, media.AppId);
                    if (info != null)
                    {
                        media.MyMediaId = info.MyMediaId;
                        var r = manager.Update(media);
                    }
                    else
                    {
                        var r = manager.Add(media);
                    }
                }
            }
            return(Json(json, JsonRequestBehavior.AllowGet));
        }