Exemple #1
0
        /// <summary>
        /// 发送客服消息,图文类型
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static int SendCustom_news(string data)
        {
            errCode _err = requestCustomSend(data);

            if (_err.errcode > 0)
            {
                B_W_Exception.AddExcep("wechatHandle >> SendCustom_news", "客服图文消息发送失败", _err.errcode.ToString());
            }
            return(_err.errcode);
        }
Exemple #2
0
        /// <summary>
        /// 用OpenID列表 群发图文消息
        /// </summary>
        /// <param name="StringOpenid"></param>
        /// <param name="media"></param>
        /// <returns></returns>
        public static int SendCustom_news_ArrayString(string mediaId, string StringOpenid)
        {
            string  Jsonfile = "{\"touser\": [ " + StringOpenid + "],\"mpnews\": { \"media_id\": \"" + mediaId + "\"},\"msgtype\": \"mpnews\"}";
            errCode _err     = requestMessSend(Jsonfile);

            if (_err.errcode > 0)
            {
                B_W_Exception.AddExcep("wechatHandle >> SendCustom_news", "客服图文消息发送失败", _err.errcode.ToString());
            }
            return(_err.errcode);
        }
Exemple #3
0
        /// <summary>
        /// 按照组发送图文消息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int SendCustom_news_group(string mediaId)
        {
            string  json = "{\"filter\":{ \"group_id\":\"0\" },\"mpnews\":{ \"media_id\":\"" + mediaId + "\" }, \"msgtype\":\"mpnews\"}";
            errCode _err = requestMesssendall(json);

            if (_err.errcode > 0)
            {
                B_W_Exception.AddExcep("wechatHandle >> SendCustom_news", "客服图文消息发送失败", _err.errcode.ToString());
            }
            return(_err.errcode);
        }
Exemple #4
0
        /// <summary>
        /// 高级接口 - 根据分组进行群发【订阅号与服务号认证后均可用】
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public static errCode requestMesssendall(string data)
        {
            string url, token;

            token = GetAccessToken(false);
            url   = "https://api.weixin.qq.com/cgi-bin/message/mass/sendall?access_token={0}";
            string  _err     = wechatRequest.Post(string.Format(url, token), data);
            errCode _errCode = JsonConvert.DeserializeObject <errCode>(_err);

            return(_errCode);
        }
Exemple #5
0
        /// <summary>
        /// 发送客服消息,文本类型
        /// </summary>
        /// <param name="touser"></param>
        /// <param name="content"></param>
        /// <returns></returns>
        public static int SendCustom_text(string OpenId, string content)
        {
            string data = "{\"touser\":\""
                          + OpenId + "\",\"msgtype\":\"text\",\"text\":{\"content\":\""
                          + content + "\"}}";
            errCode _err = requestCustomSend(data);

            if (_err.errcode > 0)
            {
                B_W_Exception.AddExcep("wechatHandle >> SendCustom_text", "客服消息发送失败", _err.errcode.ToString());
            }
            return(_err.errcode);
        }