Exemple #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $this->read()->forAll(function ($key, $feed) {
         $item = $this->feed_service->make($feed->getUrl());
         $this->createFeedItems($item)->map($this->buildFeed())->map($this->buildArticle($feed))->map($this->addArticle());
     });
     $this->article_service->save($this->articles);
 }
 if ($method == 'draft') {
     if (v('cid') && v('type') && v('title') && v('content') && v('abstract')) {
         if (v('id')) {
             // 文章更新
             $id = v('id');
             if ($service->update($id, v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                 if ($service->draft($id)) {
                     // 静态化文章,及更新列表
                     $service->staticArticle($id);
                     $category = $categoryService->findById(v('cid'));
                     $service->staticArticleList($category);
                     $service->staticIndex();
                 }
             }
         } else {
             if ($service->save(v('title'), v('abstract'), v('content'), v('cid'), v('type'))) {
                 // 静态化文章,及更新列表
                 $service->staticArticle($id);
                 $category = $categoryService->findById(v('cid'));
                 $service->staticArticleList($category);
                 $service->staticIndex();
             }
         }
         forward('article_list.php?status=0');
     } else {
         send_result(0, 'request does not have title,abstract,content,id,cid parames');
     }
 } else {
     if ($method == 'edit') {
         if (v('id')) {
             $article = $service->findById(v('id'));