Example #1
0
        public async Task<HttpResponseMessage> PostGetAllCount([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            if (string.IsNullOrEmpty(openid) || ekid == 0)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            var redis = new RedisManager2<WeChatRedisConfig>();
            double zanCount = await redis.GetScoreAsync<EKTodayRedis, EKZanCountZsetAttribute>(ekid.ToString());
            double readCount = await redis.GetScoreAsync<EKTodayRedis, EKReadCountZsetAttribute>(ekid.ToString());
            double commentCount = await redis.GetScoreAsync<EKTodayRedis, EKCommentCountZsetAttribute>(ekid.ToString());

            Tuple<double, double, double> ret = Tuple.Create(zanCount, readCount, commentCount);
            return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);

        }
Example #2
0
        public static async Task<double> GetCommentCountAsync(long id)
        {
            var redis = new RedisManager2<WeChatRedisConfig>();

            return await redis.GetScoreAsync<EKTodayRedis, EKCommentCountZsetAttribute>(id.ToString());
        }