Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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 );
        }
Ejemplo n.º 3
0
 private void bindCategory( FeedCategory category )
 {
     bind( "c", category );
 }
Ejemplo n.º 4
0
        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;
        }