dever 4 년 전
부모
커밋
0005bf2bac
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/Api.php

+ 6 - 0
src/Api.php

@@ -32,6 +32,12 @@ class Api
 
 		$template = Dever::db('poster/template')->getAll($where);
 
+		$total = count($template);
+
+		if ($num > $total) {
+			$num = $total;
+		}
+
 		$key = array_rand($template, $num);
 
 		if (is_array($key)) {