瀏覽代碼

解决版本兼容性

stanley-king 8 年之前
父節點
當前提交
5b267e56ba
共有 4 個文件被更改,包括 46 次插入13 次删除
  1. 10 3
      helper/index_tab.php
  2. 16 4
      helper/special_helper.php
  3. 20 0
      mobile/control/control.php
  4. 0 6
      mobile/control/special.php

+ 10 - 3
helper/index_tab.php

@@ -40,10 +40,17 @@ class index_tab
 
     public function tabs()
     {
-        if(StatesHelper::fetch_state('tags')) {
-            $this->init();
+        if($_SESSION['is_lasted'])
+        {
+            if(StatesHelper::fetch_state('tags')) {
+                $this->init();
+            }
+            return $this->mTabs;
+        }
+        else {
+            global $config;
+            return $config['old_tabs'];
         }
-        return $this->mTabs;
     }
 
     private function init()

+ 16 - 4
helper/special_helper.php

@@ -83,10 +83,12 @@ class special_formater
     private $special_id;
     private $filter_data;
     private $goods_ids;
+    private $old_version;
 
-    public function __construct($special_id)
+    public function __construct($special_id,$old_version = false)
     {
         $this->special_id = $special_id;
+        $this->old_version = $old_version;
         $this->read_cache();
     }
 
@@ -356,7 +358,7 @@ class special_formater
                 $block['item_type'] = 'home_goods';
             }
             elseif($key == 'home3') {
-                $scale = $block_scale;
+                if($this->old_version == false) $scale = $block_scale;
             }
             elseif($key == 'home6') {
                 $block['item_type'] = 'horizon';
@@ -717,12 +719,22 @@ class special_manager
             $data = $this->mContents[$special_id]['data'];
             $goods_ids = $this->mContents[$special_id]['gids'];
             return $data;
-        } else {
-            $formater = new special_formater($special_id);
+        }
+        else
+        {
+
+            $formater = new special_formater($special_id,$this->old_version());
             $data = $formater->format($goods_ids);
+
             $this->mContents[$special_id]['data'] = $data;
             $this->mContents[$special_id]['gids'] = $goods_ids;
             return $data;
         }
     }
+    private function old_version($special_id)
+    {
+        global $config;
+        if($_SESSION['is_lasted']) return false;
+        return in_array($special_id,$config['old_specials']);
+    }
 }

+ 20 - 0
mobile/control/control.php

@@ -99,6 +99,26 @@ class mobileControl
             $_SESSION['client_version'] = $version;
         }
 
+        $version = intval($version * 100 + 0.5);
+        if($client == 'ios')
+        {
+            $lastest_version = 220;
+            if($version >= $lastest_version) {
+                $_SESSION['is_lasted'] = true;
+            } else {
+                $_SESSION['is_lasted'] = false;
+            }
+        }
+        elseif($client == 'android')
+        {
+            $lastest_version = 1400;
+            if($version >= $lastest_version) {
+                $_SESSION['is_lasted'] = true;
+            } else {
+                $_SESSION['is_lasted'] = false;
+            }
+        }
+
         return true;
     }
 

+ 0 - 6
mobile/control/special.php

@@ -34,18 +34,12 @@ class specialControl extends mobileHomeControl
 
     protected function get_special($special_id)
     {
-        $start = microtime(true);
         $specials = special_manager::instance()->special($special_id,$goods_ids);
-        perfor_period("special",$start,"get_special");
-
 
         if (!empty($goods_ids))
         {
-            $start = microtime(true);
             $helper = new goods_helper();
             $goodsex = $helper->get_summary($goods_ids, $related_goods);
-            perfor_period("special",$start,"get_summary");
-
 
             return array('special_list' => $specials,
                 'summary' => $goodsex['summary'],