예제 #1
0
 /**
  * 保存添加记录
  *
  * @return  void
  */
 public function save()
 {
     if (!$this->check_power('evaluate_rule_manage')) {
         return;
     }
     $er_id = (int) $this->input->post('id');
     $evaluate_rule = EvaluateRuleModel::get_evaluate_rule_list(array('id' => $er_id));
     if ($er_id > 0 && !count($evaluate_rule)) {
         message('该评估规则不存在', 'admin/evaluate_rule/index');
         return;
     }
     if ($er_id > 0 && $this->rule_is_reportting($er_id)) {
         message('该评估规则正在生成报告,无法操作', 'admin/evaluate_rule/index');
         return;
     }
     $er_id && ($evaluate_rule = $evaluate_rule[0]);
     $name = trim($this->input->post('name'));
     $exam_pid = intval($this->input->post('exam_pid'));
     $contrast_exam_pid = intval($this->input->post('contrast_exam_pid'));
     //对比考试期次
     $generate_subject_report = intval($this->input->post('generate_subject_report'));
     //是否生成学科报告
     $generate_transcript = intval($this->input->post('generate_transcript'));
     //是否生成学生成绩单
     $generate_class_report = intval($this->input->post('generate_class_report'));
     //是否生成班级报告
     $generate_teacher_report = intval($this->input->post('generate_teacher_report'));
     //是否生成教师报告
     $place_id = trim($this->input->post('place_id'));
     $subject_id = $this->input->post('subject_id');
     $comparison_level = $this->input->post('comparison_level');
     //对比等级(地域)
     $subject_percent = $this->input->post('subject_percent');
     //学科->综合->各学科占比
     $generate_mode = intval($this->input->post('generate_mode'));
     //生成模式
     $generate_u_keyword = trim($this->input->post('generate_u_keyword'));
     //单人模式下的生成uid
     if ($name == '') {
         message('规则名称不能为空');
         return;
     }
     if (!$exam_pid || !count(ExamModel::get_exam($exam_pid))) {
         message('请选择考试期次');
         return;
     }
     if ($place_id == '' || $place_id > 0 && !count(ExamPlaceModel::get_place($place_id))) {
         message('请选择考试场次');
         return;
     }
     if ($subject_id == '' || intval($subject_id) > 0 && !count(SubjectModel::get_subject($subject_id))) {
         message('请选择考试科目');
         return;
     }
     if ($exam_pid == $contrast_exam_pid) {
         message('同一考试期次不能进行对比');
         return;
     }
     $distribution_proportion = null;
     if ($generate_class_report || $generate_teacher_report) {
         $proportion_name = $this->input->post('distribution_proportion_name');
         $proportion = $this->input->post('distribution_proportion');
         if (array_filter($proportion_name) && array_filter($proportion)) {
             if (array_unique(array_filter($proportion_name)) != $proportion_name || array_unique(array_filter($proportion)) != $proportion) {
                 message('分布比例填写不符合要求,请重新填写!');
                 return;
             }
             if (min($proportion) <= 0 || max($proportion) != 100) {
                 message('分布比例临界值取值范围为(0, 100]左开右闭的区间的整数值!');
                 return;
             }
             $proportions = array();
             foreach ($proportion_name as $i => $val) {
                 if (!Validate::isNotEmpty($val) || !Validate::isInt($proportion[$i]) || $proportion[$i] <= 0 || $proportion[$i] > 100) {
                     message('分布比例填写不符合要求,请重新填写!');
                     return;
                 }
                 $proportions[trim($val)] = round($proportion[$i]);
             }
             if (array_unique($proportions) != $proportions) {
                 message('分布比例填写不符合要求,请重新填写!');
                 return;
             }
             asort($proportions);
             $distribution_proportion = json_encode($proportions);
         }
     }
     //对比等级
     if (!is_array($comparison_level) || !count($comparison_level)) {
         message('请选择对比等级');
         return;
     }
     if (!$generate_subject_report && !$generate_transcript && !$generate_class_report && !$generate_teacher_report) {
         message('请至少选择一个类型的报告进行生成工作');
         return;
     }
     $query_arr = array('name' => $name);
     if ($er_id) {
         $query_arr['id !='] = $er_id;
     }
     $query = $this->db->select('id')->get_where('evaluate_rule', $query_arr);
     if ($query->num_rows()) {
         message('该规则名称已存在');
         return;
     }
     $query_arr = array();
     if (!$er_id) {
         $query_arr = array('exam_pid' => $exam_pid, 'place_id' => $place_id, 'subject_id' => $subject_id);
     } else {
         if ($evaluate_rule['exam_pid'] != $exam_pid || $evaluate_rule['place_id'] != $place_id || $evaluate_rule['subject_id'] != $subject_id) {
             $query_arr = array('exam_pid' => $exam_pid, 'place_id' => $place_id, 'subject_id' => $subject_id);
         }
     }
     if (count($query_arr)) {
         $query = $this->db->select('id')->get_where('evaluate_rule', $query_arr);
         if ($query->num_rows()) {
             message('该期次->考场->学科已存在');
             return;
         }
     }
     //生成模式
     $generate_uid = 0;
     if ($generate_mode == 1) {
         $student = array();
         if (stripos($generate_u_keyword, '@') === false) {
             $student = StudentModel::get_student_by_exam_ticket($generate_u_keyword);
         } else {
             $student = StudentModel::get_student_by_email($generate_u_keyword);
         }
         if (!count($student)) {
             message('单人模式下 被搜索学生不存在,请检查.');
             return;
         }
         $generate_uid = $student['uid'];
         //检查该考生是否在本场考试中
         if (!$place_id) {
             $sql = "select count(eps.id) as count\n        \t\t\t\tfrom {pre}exam_place_student eps, {pre}exam_place p\n        \t\t\t\twhere eps.place_id=p.place_id and p.exam_pid={$exam_pid} and eps.uid={$generate_uid}";
             $result = $this->db->query($sql)->result_array();
         } else {
             $sql = "select count(eps.id) as count\n        \t\t\t\tfrom {pre}exam_place_student eps, {pre}exam_place p\n        \t\t\t\twhere eps.place_id=p.place_id and eps.place_id={$place_id} and eps.uid={$generate_uid}";
             $result = $this->db->query($sql)->result_array();
         }
         if (!$result[0]['count']) {
             message('该考生未参加当前所选考场中的考试.');
             return;
         }
         //检查该学生是否作弊
         $sql = "select count(*) as count from {pre}exam_test_paper where exam_pid={$exam_pid} and uid={$generate_uid} and etp_flag=-1";
         $result = $this->db->query($sql)->row_array();
         if ($result['count'] > 0) {
             message('该考生在本场考试中有作弊行为,无法生成报告');
             return;
         }
     }
     //学科->综合->各学科占比检查
     $tmp_subject_percent = array();
     $current_subject_percent = 0;
     $total_subject_percent = 100;
     $subject_id = intval($subject_id);
     if ($subject_id == 0) {
         if (!is_array($subject_percent) || !count($subject_percent)) {
             message('学科->综合->各学科占比总和必须为 100');
             return;
         }
         foreach ($subject_percent as $k => $item) {
             if (!is_numeric($item) || $item < 0) {
                 $subject_name = C('subject/' . $k);
                 message("学科->综合->{$subject_name}占比必须为 [0-100]");
                 break;
             }
             $current_subject_percent += $item;
             $tmp_subject_percent[] = "{$k}:{$item}";
         }
         if ($current_subject_percent != $total_subject_percent) {
             message('学科->综合->各学科占比总和必须为 100');
             return;
         }
     }
     $tmp_comparison_level = array();
     foreach ($comparison_level as $item) {
         $tmp_comparison_level[] = $item;
     }
     $comparison_level = array_unique($tmp_comparison_level);
     //拼接更新数据
     $rule_data = array('name' => $name, 'exam_pid' => $exam_pid, 'contrast_exam_pid' => $contrast_exam_pid, 'generate_subject_report' => $generate_subject_report, 'generate_transcript' => $generate_transcript, 'generate_class_report' => $generate_class_report, 'generate_teacher_report' => $generate_teacher_report, 'distribution_proportion' => $distribution_proportion, 'place_id' => $place_id, 'subject_id' => $subject_id, 'comparison_level' => implode(',', $comparison_level), 'generate_mode' => $generate_mode, 'generate_uid' => $generate_uid, 'subject_percent' => implode(',', $tmp_subject_percent));
     //关联一级知识点
     $knowledge_ids = $this->input->post('knowledge_ids');
     $levels = $this->input->post('levels');
     $comments = $this->input->post('comments');
     //$suggests = $this->input->post('suggests');
     !is_array($knowledge_ids) && ($knowledge_ids = array());
     !is_array($levels) && ($levels = array());
     !is_array($comments) && ($comments = array());
     //         !is_array($suggests) && $suggests = array();
     $knowledge_data = array();
     foreach ($knowledge_ids as $s_id => $knowledge) {
         foreach ($knowledge as $knowledge_id) {
             if (!isset($levels[$s_id][$knowledge_id]) || !isset($comments[$s_id][$knowledge_id])) {
                 continue;
             }
             $tmp_comments = array();
             foreach ($comments[$s_id][$knowledge_id] as $k => $item) {
                 $knowledge_data[] = array('subject_id' => $s_id, 'knowledge_id' => $knowledge_id, 'comment' => trim($item), 'suggest' => '', 'level' => intval($levels[$s_id][$knowledge_id][$k]));
             }
         }
     }
     //关联方法策略
     $method_tactic_ids = $this->input->post('method_tactic_ids');
     $method_tactic_levels = $this->input->post('method_tactic_levels');
     $method_tactic_comments = $this->input->post('method_tactic_comments');
     //      $method_tactic_suggests = $this->input->post('method_tactic_suggests');
     !is_array($method_tactic_ids) && ($method_tactic_ids = array());
     !is_array($method_tactic_levels) && ($method_tactic_levels = array());
     !is_array($method_tactic_comments) && ($method_tactic_comments = array());
     //      !is_array($method_tactic_suggests) && $method_tactic_suggests = array();
     //该考场所有的考试学科
     $subject = $this->db->query("select distinct(s.subject_id) as subject_id from {pre}exam e, {pre}subject s where e.exam_pid={$exam_pid} and e.subject_id=s.subject_id")->result_array();
     $subject_ids = array();
     foreach ($subject as $item) {
         $subject_ids[] = $item['subject_id'];
     }
     $method_tactic_data = array();
     //该分类下的所有学科
     $subjects = array();
     foreach ($method_tactic_ids as $s_id => $method_tactic) {
         if (!is_numeric($s_id) && !isset($subjects[$s_id])) {
             $subject_category_id = (int) end(explode("_", $s_id));
             $subjects[$s_id] = $this->db->query("select subject_id from {pre}subject_category_subject where subject_category_id = {$subject_category_id}")->result_array();
         }
         foreach ($method_tactic as $method_tactic_id) {
             if (!isset($method_tactic_levels[$s_id][$method_tactic_id]) || !isset($method_tactic_comments[$s_id][$method_tactic_id])) {
                 continue;
             }
             $tmp_comments = array();
             foreach ($method_tactic_comments[$s_id][$method_tactic_id] as $k => $item) {
                 if (!is_numeric($s_id)) {
                     foreach ($subjects[$s_id] as $subject) {
                         if (in_array($subject['subject_id'], $subject_ids)) {
                             $method_tactic_data[] = array('subject_id' => $subject['subject_id'], 'method_tactic_id' => $method_tactic_id, 'comment' => trim($item), 'suggest' => '', 'level' => intval($method_tactic_levels[$s_id][$method_tactic_id][$k]));
                         }
                     }
                 } else {
                     $method_tactic_data[] = array('subject_id' => $s_id, 'method_tactic_id' => $method_tactic_id, 'comment' => trim($item), 'suggest' => '', 'level' => intval($method_tactic_levels[$s_id][$method_tactic_id][$k]));
                 }
             }
         }
     }
     //关联一级信息提取方式
     $group_type_ids = $this->input->post('group_type_ids');
     $group_type_levels = $this->input->post('group_type_levels');
     $group_type_comments = $this->input->post('group_type_comments');
     //$group_type_suggests = $this->input->post('group_type_suggests');
     !is_array($group_type_ids) && ($group_type_ids = array());
     !is_array($group_type_levels) && ($levels = array());
     !is_array($group_type_comments) && ($group_type_comments = array());
     //!is_array($group_type_suggests) && $group_type_suggests = array();
     $group_type_data = array();
     foreach ($group_type_ids as $s_id => $group_type) {
         foreach ($group_type as $gr_id) {
             if (!isset($group_type_levels[$s_id][$gr_id]) || !isset($group_type_comments[$s_id][$gr_id])) {
                 continue;
             }
             $tmp_comments = array();
             foreach ($group_type_comments[$s_id][$gr_id] as $k => $item) {
                 $group_type_data[] = array('subject_id' => $s_id, 'group_type_id' => $gr_id, 'comment' => trim($item), 'suggest' => '', 'level' => intval($group_type_levels[$s_id][$gr_id][$k]));
             }
         }
     }
     //外部对比信息
     $comparison_info = $this->input->post('comparison_info');
     $tmp_comparison_info = array();
     /*
     if (!is_array($comparison_info) || !count($comparison_info))
     {
     	message('请选择外部对比信息');
     }
     */
     foreach ($comparison_info as $item) {
         @(list($cmp_type_id, $cmp_info_id) = @explode('_', $item));
         if (is_null($cmp_type_id) || is_null($cmp_info_id) || !intval($cmp_type_id) || !intval($cmp_info_id)) {
             continue;
         }
         $tmp_comparison_info[intval($cmp_type_id)][] = intval($cmp_info_id);
     }
     /*
     if (!count($tmp_comparison_info))
     {
     	message('请选择外部对比信息');
     }
     */
     $rule_data['comparison_info'] = serialize($tmp_comparison_info);
     $res = false;
     if ($er_id <= 0) {
         /**
          * 添加时间
          */
         $rule_data['addtime'] = time();
         $res = EvaluateRuleModel::insert($rule_data, $knowledge_data, $method_tactic_data, $group_type_data);
     } else {
         //更新
         $res = EvaluateRuleModel::update($er_id, $rule_data, $knowledge_data, $method_tactic_data, $group_type_data);
     }
     $back_url = 'admin/evaluate_rule/index';
     if (!$res) {
         message('保存失败', $back_url);
     } else {
         if ($er_id <= 0) {
             admin_log('add', 'evaluate_rule');
         } else {
             admin_log('edit', 'evaluate_rule', $er_id);
         }
         $this->session->set_userdata(array('comparison_info' => ''));
         message(' 保存成功', $back_url, 'success');
     }
 }
