Esempio n. 1
0
        /// <summary>
        /// 通过Code 来获取AccessToken
        /// 括号内的东西 , string itemCode = null
        /// </summary>
        public tbClientUser FromCodeToGetAccesToken(string code)
        {
            var Item = new { AccessToken = "", ExpiresIn = DateTime.MinValue };

            Item = Tools.Utils.TypeConversion(GetInfo.GetAccesstoken(code), Item);

            //将淘宝返回的User类型转化为本地需要的类型
            tbClientUser us = Changetype(Item.AccessToken, Item.ExpiresIn.ToString());
            Hashtable    ht = new Hashtable();

            ht.Add("TbUserId", us.TbUserId);
            ht.Add("AccessToken", Item.AccessToken);
            DataCache.SetCache("UserClientInfo" + us.TbUserId, ht);
            //保存用户数据
            return(Save(us, Item.AccessToken, Item.ExpiresIn.ToString()));
        }