Exemple #1
0
        public static string CreateMenu(CreateMenuParams createMenuParams)
        {
            string accessToken = AccessTokenService.GetAccessToken();

            string url = "https://api.wechat.com/cgi-bin/menu/create?access_token=" + accessToken;

            //var createMenuParams = new CreateMenuParams();
            //createMenuParams.button.Add(new CreateMenuParams.MenuButton()
            //{
            //    type = "view",
            //    name = "Sitecore Experience Platform",
            //    url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxe50bdb27143920a2&redirect_uri=http://wechatpoc.southeastasia.cloudapp.azure.com/&response_type=code&scope=snsapi_userinfo&state=1803#wechat_redirect"
            //});

            string parameters = JsonConvert.SerializeObject(createMenuParams);

            return(AppService.WebRequestPost(url, parameters));
            //return (CreateMenuResponse)JsonConvert.DeserializeObject(response, typeof(CreateMenuResponse));
        }
Exemple #2
0
        public static string CreateQRCode()
        {
            string accessToken = AccessTokenService.GetAccessToken();

            string url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token=" + accessToken;

            var qrCodeParams = new CreateQRCodeParams()
            {
                action_name = "QR_LIMIT_SCENE",
                action_info = new Scene()
                {
                    scene_id = "1803"
                }
            };

            string parameters = JsonConvert.SerializeObject(qrCodeParams);

            return(AppService.WebRequestPost(url, parameters));

            //return (CreateQRCodeResponse)JsonConvert.DeserializeObject(response, typeof(CreateQRCodeResponse));
        }
Exemple #3
0
        public static string ResetQuota(string appID)
        {
            string url  = "https://api.weixin.qq.com/cgi-bin/clear_quota?access_token=" + AccessTokenService.GetAccessToken();
            AppID  myID = new AppID();

            myID.appid = appID;
            string wcID = JsonConvert.SerializeObject(myID);

            return(AppService.WebRequestPost(url, wcID));
        }
Exemple #4
0
        public static string AddNews(WCArticles wcArticles)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=" + AccessTokenService.GetAccessToken();

            //var jsonsSettings = new JsonSerializerSettings();

            string articles = JsonConvert.SerializeObject(wcArticles);

            articles = "{ \"articles\":" + articles + "}";
            return(AppService.WebRequestPostJson(url, articles));
        }
Exemple #5
0
        public static string AddMaterial(MediaParams mediaParams)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=" + AccessTokenService.GetAccessToken() + "&type=" + mediaParams.mediatype;

            //string img = JsonConvert.SerializeObject(imgParams);
            //return AppService.WebRequestPost(url,img);
            return(AppService.WebRequestPost(url, mediaParams.filename, mediaParams.contenttype, mediaParams.media));
        }
Exemple #6
0
        public static string UploadImg(MediaParams imgParams)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token=" + AccessTokenService.GetAccessToken();

            //string img = JsonConvert.SerializeObject(imgParams);
            //return AppService.WebRequestPost(url,img);
            return(AppService.WebRequestPost(url, imgParams.filename, imgParams.contenttype, imgParams.media));
        }
Exemple #7
0
        public static string SendRTMsg(RTMessageInt rtMessageInt)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=" + AccessTokenService.GetAccessToken();

            string msg = JsonConvert.SerializeObject(rtMessageInt);

            return(AppService.WebRequestPost(url, msg));
        }
Exemple #8
0
        public static string QYSend(QYMsgParams qymsgParams)
        {
            string url = " https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=" + AccessTokenService.GetQYAccessToken();

            string msg = JsonConvert.SerializeObject(qymsgParams);

            return(AppService.WebRequestPost(url, msg));
        }