| <?php | 
|   | 
| /** | 
|  * 文章服务类 | 
|  */ | 
| class Service_Article{ | 
|   | 
|     public function __construct(){ | 
|         $this->article_model = new ArticleModel(); | 
|     } | 
|   | 
|     /** | 
|      * 获取所有文章 | 
|      * @param  array   $query  [description] | 
|      * @param  array   $fields [description] | 
|      * @param  array   $sort   [description] | 
|      * @param  integer $limit  [description] | 
|      * @param  integer $skip   [description] | 
|      * @return [type]          [description] | 
|      */ | 
|     public function getArticleList($query=array(),$fields=array(),$sort=array(),$limit=0,$skip=0){ | 
|         return $this->article_model->getList($query, $fields, $sort, $limit, $skip); | 
|     } | 
|   | 
|     /** | 
|      * 获取文章数量 | 
|      * @return [type] [description] | 
|      */ | 
|     public function getArticleTotal($query=array(),$limit=0,$skip=0){ | 
|         return $this->article_model->count($query, $limit, $skip); | 
|     } | 
|   | 
|     /** | 
|      * 获取某个文章的信息 | 
|      * @param  array  $query [description] | 
|      * @param  array  $field [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function getArticleInfo($query = array(), $field = array()){ | 
|         return $this->article_model->get($query, $field); | 
|     } | 
|   | 
|     /** | 
|      * 添加文章 | 
|      * @param [type] $data [description] | 
|      */ | 
|     public function add($data){ | 
|         return $this->article_model->add($data); | 
|     } | 
|   | 
|     /** | 
|      * 修改文章 | 
|      * @param  [type] $data  [description] | 
|      * @param  [type] $query [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function update($data, $query){ | 
|         return $this->article_model->update($data, $query); | 
|     } | 
|   | 
|     /** | 
|      * 删除文章 | 
|      * @param  [type] $query [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function delete($query){ | 
|         return $this->article_model->delete($query); | 
|     } | 
|   | 
|   | 
| } |