浏览代码

gf yunfei xiufu

NoteStar 5 年之前
父节点
当前提交
5369477b38

+ 1 - 1
addons/fecmall/furnilife_theme/app/appfront/theme/furnilife/catalogsearch/index/index.php

@@ -138,7 +138,7 @@
 
                     <!--=======  pagination area  =======-->
                     <div class="shop-header mb-30">
-                        <?= $product_page ?>
+
                     </div>
 
                     <!--=======  End of pagination area  =======-->

+ 16 - 33
vendor/fancyecommerce/fecshop/services/search/MysqlSearch.php

@@ -1,5 +1,4 @@
 <?php
-
 /*
  * FecShop file.
  *
@@ -7,14 +6,11 @@
  * @copyright Copyright (c) 2016 FecShop Software LLC
  * @license http://www.fecshop.com/license/
  */
-
 namespace fecshop\services\search;
-
 //use fecshop\models\mongodb\Product;
 //use fecshop\models\mongodb\Search;
 use fecshop\services\Service;
 use Yii;
-
 /**
  * Search MongoSearch Service
  * @author Terry Zhao <2358269014@qq.com>
@@ -23,27 +19,20 @@ use Yii;
 class MysqlSearch extends Service implements SearchInterface
 {
     public $searchIndexConfig;
-
     //public $searchLang;
-
     public $enable;
-
     //protected $_productModelName = '\fecshop\models\mongodb\Product';
-
     //protected $_productModel;
-
     protected $_searchModelName = '\fecshop\models\mysqldb\Search';
-
     protected $_searchModel;
-    
+
     public function init()
     {
         parent::init();
         //list($this->_productModelName, $this->_productModel) = \Yii::mapGet($this->_productModelName);
         list($this->_searchModelName, $this->_searchModel) = \Yii::mapGet($this->_searchModelName);
-        
-    }
 
+    }
     /**
      * 创建索引.  (mysql不需要)
      */
@@ -51,10 +40,10 @@ class MysqlSearch extends Service implements SearchInterface
     {
         return;
     }
-    // 
+    //
     protected function getProductSelectData()
     {
-        $productPrimaryKey = Yii::$service->product->getPrimaryKey(); 
+        $productPrimaryKey = Yii::$service->product->getPrimaryKey();
         //echo $productPrimaryKey;exit;
         return [
             $productPrimaryKey,
@@ -76,7 +65,7 @@ class MysqlSearch extends Service implements SearchInterface
             'description',
             'created_at',
         ];
-        
+
     }
     protected $_searchLangCode;
     // 从配置中得到当前的搜索引擎对应的有效语言。
@@ -107,8 +96,8 @@ class MysqlSearch extends Service implements SearchInterface
             $filter['where'][] = ['in', $productPrimaryKey, $product_ids];
             $filter['numPerPage'] = $numPerPage;
             $filter['pageNum'] = 1;
-            
-            
+
+
             $coll = Yii::$service->product->coll($filter);
             if (is_array($coll['coll']) && !empty($coll['coll'])) {
                 $productPrimaryKey = Yii::$service->product->getPrimaryKey();
@@ -118,14 +107,14 @@ class MysqlSearch extends Service implements SearchInterface
                     $one['score'] = (int)$one['score'];
                     $one['is_in_stock'] = (int)$one['is_in_stock'];
                     $one['created_at'] = (int)$one['created_at'];
-                    
+
                     $one['price'] = (float)$one['price'];
                     $one['cost_price'] = (float)$one['cost_price'];
                     $one['special_price'] = (float)$one['special_price'];
                     $one['special_from'] = (int)$one['special_from'];
                     $one['special_to'] = (int)$one['special_to'];
                     $one['final_price'] = (float)$one['final_price'];
-                    
+
                     unset($one[$productPrimaryKey]);
                     //$langCodes = Yii::$service->fecshoplang->allLangCode;
                     //if(!empty($langCodes) && is_array($langCodes)){
@@ -138,12 +127,12 @@ class MysqlSearch extends Service implements SearchInterface
                         foreach ($searchLangCode as $langCode) {
                             $one['lang'] = $langCode;
                             $one['image'] = serialize($one['image']);
-                            
+
                             $searchModel = $this->_searchModel->findOne([
                                 'product_id' => $one['product_id'],
                                 'lang'  => $langCode,
                             ]);
-                            
+
                             if (!$searchModel['product_id']) {
                                 $searchModel = new $this->_searchModelName();
                             }
@@ -163,10 +152,9 @@ class MysqlSearch extends Service implements SearchInterface
             }
         }
         //echo "MongoSearch sync done ... \n";
-        
+
         return true;
     }
-
     /**
      * @param $nowTimeStamp | int
      * 批量更新过程中,被更新的产品都会更新字段sync_updated_at
@@ -195,16 +183,13 @@ class MysqlSearch extends Service implements SearchInterface
             }
         }
     }
-
     protected function actionRemoveByProductId($product_id)
     {
         $this->_searchModel->deleteAll([
             'product_id' => $product_id,
         ]);
-
         return true;
     }
-
     /**
      * @param $select | Array
      * @param $where | Array
@@ -250,7 +235,6 @@ class MysqlSearch extends Service implements SearchInterface
         //var_dump($collection);
         return $collection;
     }
-
     /**
      * 全文搜索
      * $filter Example:
@@ -313,11 +297,11 @@ class MysqlSearch extends Service implements SearchInterface
         } else {
             if ($orderBy) {
                 $searchM->orderBy($orderBy);
-            } 
+            }
             $query = $searchM->limit($numPerPage)->offset(($pageNum-1)*$numPerPage);
             $search_data = $query->all();
             $count = $query->limit(null)->offset(null)->count();
-        }   
+        }
         $productIds = [];
         foreach ($search_data as $d) {
             $productIds[] = $d['product_id'];
@@ -344,10 +328,9 @@ class MysqlSearch extends Service implements SearchInterface
                 'count'=> $count,
             ];
         }
-        
+
         return [];
     }
-
     /**
      * @param $filter_attr | String 需要进行统计的字段名称
      * @propertuy $where | Array  搜索条件。这个需要些mongodb的搜索条件。
@@ -359,4 +342,4 @@ class MysqlSearch extends Service implements SearchInterface
     {
         return [];
     }
-}
+}