예제 #2
0
 /**
  * 学生成绩列表
  *
  * @param  int  $exam_id
  * @return  void
  */
 public function index($exam_pid = 0)
 {
     if (!$this->check_power('exam_list,exam_manage')) {
         return;
     }
     $page = intval($this->input->get('page'));
     $per_page = intval($this->input->get('per_page'));
     $exam_pid = intval($this->input->get('exam_pid'));
     $flag = $this->input->get('flag');
     $place_id = intval($this->input->get('place_id'));
     $school_id = intval($this->input->get('school_id'));
     $ticket = trim($this->input->get('ticket'));
     $score_start = trim($this->input->get('score_start'));
     $score_end = trim($this->input->get('score_end'));
     $subject_id = intval($this->input->get('subject_id'));
     $keyword = trim($this->input->get('keyword'));
     //var_dump($place_id);die;
     // 查询条件
     $query = array();
     $param = array();
     $search = array('exam_pid' => '', 'place_id' => '', 'flag' => '-2', 'keyword' => '', 'subject_id' => '', 'school_id' => '', 'school_name' => '', 'ticket' => '', 'score_start' => '', 'score_end' => '');
     $flags = array('-1' => '结果作废', '0' => '未生成分数(考试中)', '1' => '已交卷(未统计结果)', '2' => '已生成分数');
     //考试期次
     $exam_pid = !$exam_pid ? 0 : $exam_pid;
     if ($exam_pid) {
         $query['exam_pid'] = $exam_pid;
         $param[] = "exam_pid={$exam_pid}";
         $search['exam_pid'] = $exam_pid;
     }
     //状态
     if ($flag === false) {
     } else {
         if ($flag > -2) {
             $query['etp_flag'] = $flag;
             $param[] = "flag={$flag}";
             $search['flag'] = $flag;
         }
     }
     /*
     if (isset($query['etp_flag']) && $query['etp_flag'] == '2') {
     	$query['etp_flag'] = array('2', '-1');
     }
     */
     //考场
     if ($place_id) {
         $query['place_id'] = $place_id;
         $param[] = "place_id={$place_id}";
         $search['place_id'] = $place_id;
     }
     //学科
     if ($subject_id) {
         $query['subject_id'] = $subject_id;
         $param[] = "subject_id={$subject_id}";
         $search['subject_id'] = $subject_id;
     }
     //学科
     if ($keyword) {
         $escape_keyword = $this->db->escape_like_str($keyword);
         $where = "fullname LIKE '%" . $escape_keyword . "%'";
         $sql = "SELECT group_concat(uid) as uid FROM v_rd_student s WHERE {$where} ";
         $res = $this->db->query($sql)->row_array();
         $uids = explode(',', $res['uid']);
         $query['uid'] = $uids;
         $search['keyword'] = $keyword;
         $param[] = "keyword=" . urlencode($search['keyword']);
     }
     //得分查询
     if ($score_start != '') {
         $query['test_score']['>='] = $score_start;
         $param[] = "score_start={$score_start}";
         $search['score_start'] = $score_start;
     }
     if ($score_end != '') {
         $query['test_score']['<='] = $score_end;
         $param[] = "score_end={$score_end}";
         $search['score_end'] = $score_end;
     }
     //获取该学校下所有的学生
     if ($school_id) {
         $param[] = "school_id={$school_id}";
         $search['school_id'] = $school_id;
         $row = SchoolModel::schoolInfo($school_id, 'school_name');
         if ($row) {
             $school_name = trim($row['school_name']);
         } else {
             $school_name = '';
         }
         if (!count($school_name)) {
             $query = null;
             $search['school_name'] = $school_id;
         } else {
             $students = StudentModel::get_student_list(array('school_id' => $school_id), false, false, null, 'uid');
             if (count($students)) {
                 $uids = array();
                 foreach ($students as $student) {
                     $uids[] = $student['uid'];
                 }
                 $query['uid'] = $uids;
             } else {
                 $query = null;
             }
             $search['school_name'] = $school_name;
         }
     }
     //准考证号
     if ($ticket) {
         if (stripos($ticket, '@') === false) {
             $uid = StudentModel::get_student_by_exam_ticket($ticket, 'uid');
         } else {
             $uid = StudentModel::get_student_by_email($ticket, 'uid');
         }
         if (count($uid)) {
             $query['uid'] = $uid;
         } else {
             $query = null;
         }
         $param[] = "ticket={$ticket}";
         $search['ticket'] = $ticket;
     }
     $select_what = '*';
     $page = $page <= 0 ? 1 : $page;
     $per_page = $per_page <= 0 ? 10 : $per_page;
     $list = array();
     if (!is_null($query)) {
         $list = ExamTestPaperModel::get_test_paper_list($query, $page, $per_page, 'subject_id ASC,etp_id ASC', $select_what);
     }
     //获取学生信息
     $grades = C('grades');
     $subjects = C('subject');
     $data['subjects'] = $subjects;
     $tmp_list = array();
     foreach ($list as $k => $item) {
         $student = StudentModel::get_student($item['uid'], 'first_name, last_name, school_id, exam_ticket, grade_id');
         if (!count($student)) {
             $tmp_list[$k] = array_merge($item, array('truename' => '--', 'school_name' => '--', 'grade_name' => '--', 'subject_name' => '--'));
             continue;
         }
         $student['truename'] = $student['last_name'] . $student['first_name'];
         //获取学生学校信息
         $row = SchoolModel::schoolInfo($student['school_id'], 'school_name');
         if ($row) {
             $school_name = trim($row['school_name']);
         } else {
             $school_name = '';
         }
         $student['school_name'] = count($school_name) ? $school_name : '--';
         //获取该学生所在的年级
         $student['grade_name'] = isset($grades[$student['grade_id']]) ? $grades[$student['grade_id']] : '--';
         //获取科目
         $subject_name = SubjectModel::get_subject($item['subject_id'], 'subject_name');
         $student['subject_name'] = count($subject_name) ? $subject_name : '--';
         //获取考试试卷信息
         $paper_name = ExamPaperModel::get_paper($item['paper_id'], 'paper_name');
         $item['paper_name'] = count($paper_name) ? $paper_name : '--';
         //获取作废记录
         $etp_invalid_record = ExamTestPaperModel::get_etp_invalid_record($item['etp_id']);
         if (!$etp_invalid_record) {
             $item['invalid_record'] = false;
             $item['invalid_record_note'] = '';
         } else {
             $item['invalid_record'] = true;
             $item['invalid_record_note'] = $etp_invalid_record['note'];
         }
         $tmp_list[$k] = array_merge($item, $student);
     }
     $data['list'] =& $tmp_list;
     $data['search'] =& $search;
     $data['flags'] =& $flags;
     // 分页
     $purl = site_url('admin/exam_student_result/index/') . (count($param) ? '?' . implode('&', $param) : '');
     $total = ExamTestPaperModel::count_list($query);
     $data['pagination'] = multipage($total, $per_page, $page, $purl);
     $data['priv_manage'] = $this->check_power('exam_manage', FALSE);
     $this->load->view('exam_student_result/index', $data);
 }
