示例#1
0
 /// <summary>
 /// 【异步方法】发送图文消息
 /// </summary>
 /// <param name="accessTokenOrAppKey">调用接口凭证(AccessToken)或AppKey(根据AccessTokenContainer.BuildingKey(corpId, corpSecret)方法获得)</param>
 /// <param name="chatId">会话id</param>
 /// <param name="news">图文消息</param>
 /// <param name="safe">表示是否是保密消息,0表示否,1表示是,默认0</param>
 /// <param name="timeOut">代理请求超时时间(毫秒)</param>
 /// <returns></returns>
 public static async Task <WorkJsonResult> SendChatNewsMessageAsync(string accessTokenOrAppKey, string chatId, Chat_News news, int safe = 0, int timeOut = Config.TIME_OUT)
 {
     return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken =>
     {
         var data = new SendNewsMessageData(chatId, news, safe);
         return await CommonJsonSend.SendAsync <WorkJsonResult>(accessToken, _urlFormatSend, data, CommonJsonSendType.POST, timeOut);
     }, accessTokenOrAppKey));
 }
示例#2
0
 public static WorkJsonResult SendChatNewsMessage(string accessTokenOrAppKey, string chatId, Chat_News news, int safe = 0, int timeOut = WxConfig.TIME_OUT)
 {
     return(ApiHandlerWapper.TryCommonApi(accessToken =>
     {
         var data = new SendNewsMessageData(chatId, news, safe);
         return CommonJsonSend.Send <WorkJsonResult>(accessToken, _urlFormatSend, data, CommonJsonSendType.POST, timeOut);
     }, accessTokenOrAppKey));
 }