Ejemplo n.º 1
0
        public void TestMethod1()
        {
            var authClient = new HashClient("*****@*****.**", "asdf1234!");
            var result     = authClient.Auth().Result;

            Console.WriteLine(result.access_token);
        }
Ejemplo n.º 2
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            using var channel = GrpcChannel.ForAddress("https://localhost:5001");
            var client   = new HashClient(channel);
            var response = await client.GetHashAsync(new HashRequest { Input = "Test" });

            Console.WriteLine($"Hash: {response.Hash}");
            Console.ReadKey();
        }
Ejemplo n.º 3
0
        public OARedEnvelopeCacheManager(int officialAccountType, DateTime now)
        {
            _officialAccountType = officialAccountType;
            _now = now;
            var cacheName = GlobalConstant.OARedEnvelopeCacheHeader;

            _cacheClient   = CacheHelper.CreateCacheClient(cacheName);
            _counterClient = CacheHelper.CreateCounterClient(cacheName, TimeSpan.FromDays(2));
            _today         = _now.ToString("yyyyMMdd");
            _hashClient    = CacheHelper.CreateHashClient(cacheName + $":{officialAccountType}:{_today}", TimeSpan.FromDays(1));
        }
Ejemplo n.º 4
0
        public BaoYangCounter(Guid activityId, int activityLimitCount, int userLimitCount, FixedPriceActivityRoundConfig round)
        {
            DateTime now = DateTime.Now;

            this._activityId         = activityId;
            this._counter            = CacheHelper.CreateHashClient(activityId.ToString(), TimeSpan.FromDays(30));
            this.orderHistory        = CacheHelper.CreateSortedSetClient <string>(activityId.ToString(), TimeSpan.FromDays(30));
            this._activityLimitCount = activityLimitCount;
            this._userLimitCount     = userLimitCount;
            this._round = round;
            _logger     = LogManager.GetLogger("保养定价活动计数器");
        }
Ejemplo n.º 5
0
        public async Task Connect(ConnectionSettings settings)
        {
            if (_session != null)
            {
                throw new InvalidOperationException("Cannot connect because the client is already connected");
            }

            _commonClient       = new CommonClient();
            _hashClient         = new HashClient();
            _listClient         = new ListClient();
            _scriptClient       = new ScriptClient();
            _stringClient       = new StringClient();
            _transactionClient  = new TransactionClient();
            _setClient          = new SetClient();
            _subscriptionClient = new SubscriptionClient();
            _session            = await _commonClient.Connect(settings).ConfigureAwait(false);

            if (!_session.IsOpen)
            {
                throw new IOException("Session could not be opened");
            }

            OnConnected?.Invoke(this);
        }