Esempio n. 1
0
        /// <summary>
        /// 获取自定义菜单配置接口
        /// </summary>
        /// <param name="access_token"></param>
        /// <returns></returns>
        public static string Get_current_selfmenu_info(string access_token)
        {
            string url = "https://api.weixin.qq.com/cgi-bin/get_current_selfmenu_info?access_token=";

            url += access_token;

            TimeoutWebClient wc = ThreadWebClientFactory.GetWebClient();

            wc.Encoding = Encoding.UTF8;
            var json = wc.GetLoadString(url, string.Empty);

            return(json);
        }
Esempio n. 2
0
        /// <summary>
        /// Get请求并反馈解码后的Json对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="url"></param>
        /// <returns></returns>
        public static T GetObject <T>(string url, string param = "")
            where T : BaseRes
        {
            TimeoutWebClient wc = ThreadWebClientFactory.GetWebClient();

            wc.Encoding = Encoding.UTF8;
            var json = wc.GetLoadString(url, param);
            var rel  = JsonConvert.DeserializeObject <T>(json);

            if (string.IsNullOrEmpty(rel.errcode))
            {
                rel.errcode = "0";
            }
            return(rel);
        }