Ejemplo n.º 1
0
        public bool SendDiscussReplyNotify(string toUserOpenId, string title, string content)
        {
            var message = new WeChatMessageContext <DiscussReplyNotifyData>()
            {
                touser      = toUserOpenId,
                template_id = "-zecjwuk6Z0uN1txUSwvgXKmaek081c1Y9t6mqAn6ck",
                page        = "pages/discovery/discovery",
                data        = new DiscussReplyNotifyData()
                {
                    thing1 = new Value(title),
                    thing2 = new Value(content),
                    date3  = new Value(DateTime.Now.ToString("f"))
                }
            };

            var token = GetAccessToken();

            if (token == null || token.Errcode != 0)
            {
                return(false);
            }

            string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={0}", token.Access_token);

            var response = HttpHelper.HttpPost <object, WeChatResponseDTO>(url, message, 20);

            return(response != null && response.Errcode == 0);
        }
Ejemplo n.º 2
0
        public bool SendDiscussReplyNotify(string toUserOpenId, string title, string content)
        {
            var message = new WeChatMessageContext <DiscussReplyNotifyData>()
            {
                touser      = toUserOpenId,
                template_id = "59880ab542241403ede33bb4c64f0166",
                page        = "pages/discovery/discovery",
                data        = new DiscussReplyNotifyData()
                {
                    thing1 = new Value(title),
                    thing2 = new Value(content),
                    date3  = new Value(DateTime.Now.ToString("f"))
                }
            };

            var token = GetAccessToken();

            if (token == null || token.Errcode != 0)
            {
                return(false);
            }

            string url = string.Format("https://api.q.qq.com/api/json/subscribe/SendSubscriptionMessage?access_token={0}", token.Access_token);

            var response = HttpHelper.HttpPost <object, WeChatResponseDTO>(url, message, 20);

            return(response != null && response.Errcode == 0);
        }
Ejemplo n.º 3
0
        public bool SendMomentDiscussNotify(string toUserOpenId, string title, string content)
        {
            var message = new WeChatMessageContext <DiscussNotifyData>()
            {
                touser      = toUserOpenId,
                template_id = "GytyYcEW0BqLnACK9hFZMMXbvOZc2oq5DQjdJ65sRFI",
                page        = "pages/discovery/discovery",
                data        = new DiscussNotifyData()
                {
                    thing1 = new Value(title),
                    thing2 = new Value(content),
                    time3  = new Value(DateTime.Now.ToString("f"))
                }
            };

            var token = GetAccessToken();

            if (token == null || token.Errcode != 0)
            {
                return(false);
            }

            string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={0}", token.Access_token);

            var response = HttpHelper.HttpPost <object, WeChatResponseDTO>(url, message, 20);

            return(response != null && response.Errcode == 0);
        }