Пример #1
0
 /**
  * 
  * 短信还原
  */
 public function restore()
 {
     $data = $this->get_data();
     $start = $data['start'] ? (int) $data['start'] : 0;
     $size = $data['size'] ? (int) $data['size'] : 50;
     $from_device_id = $data['from_device_id'] ? trim($data['from_device_id']) : '';
     $from_batch_number = $data['from_batch_number'] ? trim($data['from_batch_number']) : '';
     $to_device_id = $data['to_device_id'] ? trim($data['to_device_id']) : '';
     $to_phone_model = $data['to_phone_model'] ? trim($data['to_phone_model']) : '';
     if (empty($from_device_id)) {
         $this->send_response(400, NULL, '401216:还原源设备id为空');
     }
     if (empty($from_batch_number)) {
         $this->send_response(400, NULL, '401217:还原源备份批号为空');
     }
     if (empty($to_device_id)) {
         $this->send_response(400, NULL, '401218:还原目标设备id为空');
     }
     $result = $this->model->get_sms_batch($this->user_id, $from_device_id, $from_batch_number, $start, $size);
     if ($result) {
         $this->model->check_restore_history($this->user_id, $from_device_id, $from_batch_number, $to_device_id, $to_phone_model);
         $this->send_response(200, $result);
     }
     $this->send_response(400, NULL, '401219:该设备id对应的备份记录不存在');
 }