private AuthorizerAccessTokenWrapper CreateWrapper(string appId)
        {
            string refreshToken = _thirdPartyManager.GetAuthorizerRefreshToken(appId);

            if (String.IsNullOrEmpty(refreshToken))
            {
                _log.Write(appId + " 的 RefreshToken 不存在", TraceEventType.Warning);
                return(null);
            }

            RequestApiResult <WeixinThirdPartyGetAuthorizerAccessTokenResult> result =
                ThirdPartyApiWrapper.GetAuthorizerAccessToken(appId, refreshToken);

            if (result.Success)
            {
                AuthorizerAccessTokenWrapper wrapper = new AuthorizerAccessTokenWrapper();
                wrapper.AppId                 = appId;
                wrapper.RefreshToken          = result.ApiResult.RefreshToken;
                wrapper.AccessToken           = result.ApiResult.AccessToken;
                wrapper.AccessTokenExpiryTime = DateTime.Now.AddSeconds(result.ApiResult.ExpiresIn);
                return(wrapper);
            }

            return(null);
        }
        private void UpdateWrapper(AuthorizerAccessTokenWrapper wrapper)
        {
            RequestApiResult <WeixinThirdPartyGetAuthorizerAccessTokenResult> result =
                ThirdPartyApiWrapper.GetAuthorizerAccessToken(wrapper.AppId, wrapper.RefreshToken);

            if (result.Success)
            {
                wrapper.RefreshToken          = result.ApiResult.RefreshToken;
                wrapper.AccessToken           = result.ApiResult.AccessToken;
                wrapper.AccessTokenExpiryTime = DateTime.Now.AddSeconds(result.ApiResult.ExpiresIn);
            }
        }