Esempio n. 1
0
 /**
  * 
  * 备份完成
  */
 public function backup_done()
 {
     $data = $this->get_data();
     $device_id = $data['device_id'] ? trim($data['device_id']) : '';
     $batch_number = $data['batch_number'] ? trim($data['batch_number']) : '';
     if (empty($device_id)) {
         $this->send_response(400, NULL, '401201:设备id为空');
     }
     if (empty($batch_number)) {
         $this->send_response(400, NULL, '401204:备份批号为空');
     }
     $batch_info = $this->model->get_batch_info($this->user_id, $device_id, $batch_number);
     if (!$batch_info) {
         $this->send_response(400, NULL, '401213:备份批号非法');
     }
     $batch_total_sms = $this->model->get_sms_count($this->user_id, $device_id, $batch_number);
     if ($batch_info['backup_total_sms'] != $batch_total_sms) {
         $this->send_response(400, NULL, '401214:短信数量校验不一致');
     }
     if ($this->model->backup_done($this->user_id, $device_id, $batch_number, $batch_info['phone_model'], $batch_info['backup_total_sms'], $this->appid, $this->source)) {
         $this->send_response(200, array('backup_total_sms' => $batch_info['backup_total_sms']));
     }
     $this->send_response(400, NULL, '401216:备份失败');
 }