示例#1
0
        public async Task<HttpResponseMessage> PostGetReadUsers([FromBody]EKCommentParameter postParameter)
        {
            string openid = postParameter.openID;
            long ekid = postParameter.Id;
            int pageIndex = postParameter.pageIndex;
            int pageSize = postParameter.pageSize;
            int fromNo = pageIndex * pageSize;
            int toNo = fromNo + pageSize;

            if (string.IsNullOrEmpty(openid) || ekid == 0)
            {
                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, null, HttpStatusCode.OK, customStatus.InvalidArguments);
            }

            using (UserRepository userR = new UserRepository())
            {
                UserInfo user = await userR.GetUserInfoByOpenid(openid);
                var redis = new RedisManager2<WeChatRedisConfig>();

                var zans = await redis.GetRangeByRankAsync<EKTodayRedis, EKReadPepleZsetAttribute>(ekid.ToString(), from: fromNo, to: toNo);

                List<UserInfo> ret = new List<UserInfo>();
                if (zans != null && zans.Count() > 0)
                {
                    foreach (var v in zans)
                    {
                        UserInfo tmp = await userR.GetUserInfoByUuidAsync(Guid.Parse(v.Key));
                        ret.Add(tmp);
                    }
                }

                return WebApiHelper.HttpRMtoJson(postParameter.jsonpCallback, ret, HttpStatusCode.OK, customStatus.Success);
            }
        }
示例#2
0
        public async Task<KeyValuePair<string, double>[]> SetEkReadCount(string z,string id="1")
        {
            var redis = new RedisManager2<WeChatRedisConfig>();

            if (z == "z")
                return await redis.GetRangeByRankAsync<EKTodayRedis, EKZanCountZsetAttribute>("");
            if (z == "r")
                return await redis.GetRangeByRankAsync<EKTodayRedis, EKReadCountZsetAttribute>("");
            if (z == "c")
                return await redis.GetRangeByRankAsync<EKTodayRedis, EKCommentCountZsetAttribute>("");
            if (z == "rr")
                return await redis.GetRangeByRankAsync<EKTodayRedis, EKReadPepleZsetAttribute>(id);
            if (z == "zz")
                return await redis.GetRangeByRankAsync<EKTodayRedis, EKZanPepleZsetAttribute>(id);
            return null;
        }