예제 #1
0
        /// <summary>
        /// 获得用户列表
        /// </summary>
        /// <param name="next_openid"></param>
        /// <returns></returns>
        public string Get(string next_openid = "")
        {
            string access_token = this.Get_Access_Token();
            string url          = string.Format(USER_GET_URL, access_token, next_openid);
            string respJson     = MyHttpUtility.SendGet(url);

            return(respJson);
        }
예제 #2
0
        public string Delete()
        {
            string access_token = this.Get_Access_Token();
            string url          = string.Format(MENU_DELETE_URL, access_token);
            string respJson     = MyHttpUtility.SendGet(url);

            return(respJson);
        }
예제 #3
0
        /// <summary>
        /// 根据openid获得用户信息
        /// </summary>
        /// <param name="openId"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public string Info(string openId, string lang = "zh_CN ")
        {
            string access_token = this.Get_Access_Token();
            string url          = string.Format(USER_INFO_URL, access_token, openId, lang);
            string respJson     = MyHttpUtility.SendGet(url);

            return(respJson);
        }
예제 #4
0
        public string GetList()
        {
            string access_token = this.Get_Access_Token();
            string url          = string.Format(TAG_GET_URL, access_token);
            string respJson     = MyHttpUtility.SendGet(url);

            return(respJson);
        }
예제 #5
0
        internal string Get_Access_Token()
        {
            if ((string.IsNullOrEmpty(access_token) &&
                 DateTime.Now > expires_Time) || (!string.IsNullOrEmpty(LastApp) && !LastApp.Equals(APPID)))
            {
                string  url  = string.Format(ACCESS_TOKEN_URL, APPID, APPSECRET);
                string  json = MyHttpUtility.SendGet(url);
                JObject jo   = (JObject)JsonConvert.DeserializeObject(json);
                access_token = Convert.ToString(jo["access_token"].ToString());
                int expires_in = Convert.ToInt32(jo["expires_in"].ToString());
                expires_Time = DateTime.Now.AddSeconds(expires_in);
                LastApp      = APPID;
            }

            return(access_token);
        }