dever há 4 anos atrás
pai
commit
41abc9a132
1 ficheiros alterados com 26 adições e 13 exclusões
  1. 26 13
      app/collection/src/Api.php

+ 26 - 13
app/collection/src/Api.php

@@ -95,6 +95,8 @@ class Api extends Core
                 $data['pic'] = explode(',', $content['pic']);
             }
 
+            $content['share_content'] = $content['share_content'] ? $content['share_content'] : $content['name'];
+
             if ($content['type'] == 70) {
                 $content['data'] = Dever::db('content/product')->one(array('content_id' => $content['id'], 'info_id' => $content['info_id']));
 
@@ -107,22 +109,33 @@ class Api extends Core
                 }
             }
             
-            $text = Dever::array_decode($content['copy_text']);
-            $i = 0;
-            foreach ($text as $k => $v) {
-                if ($v['name']) {
-                    $back = $background[1];
-                    if ($i == 0) {
-                        $back = $background[0];
+            if ($content['copy_text']) {
+                $text = Dever::array_decode($content['copy_text']);
+                $i = 0;
+                foreach ($text as $k => $v) {
+                    if ($v['name']) {
+                        $back = $background[1];
+                        if ($i == 0) {
+                            $back = $background[0];
+                        }
+                        $data['text'][$i] = array
+                        (
+                            'background' => $back,
+                            'content' => $v['name'],
+                        );
+                        $i++;
                     }
-                    $data['text'][$i] = array
-                    (
-                        'background' => $back,
-                        'content' => $v['name'],
-                    );
-                    $i++;
                 }
             }
+            if (!$data['text']) {
+                $data['text'][0] = array(
+                    array
+                    (
+                        'background' => $background[0],
+                        'content' => $content['share_content'],
+                    )
+                );
+            }
             $data['share'] = array
             (
                 'title' => $data['info']['name'],