/** * 考生日志记录 */ public function push() { $action = $this->input->post('act'); $data = $this->input->post('data'); if ($action && ($log_type = Log_type_desc::get_log_alia($action))) { $log_content = array('time' => date('Y-m-d H:i:s')); $data = (array) json_decode($data); if (is_array($data) && count($data)) { switch ($log_type) { case EXAM_LOG_WINDOW_BLUR: if (isset($data['count'])) { $log_content = '离开考试界面 ' . $data['count'] . ' 次'; } break; case EXAM_LOG_WINDOW_BLUR_LONG_TIME: if (isset($data['time'])) { $min = ceil($data['time'] / 60); if ($min >= 2) { $log_content = '离开考试界面 2 分钟以上'; } else { $log_content = '离开考试界面 ' . $min . ' 分钟'; } } break; } } //$sql="select sleep(10)"; //$this->db->query($sql); exam_log($log_type, $log_content); die; } }
/** * 插入考生日志信息 * array $data * return boolean */ public function insert($type, $content = null, $uid = null) { // 关闭错误信息,防止 unique index 冲突出错 $this->db->db_debug = false; $data = array('type' => $type); //补齐信息 $this->load->model('exam/exam_model'); $current_exam = $this->exam_model->get_cookie_current_exam(true); $data['exam_id'] = $current_exam['exam_id']; $data['place_id'] = $current_exam['place_id']; if (is_null($uid)) { $uid = intval($this->session->userdata('exam_uid')); if (!$uid) { return false; } } else { $uid = intval($uid); if ($uid <= 0) { return false; } } $data['uid'] = $uid; $etp_id = $this->session->userdata('etp_ids'); $etp_id && ($data['etp_id'] = $etp_id); if (is_null($content)) { require_once APPPATH . 'config/app/exam/log_type_desc.php'; $data['content'] = Log_type_desc::get_log_type_desc($data['type']); } else { $content = is_array($content) ? json_encode($content) : $content; $data['content'] = $content; } $data['ctime'] = date('Y-m-d H:i:s'); $this->db->insert(self::$_table_name, $data); $res = $this->db->affected_rows(); return $res > 0; }
public function out_student_save() { $exam_ticket = trim($this->input->post('account')); $password = $this->input->post('password'); $txt_student_tichu = $this->input->post('txt_student_tichu'); if (!strlen($exam_ticket)) { output_json(CODE_ERROR, '请输入正确的准考证号.'); } if (!strlen($password)) { output_json(CODE_ERROR, '理由不能为空.'); } if (!strlen($txt_student_tichu)) { output_json(CODE_ERROR, '状态不能为空.'); } //检查帐号密码是否正确 $this->load->model('exam/student_model'); $student = $this->student_model->is_valid_student($exam_ticket); if (!$student) { output_json(CODE_ERROR, '该考生不存在.'); } //判断该考生是否在当前考场中 $this->load->model('exam/exam_place_model'); $exam_place_model = $this->exam_place_model; $place_id = $this->session->userdata('exam_i_place_id'); $exam_id = $this->session->userdata('exam_i_exam_id'); $user_id = $student['uid']; if (!$exam_place_model->check_exam_place_student($place_id, $user_id)) { output_json(CODE_ERROR, '很抱歉,该考生不在本场考试中,有问题请联系系统管理员.'); } //重置考生密码 try { if ($txt_student_tichu == 1) { $action = 'out_student'; } else { $action = 'in_student'; } if ($action && ($log_type = Log_type_desc::get_log_alia($action))) { $log_content = $password; exam_log_1($log_type, $log_content, $user_id, $place_id, $exam_id); } $session_data = array('exam_ticket_out' => $exam_ticket, 'password_out' => $password, 'txt_student_tichu' => $txt_student_tichu); $this->session->set_userdata($session_data); $exam_place_model->out_exam_place_student($place_id, $user_id, $password, $txt_student_tichu); if ($txt_student_tichu == 1) { output_json(CODE_SUCCESS, '踢出成功, 该考生考试信息为:<p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } else { output_json(CODE_SUCCESS, '恢复成功, 该考生考试信息为:<p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } } catch (Exception $e) { output_json(CODE_ERROR, '踢出失败,请重试(如多次出现类似情况,请联系系统管理员)'); } }
public function out_student_save() { $exam_ticket = trim($this->input->post('account')); $password = $this->input->post('password'); $place_id = intval($this->input->post('place_id')); $exam_id = intval($this->input->post('exam_id')); $txt_student_tichu = intval($this->input->post('txt_student_tichu')); if (!strlen($password)) { output_json(CODE_ERROR, '理由不能为空.'); } if (!strlen($txt_student_tichu)) { output_json(CODE_ERROR, '状态不能为空.'); } // 检查帐号密码是否正确 $this->load->model(APPPATH . 'models/exam/student_model'); $student = $this->student_model->is_valid_student($exam_ticket); if (!$student) { output_json(CODE_ERROR, '该考生不存在.'); } $user_id = $student['uid']; // 重置考生密码 try { if ($txt_student_tichu == '1') { $action = 'out_student'; } else { $action = 'in_student'; } if ($action && ($log_type = Log_type_desc::get_log_alia($action))) { $log_content = $password; exam_log_1($log_type, $log_content, $user_id, $place_id, $exam_id); } $session_data = array('exam_ticket_out' => $exam_ticket, 'password_out' => $password, 'txt_student_tichu' => $txt_student_tichu); $this->session->set_userdata($session_data); ExamPlaceModel::out_exam_place_student($place_id, $user_id, $password, $txt_student_tichu); if ($txt_student_tichu == 1) { output_json(CODE_SUCCESS, '<p></p><p>踢出成功, 该考生考试信息为:</p><p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } else { output_json(CODE_SUCCESS, '<p></p><p>恢复成功, 该考生考试信息为:</p><p><strong>准考证号:</strong>' . $exam_ticket . ' </p>'); } } catch (Exception $e) { output_json(CODE_ERROR, '<p></p><p>踢出失败,请重试(如多次出现类似情况,请联系系统管理员)</p>'); } }