|  | @@ -55,6 +55,7 @@ class Collection extends Backend
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          if (false === $this->request->isPost()) {
 | 
	
		
			
				|  |  |              $this->assignConfig('user_ids',[]);
 | 
	
		
			
				|  |  | +            $this->assign('examid',$ids);
 | 
	
		
			
				|  |  |              return $this->view->fetch();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          $params = $this->request->post('row/a');
 | 
	
	
		
			
				|  | @@ -122,16 +123,38 @@ class Collection extends Backend
 | 
	
		
			
				|  |  |                      //匹配的学员自动加入  mx_real_exam_fault 考试故障关联表
 | 
	
		
			
				|  |  |                      $fault_list = Fault::where(['sim_type' => $params['sim_type'], 'fault_state' => 0,'fault_type'=>3])->select();
 | 
	
		
			
				|  |  |                      if($params['question_setting_method']==1){ //系统随机
 | 
	
		
			
				|  |  | -                        if($params['sim_type']=='0002'){
 | 
	
		
			
				|  |  | +                        if($params['sim_type']=='0001'){
 | 
	
		
			
				|  |  | +                            $fault_key1 = rand(0,1);
 | 
	
		
			
				|  |  | +                            $fault_key2 = rand(2,3);
 | 
	
		
			
				|  |  | +                            $fault_key3 = rand(4,5);
 | 
	
		
			
				|  |  | +                            $fault_key4 = rand(6,7);
 | 
	
		
			
				|  |  | +                            $fault_key5 = rand(8,9);
 | 
	
		
			
				|  |  | +                        }else if($params['sim_type']=='0002'){
 | 
	
		
			
				|  |  |                              $fault_key1 = 1;
 | 
	
		
			
				|  |  | -                            $fault_key2 = 5;
 | 
	
		
			
				|  |  | -                            $fault_key3 = rand(10,11);
 | 
	
		
			
				|  |  | -                        }else{
 | 
	
		
			
				|  |  | -                            $fault_key1 = rand(0, 1);
 | 
	
		
			
				|  |  | -                            $fault_key2 = rand(2, 3);
 | 
	
		
			
				|  |  | -                            $fault_key3 = 9;
 | 
	
		
			
				|  |  | +                            $fault_key2 = 3;
 | 
	
		
			
				|  |  | +                            $fault_key3 = 5;
 | 
	
		
			
				|  |  | +                            $fault_key4 = rand(6,7);
 | 
	
		
			
				|  |  | +                            $fault_key5 = rand(9,10);
 | 
	
		
			
				|  |  | +                        }else if($params['sim_type']=='0003'){
 | 
	
		
			
				|  |  | +                            $fault_key1 = rand(0,1);
 | 
	
		
			
				|  |  | +                            $fault_key2 = rand(2,3);
 | 
	
		
			
				|  |  | +                            $fault_key3 = rand(8,10);
 | 
	
		
			
				|  |  | +                            $fault_key4 = rand(11,12);
 | 
	
		
			
				|  |  | +                            $fault_key5 = rand(13,14);
 | 
	
		
			
				|  |  |                          }
 | 
	
		
			
				|  |  | -                        $fault_key = [$fault_key1,$fault_key2,$fault_key3];
 | 
	
		
			
				|  |  | +                        $fault_key_arr = [$fault_key1,$fault_key2,$fault_key3,$fault_key4,$fault_key5];
 | 
	
		
			
				|  |  | +                        $keys = array_rand($fault_key_arr, 3); // 随机取出3个元素
 | 
	
		
			
				|  |  | +                        $fault_key = array_intersect_key($fault_key_arr, array_flip($keys));
 | 
	
		
			
				|  |  | +//                        if($params['sim_type']=='0002'){
 | 
	
		
			
				|  |  | +//                            $fault_key1 = 1;
 | 
	
		
			
				|  |  | +//                            $fault_key2 = 5;
 | 
	
		
			
				|  |  | +//                            $fault_key3 = rand(10,11);
 | 
	
		
			
				|  |  | +//                        }else{
 | 
	
		
			
				|  |  | +//                            $fault_key1 = rand(0, 1);
 | 
	
		
			
				|  |  | +//                            $fault_key2 = rand(2, 3);
 | 
	
		
			
				|  |  | +//                            $fault_key3 = 9;
 | 
	
		
			
				|  |  | +//                        }
 | 
	
		
			
				|  |  | +//                        $fault_key = [$fault_key1,$fault_key2,$fault_key3];
 | 
	
		
			
				|  |  |                      }else if($params['question_setting_method']==2){//教师自选
 | 
	
		
			
				|  |  |                          $question_ids = $params['question_ids'];
 | 
	
		
			
				|  |  |                      }else if($params['question_setting_method']==3){ //任务自选
 | 
	
	
		
			
				|  | @@ -335,12 +358,14 @@ class Collection extends Backend
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      //选择考题
 | 
	
		
			
				|  |  | -    public function faults($type = null)
 | 
	
		
			
				|  |  | +    public function faults($type = null,$ids = null)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | +        $row = $this->model->where(['exam_collection_id'=>$ids])->find();
 | 
	
		
			
				|  |  |          //设置过滤方法
 | 
	
		
			
				|  |  |          $this->request->filter(['strip_tags', 'trim']);
 | 
	
		
			
				|  |  |          if (false === $this->request->isAjax()) {
 | 
	
		
			
				|  |  |              $this->assignConfig('sim_type', $type);
 | 
	
		
			
				|  |  | +            $this->assignConfig('rowinfo', $row);
 | 
	
		
			
				|  |  |              return $this->view->fetch();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //如果发送的来源是 Selectpage,则转发到 Selectpage
 | 
	
	
		
			
				|  | @@ -370,21 +395,27 @@ class Collection extends Backend
 | 
	
		
			
				|  |  |          return json($result);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |      //选择任务
 | 
	
		
			
				|  |  | -    public function task($type= null)
 | 
	
		
			
				|  |  | +    public function task($type= null,$ids = null)
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | +        $row = $this->model->where(['exam_collection_id'=>$ids])->find();
 | 
	
		
			
				|  |  |          //设置过滤方法
 | 
	
		
			
				|  |  |          $this->request->filter(['strip_tags', 'trim']);
 | 
	
		
			
				|  |  |          if (false === $this->request->isAjax()) {
 | 
	
		
			
				|  |  |              $this->assignConfig('sim_type', $type);
 | 
	
		
			
				|  |  | +            $this->assignConfig('ids', $ids);
 | 
	
		
			
				|  |  |              return $this->view->fetch();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          //如果发送的来源是 Selectpage,则转发到 Selectpage
 | 
	
		
			
				|  |  |          if ($this->request->request('keyField')) {
 | 
	
		
			
				|  |  |              return $this->selectpage();
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  | +        $task_where = [];
 | 
	
		
			
				|  |  | +        // 如果是考试
 | 
	
		
			
				|  |  | +        if($row['exam_collection_type']==3){
 | 
	
		
			
				|  |  | +            $task_where['fault_total'] = 3;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          [$where, $sort, $order, $offset, $limit] = $this->buildparams();
 | 
	
		
			
				|  |  | -        $list = Task::where($where)->where('sim_type',$type)
 | 
	
		
			
				|  |  | +        $list = Task::where($where)->where('sim_type',$type)->where($task_where)
 | 
	
		
			
				|  |  |              ->order($sort, $order)
 | 
	
		
			
				|  |  |              ->paginate($limit);
 | 
	
		
			
				|  |  |          unset($v);
 |