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)) {