Sfoglia il codice sorgente

20250425 优化练习

贾小兵 2 giorni fa
parent
commit
a36bd1dcb4
1 ha cambiato i file con 5 aggiunte e 2 eliminazioni
  1. 5 2
      application/admin/controller/student/Exercise.php

+ 5 - 2
application/admin/controller/student/Exercise.php

@@ -46,7 +46,7 @@ class Exercise extends Backend
 
     public function index()
     {
-        $info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_status'=>4])->find();
+        $info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_status'=>4,'exam_collection_type'=>2])->find();
         if(!empty($info)){
             echo "<script>location.href='/admin/student/exercise/examing/ids/".$info['exam_id']."'</script>";
             die();
@@ -61,12 +61,15 @@ class Exercise extends Backend
             $count = 0;
             Db::startTrans();
             try {
-                $exam_info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_status'=>1])->find();
+                $exam_info = $this->exam_model->where(['user_id'=>$this->auth->id,'exam_status'=>1,'exam_collection_type'=>2])->find();
                 //考试集合id  $exam_id
                 //学员考试id  $examid
                 if(!empty($exam_info)){
                     $exam_id = $exam_info['exam_collection_id'];
                     $examid = $exam_info['exam_id'];
+
+                    //同步更新练习的模拟器类型
+                    $this->exam_model->where(['exam_id'=>$exam_info['exam_id']])->update(['sim_type'=>$params['sim_type']]);
                 }else{
                     $params['exam_collection_type'] = 2;
                     $params['exam_collection_state'] = 2;