public static async Task <WxJsonResult> UpdateForeverNewsAsync(string accessTokenOrAppId, string mediaId, int?index, NewsModel news, int timeOut = Config.TIME_OUT) { return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken => { string url = Config.ApiMpHost + "/cgi-bin/material/update_news?access_token={0}"; var data = new { media_id = mediaId, index = index, articles = news }; return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync <WxJsonResult>(accessToken, url, data, CommonJsonSendType.POST, timeOut).ConfigureAwait(false); }, accessTokenOrAppId).ConfigureAwait(false)); }
/// <summary> /// 修改永久图文素材 /// </summary> /// <param name="accessTokenOrAppId"></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 accessTokenOrAppId, string mediaId, int?index, NewsModel news, int timeOut = Config.TIME_OUT) { return(ApiHandlerWapper.TryCommonApi(accessToken => { 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); }, accessTokenOrAppId)); }
/// <summary> /// 修改永久图文素材 /// </summary> /// <param name="accessTokenOrAppId"></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) { 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(ApiHelper.Post <WxJsonResult>(accessToken, url, data)); }