Пример #1
0
 /**
  * 删除iphone苹果设备的记录
  */
 public function delete()
 {
     if ($this->get_method() != 'POST') {
         $this->send_response(405, NULL, Kohana::lang('push.method_not_exist'));
     }
     $data = $this->get_data();
     $device_id = isset($data['device_id']) ? str_replace(' ', '', $data['device_id']) : '';
     if (empty($device_id)) {
         $this->send_response(400, NULL, Kohana::lang('push.device_id_empty'));
     } elseif (strlen($device_id) != 64) {
         $this->send_response(400, NULL, Kohana::lang('push.device_id_length_illegal'));
     } else {
         $this->model->delete($this->user_id, $device_id);
         $this->send_response(200);
     }
 }
Пример #2
0
 /**
  * 单例模式
  * @return Push_Model
  */
 public static function &instance()
 {
     if (!isset(self::$instance)) {
         // Create a new instance
         self::$instance = new Push_Model();
     }
     return self::$instance;
 }