예제 #3
0
 /**
  * 供外部支付验证使用 IMPORTANT
  * GET参数如下:
  * @param   string      from                来源标识
  * @param   string      data                加密数据字符串,data解密后包含如下字段:
  *                                          string  ukey        用户标识,必须(准考证号)
  *                                          string  pass        密码,若有该字段,表示转账
  *                                          string  auth        密码代替验证,若有该字段,表示转账,是array('ukey' => '', 'amount' => '')的加密值
  *                                          int     amount      转账金额,不可为0,若有该字段,则表示转账
  * 返回的为json格式的array数据:
  *      string  error       若有该参数,则表明有错误信息
  *      string  data        该参数表示返回的加密信息字符串,这里返回的是用户信息,解密后为array类型包含如下字段:
  *                          string  ukey    用户标识
  *                          int     account 当前余额
  */
 public function paytrans()
 {
     $resp = new AjaxResponse();
     while (true) {
         $from = $_GET['from'];
         $lv_cfg = C('loginverify');
         if (!$lv_cfg) {
             $resp->alert('非法访问来源0');
             break;
         }
         if (!isset($lv_cfg[$from])) {
             $resp->alert('非法访问来源1');
             break;
         }
         $hashcode = $lv_cfg[$from]['hashcode'];
         $enc_data = $_GET['data'];
         $param0 = Func::decrypt($enc_data, $hashcode);
         //header('Content-Type:application/json;charset=UTF-8');
         if ($param0 === false) {
             $resp->alert('非法访问');
             break;
         }
         if (!isset($param0['ukey'])) {
             $resp->alert('非法访问参数');
             break;
         }
         $uinfo = StudentModel::get_student_by_exam_ticket($param0['ukey'], 'uid,exam_ticket,password,account');
         if (empty($uinfo)) {
             $resp->alert('非法用户');
             break;
         }
         if ((isset($param0['pass']) || isset($param0['auth'])) && isset($param0['amount'])) {
             if (!Validate::isInt($param0['amount']) || $param0['amount'] == 0) {
                 $resp->alert('转账金额不能为0');
                 break;
             }
             if (isset($param0['pass']) && my_md5($param0['pass']) == $uinfo['password'] || isset($param0['auth']) && Func::encrypt(array('ukey' => $param0['ukey'], 'amount' => $param0['amount']), $hashcode) == $param0['auth']) {
                 if (bcadd($uinfo['account'], $param0['amount'], 0) < 0) {
                     $resp->alert('用户余额不足');
                     break;
                 }
                 // 这里开始交易
                 $tr_no = TransactionRecordModel::genTransactionRecordTrNo();
                 $db = Fn::db();
                 $db->beginTransaction();
                 $rec = array('tr_no' => $tr_no, 'tr_type' => 4, 'tr_uid' => $uinfo['uid'], 'tr_pid' => NULL, 'tr_money' => bcadd($uinfo['account'], $param0['amount'], 0), 'tr_cash' => NULL, 'tr_trade_amount' => $param0['amount'], 'tr_adminid' => 1, 'tr_flag' => 2, 'tr_createtime' => time());
                 $rec['tr_finishtime'] = $rec['tr_createtime'];
                 if ($param0['amount'] > 0) {
                     $rec['tr_comment'] = "从{$lv_cfg[$from]['name']}转入{$param0['amount']}择明通宝";
                 } else {
                     $v = 0 - $param0['amount'];
                     $rec['tr_comment'] = "转出{$v}择明通宝到{$lv_cfg[$from]['name']}";
                 }
                 try {
                     $db->insert('t_transaction_record', $rec);
                     $db->update('rd_student', array('account' => $rec['tr_money']), 'uid = ' . $uinfo['uid']);
                     $db->commit();
                 } catch (Exception $e) {
                     $db->rollBack();
                     $resp->alert('转账失败');
                     break;
                 }
                 $uinfo['account'] = $rec['tr_money'];
                 $resp->exdata = array('ukey' => $uinfo['exam_ticket'], 'account' => $uinfo['account']);
             } else {
                 $resp->alert('用户验证未通过');
             }
             break;
         }
         // 只显示余额
         $resp->exdata = array('ukey' => $uinfo['exam_ticket'], 'account' => $uinfo['account']);
         break;
     }
     $json_data = array();
     if ($resp->exdata) {
         $json_data['data'] = Func::encrypt($resp->exdata, $hashcode);
     } else {
         $resp_data = json_decode($resp->__toString(), true);
         $json_data['error'] = $resp_data[0][1];
     }
     $json_str = json_encode($json_data);
     header('Content-Type:application/json;charset=UTF-8');
     echo "{$json_str}";
     exit;
 }