stanley-king 7 yıl önce
ebeveyn
işleme
291f9da86f

+ 0 - 1
helper/fcode/present_manager.php

@@ -113,7 +113,6 @@ class present_manager
             $user_fcodes[] = "{$cid}.{$bcode}";
         }
         sort($user_fcodes);
-
         $out = algorithm::set_intersection($user_fcodes,$this->mCidBcodes);
         return empty($out) ? true : false;
     }

+ 30 - 2
helper/ugc/factory.php

@@ -8,6 +8,8 @@
 
 namespace ugc;
 
+use Exception;
+use Log;
 
 class factory
 {
@@ -18,7 +20,33 @@ class factory
         }
 
         $spobj = new special_object();
-        $spobj->set_share("",);
-    }
+        $share_title = $data['share_title'];
+        $share_image = $data['share_image'];
+
+        $spobj->set_share($share_title,$share_image);
 
+        $items = $data['items'];
+        foreach ($items as $item)
+        {
+            try
+            {
+                $type = $item['type'];
+                if($type == 'images') {
+                    $obj_item = new pics_item($item);
+                }
+                elseif($type == 'text') {
+                    $obj_item = new text_item($item);
+                }
+                else {
+                    continue;
+                }
+                $spobj->add_item($obj_item);
+            }
+            catch (Exception $ex) {
+                Log::record(__METHOD__ . " fail",Log::ERR);
+            }
+        }
+
+        return $spobj;
+    }
 }

+ 18 - 7
helper/ugc/ugc_content.php

@@ -19,10 +19,10 @@ class pics_item implements IUGContent
     private $mTitle;
     private $mImages;
 
-    public function __construct($tite='')
+    public function __construct($content)
     {
-        $this->mTitle = $tite;
-        $this->mImages = [];
+        $this->mTitle = $content['title'];
+        $this->mImages = $content['images'];
     }
     public function set_images($images)
     {
@@ -38,35 +38,46 @@ class pics_item implements IUGContent
 }
 class text_item implements IUGContent
 {
+    public function __construct($content)
+    {
+    }
     function format()
     {
-
     }
 }
 class goods_item implements IUGContent
 {
+    public function __construct($content)
+    {
+    }
     function format()
     {
-
     }
 }
 
 class voice_item implements IUGContent
 {
+    public function __construct($content)
+    {
+    }
     function format()
     {
-
     }
 }
 class vote_item implements IUGContent
 {
+    public function __construct($content)
+    {
+    }
     function format()
     {
-
     }
 }
 class question_item implements IUGContent
 {
+    public function __construct($content)
+    {
+    }
     function format()
     {
 

+ 1 - 1
helper/ugc_helper.php

@@ -13,6 +13,6 @@ class ugc_helper
 {
     public static function crate_special($data)
     {
-        //$special = \ugc\factory()
+        $special = \ugc\factory::crate_special($data);
     }
 }