store-exam-validate

This commit is contained in:
xiaomlove
2021-05-07 18:30:58 +08:00
parent 3853b95adc
commit 5241780cdd
2 changed files with 8 additions and 3 deletions
+3 -3
View File
@@ -56,12 +56,12 @@ class ExamRepository extends BaseRepository
}
$validIndex = [];
foreach ($params['indexes'] as $index) {
if (!isset($index['checked']) || !$index['checked']) {
if (isset($index['checked']) && !$index['checked']) {
continue;
}
if (!isset($index['require_value']) || !ctype_digit((string)$index['require_value'])) {
throw new \InvalidArgumentException(sprintf(
'Invalid require value for index: %s.', $index['name']
'Invalid require value for index: %s.', $index['index']
));
}
$validIndex[] = $index;
@@ -77,7 +77,7 @@ class ExamRepository extends BaseRepository
if (!empty($params['begin']) && !empty($params['end']) && empty($params['duration'])) {
return true;
}
if (empty($params['begin']) && empty($params['end']) && ctype_digit((string)$params['duration']) && $params['duration'] > 0) {
if (empty($params['begin']) && empty($params['end']) && isset($params['duration']) && ctype_digit((string)$params['duration']) && $params['duration'] > 0) {
return true;
}