Bladeren bron

20250108 调整

贾小兵 3 maanden geleden
bovenliggende
commit
455075265a
1 gewijzigde bestanden met toevoegingen van 4 en 2 verwijderingen
  1. 4 2
      application/admin/controller/teacher/Exams.php

+ 4 - 2
application/admin/controller/teacher/Exams.php

@@ -60,8 +60,10 @@ class Exams extends Backend
             ->paginate($limit);
         //最高分 最低分 平均分
         $select = $this->model->where($where)->where($this->whereExtend)->field('count(*) as count,sum(total_score) as totalscore,min(total_score) as min,max(total_score) as max')->select();
-        $pingfen  = bcdiv($select[0]['totalscore'],$select[0]['count']);
-
+        $pingfen  = 0;
+        if(!empty($select[0]['totalscore']) && !empty($select[0]['count'])){
+            $pingfen  = bcdiv($select[0]['totalscore'],$select[0]['count']);
+        }
 
         $defen = ['max'=>$select[0]['max'],'min'=>$select[0]['min'],'pingfen'=>$pingfen];
         $result = ['total' => $list->total(), 'rows' => $list->items(),'defen'=>$defen];