/// <summary> /// 根据OpenID列表群发视频消息【订阅号不可用,服务号认证后可用】 /// 注意:群发视频时需要先调用GetVideoMediaIdResult接口获取专用的MediaId然后进行群发 /// </summary> /// <param name="accessTokenOrAppId"></param> /// <param name="title"></param> /// <param name="mediaId"></param> /// <param name="openIds">openId字符串数组</param> /// <param name="description"></param> /// <param name="timeOut">代理请求超时时间(毫秒)</param> /// <returns></returns> public static SendResult SendVideoGroupMessageByOpenId(string accessToken, string title, string description, string mediaId, params string[] openIds) { const string urlFormat = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token={0}"; BaseGroupMessageDataByOpenId baseData = new GroupMessageByOpenId_MpVideoData() { touser = openIds, video = new GroupMessageByOpenId_Video() { title = title, description = description, media_id = mediaId }, msgtype = "mpvideo" }; return(ApiHelper.Post <SendResult>(accessToken, urlFormat, baseData)); }
/// <summary> /// 【异步方法】根据OpenID列表群发视频消息【订阅号不可用,服务号认证后可用】 /// 注意:群发视频时需要先调用GetVideoMediaIdResult接口获取专用的MediaId然后进行群发 /// </summary> /// <param name="accessTokenOrAppId"></param> /// <param name="title"></param> /// <param name="mediaId"></param> /// <param name="openIds">openId字符串数组</param> /// <param name="description"></param> /// <param name="timeOut">代理请求超时时间(毫秒)</param> /// <returns></returns> public static async Task <SendResult> SendVideoGroupMessageByOpenIdAsync(string accessTokenOrAppId, string title, string description, string mediaId, int timeOut = Config.TIME_OUT, params string[] openIds) { return(await ApiHandlerWapper.TryCommonApiAsync(accessToken => { const string urlFormat = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token={0}"; BaseGroupMessageDataByOpenId baseData = new GroupMessageByOpenId_MpVideoData() { touser = openIds, video = new GroupMessageByOpenId_Video() { title = title, description = description, media_id = mediaId }, msgtype = "mpvideo" }; return Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync <SendResult>(accessToken, urlFormat, baseData, timeOut: timeOut); }, accessTokenOrAppId)); }
/// <summary> /// 根据OpenID列表群发视频消息【订阅号不可用,服务号认证后可用】 /// 注意:群发视频时需要先调用GetVideoMediaIdResult接口获取专用的MediaId然后进行群发 /// </summary> /// <param name="accessTokenOrAppId">AccessToken或AppId(推荐使用AppId,需要先注册)</param> /// <param name="title"></param> /// <param name="mediaId"></param> /// <param name="openIds">openId字符串数组</param> /// <param name="description"></param> /// <param name="timeOut">代理请求超时时间(毫秒)</param> /// <returns></returns> public static SendResult SendVideoGroupMessageByOpenId(string accessTokenOrAppId, string title, string description, string mediaId, int timeOut = Config.TIME_OUT, params string[] openIds) { return(ApiHandlerWapper.TryCommonApi(accessToken => { string urlFormat = Config.ApiMpHost + "/cgi-bin/message/mass/send?access_token={0}"; BaseGroupMessageDataByOpenId baseData = new GroupMessageByOpenId_MpVideoData() { touser = openIds, video = new GroupMessageByOpenId_Video() { title = title, description = description, media_id = mediaId }, msgtype = "mpvideo" }; return CommonJsonSend.Send <SendResult>(accessToken, urlFormat, baseData, timeOut: timeOut); }, accessTokenOrAppId)); }
/// <summary> /// 根据OpenID列表群发视频消息【订阅号不可用,服务号认证后可用】 /// </summary> /// <param name="accessToken"></param> /// <param name="title"></param> /// <param name="mediaId"></param> /// <param name="openIds">openId字符串数组</param> /// <param name="description"></param> /// 注意mediaId和content不可同时为空 /// <returns></returns> public static SendResult SendVideoGroupMessageByOpenId(string accessToken, string title, string description, string mediaId, params string[] openIds) { const string urlFormat = "https://api.weixin.qq.com/cgi-bin/message/mass/send?access_token={0}"; BaseGroupMessageDataByOpenId baseData = new GroupMessageByOpenId_MpVideoData() { touser = openIds, video = new GroupMessageByOpenId_Video() { title = title, description = description, media_id = mediaId }, msgtype = "video" }; return CommonJsonSend.Send<SendResult>(accessToken, urlFormat, baseData); }