public Subscription Create( String url, FeedCategory category, String name, int orderId, User user )
        {
            FeedSource feedsrc = GetByLink( url );
            if (feedsrc == null) {
                feedsrc = createNewSource( url );
                saveFeedItems( feedsrc );
            }

            // 检查是否已经订阅
            Subscription s = subscriptionService.GetByFeedAndUser( feedsrc.Id, user.Id );
            if (s != null) return s;

            Subscription subscription = subscribe( category, name, orderId, user, feedsrc );
            return subscription;
        }
        private void bindItemList( long id, FeedCategory category, DataPage<FeedEntry> list ) {
            set( "feed.Title", category.Name );
            set( "feed.Link", to( Show, id ) );
            set( "LastRefreshTime", "" );

            IBlock itemBlock = getBlock( "item" );

            foreach (FeedEntry item in list.Results) {

                itemBlock.Set( "item.Title", item.Title );
                itemBlock.Set( "item.Link", to( new EntryController().Show, item.Id ) );
                itemBlock.Set( "item.PubDate", item.PubDate );
                itemBlock.Set( "item.Description", item.Abstract );
                itemBlock.Next();
            }

            set( "page", list.PageBar );
        }
Example #3
0
 private void bindCategory( FeedCategory category )
 {
     bind( "c", category );
 }
        private static Subscription subscribe( FeedCategory category, String name, int orderId, User user, FeedSource feedsrc )
        {
            Subscription subscription = new Subscription();
            subscription.FeedSource = feedsrc;
            subscription.Category = category;
            subscription.User = user;
            subscription.Name = strUtil.HasText( name ) ? name : feedsrc.Title;
            subscription.AppId = category.AppId;
            subscription.OrderId = orderId;

            db.insert( subscription );

            return subscription;
        }