public void Delete(int id)
        {
            SpiderImport s = SpiderImport.findById(id);

            s.IsDelete = 1;
            s.update("IsDelete");
        }
示例#2
0
        public virtual void Delete(long id)
        {
            SpiderImport s = SpiderImport.findById(id);

            s.IsDelete = 1;
            s.update("IsDelete");
        }
示例#3
0
        private static List <long> beginImportPrivate(ImportState ts)
        {
            long id = ts.TemplateId;

            SpiderImport item = SpiderImport.findById(id);

            List <SpiderArticle> articles = SpiderArticle
                                            .find("SpiderTemplateId in (" + item.DataSourceIds + ") and Id>" + item.LastImportId + " order by Id")
                                            .list();

            List <ContentSection> sections = ContentSection.find("Id in (" + item.SectionIds + ")").list();

            if (sections.Count == 0)
            {
                throw new Exception("导入的目标section不存在");
            }

            ContentSection section = null;
            List <long>    results = new List <long>();

            for (int i = 0; i < articles.Count; i++)
            {
                if (articleExist(articles[i]))
                {
                    ts.Log.AppendLine("pass..." + articles[i].Title);
                    continue;
                }

                section = getNextSection(sections, section);   // 均匀分散到各目标section中
                ContentApp app = getApp(section);

                if (item.IsApprove == 1)
                {
                    importToTemp(articles[i], item, section, app);
                }
                else
                {
                    long newArticleId = importDirect(articles[i], item, section, app);
                    results.Add(newArticleId);
                }

                ts.Log.AppendLine("导入:" + articles[i].Title);
            }

            if (articles.Count > 0)
            {
                item.LastImportId = articles[articles.Count - 1].Id;
                item.update("LastImportId");
                ts.Log.AppendLine("导入完毕(操作结束)");
            }
            else
            {
                ts.Log.AppendLine("没有新条目可导入(操作结束)");
            }


            return(results);
        }
 public SpiderImport GetById(int id)
 {
     return(SpiderImport.findById(id));
 }
示例#5
0
 public virtual SpiderImport GetById(long id)
 {
     return(SpiderImport.findById(id));
 }