|
@@ -32,7 +32,24 @@ class Api
|
|
|
|
|
|
$template = Dever::db('poster/template')->getAll($where);
|
|
|
|
|
|
- $key = array_rand($template, 1);
|
|
|
+ $key = array_rand($template, $num);
|
|
|
+
|
|
|
+ if (is_array($key)) {
|
|
|
+ $result = array();
|
|
|
+ foreach ($key as $k => $v) {
|
|
|
+ $result[] = $this->getTemplate($set, $template, $v, $name, $update);
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ } else {
|
|
|
+ return $this->getTemplate($set, $template, $key, $name, $update);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function getTemplate($set, $template, $key, $name, $update)
|
|
|
+ {
|
|
|
$template = $template[$key];
|
|
|
|
|
|
if ($template) {
|