Пример #1
0
        public void Handler(PraiseArticleCommand command)
        {
            string key = "article_" + command.Id;

            if (!command.Cancle)
            {
                string[] members = _cacheClient.GetMembers(key);
                if (members.Contains(command.Account))
                {
                    _eventBus.RaiseEvent(new NotifyValidation("已点过赞,确定取消点赞?"));
                    return;
                }
                _cacheClient.AddSet(key, command.Account);
                _articleRepository.Praise(command.Id, false);
            }
            else
            {
                _cacheClient.SetRemove(key, command.Account);
                _articleRepository.Praise(command.Id, true);
            }
        }