stanley-king 8 lat temu
rodzic
commit
efee76527b

+ 0 - 25
data/model/mb_special.model.php

@@ -301,7 +301,6 @@ class mb_specialModel extends Model
     {
         if (!empty($item_data)) {
             $item_data = unserialize($item_data);
-            $item_data = $this->_doDate($item_data);
             if ($item_type == 'goods') {
                 $item_data = $this->_initMbSpecialItemGoodsData($item_data, $item_type);
             }
@@ -312,31 +311,7 @@ class mb_specialModel extends Model
 
     }
 
-    /**
-     * 处理type=url 时的&字符转义问题
-     * @param array $data
-     * @return array|bool
-     */
-    private function _doDate($data = array()) {
-
-        if (empty($data)) {
-            return false;
-        }
 
-        foreach($data as &$item)
-        {
-            if(!is_array($item)) continue;
-            foreach ($item as &$img)
-            {
-                if(!is_array($img)) continue;
-                if ($img['type'] == 'url' || $img['type'] == 'innerurl') {
-                    $img['data'] =  htmlspecialchars_decode($img['data']);
-                }
-            }
-        }
-
-        return $data;
-    }
 
     /**
      * 处理goods类型内容

+ 17 - 1
helper/special_helper.php

@@ -120,7 +120,7 @@ class special_helper
             else {
                 continue;
             }
-
+            $this->decode($items);
             $result['items'] = $items;
             $result['scale'] = $scale;
         }
@@ -129,6 +129,22 @@ class special_helper
         return $result;
     }
 
+
+    /**
+     * 处理type=url 时的&字符转义问题
+     * @param array $data
+     * @return array|bool
+     */
+    private function decode(&$items)
+    {
+        foreach($items as &$item)
+        {
+            if ($item['type'] == 'url' || $item['type'] == 'innerurl') {
+                $item['data'] =  htmlspecialchars_decode($item['data']);
+            }
+        }
+    }
+
     private function scale($image)
     {
         $image = trim($image);

+ 9 - 1
test/user_helperTest.php

@@ -64,7 +64,15 @@ class user_helperTest extends PHPUnit_Framework_TestCase
 
     public function testActivity()
     {
-        require_once ('/Users/stanley-king/work/PHPProject/shopnc/mobile/control/activity.php');
+        //require_once ('/Users/stanley-king/work/PHPProject/shopnc/mobile/control/activity.php');
+
+        $x = 'http://a.lrlz.com/mobile/index.php?act=activity&op=limit_entra';
+        $y = htmlspecialchars_decode($x);
+
+        $x = 'http://a.lrlz.com/mobile/index.php?act=activity&op=limit_entra';
+        $y = htmlspecialchars($x);
+
+
     }