public function insert_tag($tag) { $conditions = " tag_name = :tag_name:"; $parameters = array("tag_name" => $tag); $db_tag = MeiuiTag::findFirst(array($conditions, "bind" => $parameters)); if (!$db_tag) { $db_tag = new MeiuiTag(); $db_tag->tag_name = $tag; $db_tag->create_user = $_SESSION['auth']['id']; $db_tag->create_time = time(); $db_tag->save(); } return $db_tag; }
private function insert_tag($tag, $user_id) { $conditions = " tag_name = :tag_name:"; $parameters = array("tag_name" => $tag); $db_tag = MeiuiTag::findFirst(array($conditions, "bind" => $parameters)); if (!$db_tag) { $db_tag = new MeiuiTag(); $db_tag->tag_name = $tag; $db_tag->tag_type = 1; $db_tag->create_user = $user_id; $db_tag->create_time = time(); $db_tag->save(); } return $db_tag; }