Esempio n. 1
0
        public static WxJsonResult DelPrivateTemplate(string template_id)
        {
            string       accessToken = WxTemplateSendHelp.GetAccessToken();
            WxJsonResult result;

            if (string.IsNullOrEmpty(accessToken) || accessToken.Contains("errcode"))
            {
                result = new WxJsonResult
                {
                    errcode = 40001,
                    errmsg  = "Token获取失败"
                };
            }
            else
            {
                string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token={0}";
                var    data      = new
                {
                    template_id
                };
                WxJsonResult wxJsonResult = WxTemplateSendHelp.SendCommonJson <WxJsonResult>(accessToken, urlFormat, data);
                result = wxJsonResult;
            }
            return(result);
        }
Esempio n. 2
0
        public static WxJsonResult SetIndustry()
        {
            string       accessToken = WxTemplateSendHelp.GetAccessToken();
            WxJsonResult result;

            if (string.IsNullOrEmpty(accessToken) || accessToken.Contains("errcode"))
            {
                result = new WxJsonResult
                {
                    errcode = 40001,
                    errmsg  = "令牌获取失败"
                };
            }
            else
            {
                string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token={0}";
                var    data      = new
                {
                    industry_id1 = "1",
                    industry_id2 = "2"
                };
                WxJsonResult wxJsonResult = WxTemplateSendHelp.SendCommonJson <WxJsonResult>(accessToken, urlFormat, data);
                result = wxJsonResult;
            }
            return(result);
        }
Esempio n. 3
0
        public static AddtemplateJsonResult AddtemplateJsonResult(string accessToken, string template_id_short)
        {
            string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token={0}";
            var    data      = new
            {
                template_id_short
            };

            return(WxTemplateSendHelp.SendCommonJson <AddtemplateJsonResult>(accessToken, urlFormat, data));
        }
Esempio n. 4
0
        public static GetPrivateTemplateJsonResult GetPrivateTemplateJsonResult(string accessToken)
        {
            string urlFormat = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token={0}";

            return(WxTemplateSendHelp.SendCommonJson <GetPrivateTemplateJsonResult>(accessToken, urlFormat, null));
        }
Esempio n. 5
0
        public static WxTemplateMessageResult SendTemplateMessage(string accessTocken, TempleteModel TempleteModel)
        {
            string urlFormat = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}";

            return(WxTemplateSendHelp.SendCommonJson <WxTemplateMessageResult>(accessTocken, urlFormat, TempleteModel));
        }