Ejemplo n.º 1
0
        /// <summary>评论新增
        /// </summary>
        /// <param name="productId">商品ID</param>
        public void AddComment(long productId)
        {
            var Key      = RedisKeyConst.GetProductCommentsKey(productId).Key;
            var LastItem = CN100.Redis.Client.RedisClientUtility.GetDataListByRange <ProductCommentModel>(Key, 0, 0);

            using (var client = factory.CreateClient <IOrderService>())
            {
                IList <ProductCommentModel> list;
                if (LastItem != null && LastItem.Count > 0)
                {
                    list = client.Channel.GetProductCommentsAfterMinCommentID(productId, LastItem[0].Id);
                }
                else
                {
                    list = client.Channel.GetProductComments(productId);
                }
                list = list.OrderByDescending(it => it.Id).ToList();
                CN100.Redis.Client.RedisClientUtility.SetDataList <ProductCommentModel>(Key, list);
                productService.ChangeProductStatistics(productId);
            }
        }