예제 #1
0
        private string CreateContentString()
        {
            string str = $"{SessionId.ToString()}";

            if (!string.IsNullOrEmpty(User.Identifier))
            {
                str += $"|{User.Identifier}";
            }
            if (!string.IsNullOrEmpty(User.Name))
            {
                str += $"|{User.Name}";
            }
            if (!string.IsNullOrEmpty(User.Email))
            {
                str += $"|{User.Email}";
            }
            if (!string.IsNullOrEmpty(User.Organization))
            {
                str += $"|{User.Organization}";
            }
            str += $"|{CreatedAt.ToString("yyyy-MM-dd HH:mm:ss")}";
            str += $"|{ExpireAt.ToString("yyyy-MM-dd HH:mm:ss")}";
            str += $"|{RemoteIP}";
            return(str);
        }
예제 #2
0
        private Access_Token GetAccess_token()
        {
            Access_Token token = new Access_Token();
            //请求获取 access_token。access_token有效期为一个月,所以可以缓存
            //2018-05-22 读取缓存的access_token
            var resp = Auth.OpenApiFetchToken(ApiKey, SecretKey, true);

            ExpireAt           = DateTime.Now.AddSeconds((int)resp["expires_in"] - 60 * 60);
            IsDev              = true;
            Token              = (string)resp["access_token"];
            token.access_token = Token;
            token.expires_in   = ExpireAt.ToString();
            return(token);
        }