コード例 #1
0
        public override bool refreshUser(string user_id, string name, string avatar_url)
        {
            var pm = new StringDictionary();

            pm.set("userId", user_id);
            pm.set("name", name);
            pm.set("portraitUri", avatar_url);
            var     data   = Encoding.UTF8.GetBytes(HttpUtil.joinParam(pm));
            var     result = HttpUtil.postBytes(Urls.urlRefreshUserInfo(), headers(), data, Encoding.UTF8);
            JObject res    = JsonConvert.DeserializeObject <JObject>(result);

            if (isSuccess(res))
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
        public override string token(string user_id, string name, string avatar_url)
        {
            var pm = new StringDictionary();

            pm.set("userId", user_id);
            pm.set("name", name);
            pm.set("portraitUri", avatar_url);
            var     data   = Encoding.UTF8.GetBytes(HttpUtil.joinParam(pm));
            var     result = HttpUtil.postBytes(Urls.urlGetToken(), headers(), data, Encoding.UTF8);
            JObject res    = JsonConvert.DeserializeObject <JObject>(result);

            try
            {
                if (isSuccess(res))
                {
                    return(res["token"].ToString());
                }
            }
            catch { }
            return("");
        }