Example #1
0
 public function actionGet_tags()
 {
     $content = trim($this->post("content"));
     $tags = FenCiService::getTags($content);
     return $this->renderJSON($tags);
 }
Example #2
0
 private function save2blog($content, $title, $url)
 {
     if (!$content || !$title) {
         return false;
     }
     $content .= "<p>Robot抓取来源:<a href='{$url}' target='_blank'>去原网站</a></a>";
     $model_post = new Posts();
     $model_post->uid = 0;
     $model_post->title = $title;
     $model_post->type = 1;
     $model_post->status = 0;
     //先审核后在展示
     $model_post->content = $content;
     $tags = FenCiService::getTags($content);
     $model_post->tags = implode(",", $tags);
     $model_post->updated_time = date("Y-m-d H:i:s");
     $model_post->created_time = $model_post->updated_time;
     if ($model_post->save(0)) {
         //BlogService::buildTags($model_post->id);//隐藏的不需要tag
         return $model_post->id;
     }
     return false;
 }