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