| <?php | 
|   | 
| /** | 
|  * 广告服务类 | 
|  */ | 
| class Service_Ad{ | 
|   | 
|     public function __construct(){ | 
|         $this->ad_model = new AdModel(); | 
|     } | 
|   | 
|     /** | 
|      * 获取所有广告 | 
|      * @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 getAdList($query=array(),$fields=array(),$sort=array(),$limit=0,$skip=0){ | 
|         return $this->ad_model->getList($query, $fields, $sort, $limit, $skip); | 
|     } | 
|   | 
|     /** | 
|      * 获取广告数量 | 
|      * @return [type] [description] | 
|      */ | 
|     public function getAdTotal($query=array(),$limit=0,$skip=0){ | 
|         return $this->ad_model->count($query, $limit, $skip); | 
|     } | 
|   | 
|     /** | 
|      * 获取某个广告的信息 | 
|      * @param  array  $query [description] | 
|      * @param  array  $field [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function getAdInfo($query = array(), $field = array()){ | 
|         return $this->ad_model->get($query, $field); | 
|     } | 
|   | 
|     /** | 
|      * 添加广告 | 
|      * @param [type] $data [description] | 
|      */ | 
|     public function add($data){ | 
|         return $this->ad_model->add($data); | 
|     } | 
|   | 
|     /** | 
|      * 修改广告 | 
|      * @param  [type] $data  [description] | 
|      * @param  [type] $query [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function update($data, $query){ | 
|         return $this->ad_model->update($data, $query); | 
|     } | 
|   | 
|     /** | 
|      * 删除广告 | 
|      * @param  [type] $query [description] | 
|      * @return [type]        [description] | 
|      */ | 
|     public function delete($query){ | 
|         return $this->ad_model->delete($query); | 
|     } | 
|   | 
|   | 
| } |