Browse Source

add to local

stanley-king 7 years atrás
parent
commit
c13b8ae847
4 changed files with 27 additions and 3 deletions
  1. 14 0
      helper/ugc/ugc_content.php
  2. 10 2
      mobile/control/member_ugc.php
  3. 1 0
      mobile/util/errcode.php
  4. 2 1
      test/TestUGC.php

+ 14 - 0
helper/ugc/ugc_content.php

@@ -31,11 +31,13 @@ class pics_item implements IUGContent
     public function add_image($image) {
         $this->mImages[] = $image;
     }
+
     function format()
     {
 
     }
 }
+
 class text_item implements IUGContent
 {
     public function __construct($content)
@@ -107,6 +109,18 @@ class special_object
 
     public function save()
     {
+        $sp_id = $this->insert_special();
+        foreach ($this->contents as $item) {
+            $data = $item->format();
+            $this->insert_item($sp_id,$data);
+        }
+    }
+    private function insert_special()
+    {
+
+    }
+    private function insert_item($data)
+    {
 
     }
 }

+ 10 - 2
mobile/control/member_ugc.php

@@ -7,7 +7,7 @@
  */
 
 
-class 雇cmember_ugcControl extends mbMemberControl
+class member_ugcControl extends mbMemberControl
 {
     public function __construct()
     {
@@ -19,8 +19,16 @@ class 雇cmember_ugcControl extends mbMemberControl
     }
     public function addOp()
     {
-        $contet = urldecode($_POST['content']);
+        $contet = $_POST['content'];
+        if(empty($contet)) {
+            return self::outerr(errcode::ErrParamter,"错误的参数内容");
+        }
+
+        $sp_data = json_decode($contet,true);
+        $spobj = ugc_helper::crate_special($sp_data);
+        $spobj->save();
     }
+
     public function publishOp()
     {
     }

+ 1 - 0
mobile/util/errcode.php

@@ -88,6 +88,7 @@ class errcode extends SplEnum
     const ErrGetConfig = 14000;
     const ErrUpfile = 15000;
     const ErrAuthor = 16000;
+    const ErrUGC = 17000;
 
     static function msg($code)
     {

+ 2 - 1
test/TestUGC.php

@@ -24,10 +24,11 @@ class TestUGC extends PHPUnit_Framework_TestCase
 
         $item['type'] = 'images';
         $item['images'][] = "http://192.168.0.200/data/upload/mobile/special/s0/s0_05240528172336404.png";
-
         $item['title'] = '第一次见到大海';
+
         $special['items'][] = $item;
 
         $spobj = ugc_helper::crate_special($special);
+        $spobj->save();
     }
 }