/**
  * Finds the CrawlerUrlContent model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CrawlerUrlContent the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CrawlerUrlContent::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #2
0
 /**
  * 把采集到的内容写如到数据库
  * @param $crawlerUrlId
  * @param $content
  */
 public function addCrawlerUrlContent($crawlerUrlId, $content)
 {
     if (is_array($content)) {
         $content = implode(',', $content);
     }
     $crawlerUrlContent = new CrawlerUrlContent();
     $crawlerUrlContent->url_id = $crawlerUrlId;
     $crawlerUrlContent->url_content = $content;
     $crawlerUrlContent->save();
     $error = $crawlerUrlContent->getErrors();
 }