Ejemplo n.º 1
0
 private function _set_block($status)
 {
     $data = $this->get_data();
     $mobile = isset($data['mobile']) ? $data['mobile'] : '';
     if (!$mobile) {
         $this->send_response(400, NULL, Kohana::lang('graph.mobile_not_allow'));
     }
     $id = $this->user_id;
     if (empty($id)) {
         $id = isset($data['guid']) ? $data['guid'] : '';
         $id_type = 'guid';
         if (empty($id)) {
             $this->send_response(400, NULL, Kohana::lang('graph.guid_empty'));
         }
     } else {
         $id_type = 'uid';
     }
     if ($res = international::check_mobile($mobile)) {
         $result = $this->model->set_block($id, implode('', $res), $status, $id_type);
         if ($result === -1) {
             $this->send_response(400, NULL, Kohana::lang('graph.mobile_not_exist'));
         } else {
             $this->send_response(200, array('result' => (bool) $result));
         }
     } else {
         $this->send_response(400, NULL, Kohana::lang('graph.mobile_not_allow'));
     }
 }