delete(); foreach ($data as $k => $time) { $time['test_id'] = $id; self::set($time); } return true; } /** * 试卷分数等级列表 */ public static function testPaperScoreGradeList($id = 0) { return self::where(['test_id' => $id])->order('id asc')->select(); } /**获得分数对应的等级 * @param $score */ public static function getTestPaperScoreGrade($test_id, $score) { $grade = self::where(['test_id' => $test_id])->order('id asc')->select(); $grade = count($grade) > 0 ? $grade->toArray() : []; if (!count($grade)) return '无'; foreach ($grade as $key => $value) { $arr = explode('~', $value['grade_standard']); if ($score >= $arr[0] && $score <= $arr[1]) { return $value['grade_name']; } } return '无'; } }