james 8 سال پیش
والد
کامیت
168eec41ff
3فایلهای تغییر یافته به همراه66 افزوده شده و 0 حذف شده
  1. 5 0
      admin/control/stat_anotice.php
  2. 8 0
      admin/control/stat_collection.php
  3. 53 0
      admin/control/stat_favorites.php

+ 5 - 0
admin/control/stat_anotice.php

@@ -35,4 +35,9 @@ class stat_anoticeControl extends SystemControl
         Tpl::output('list', $result);
         Tpl::showpage('stat.anotice.list');
     }
+
+    public function favoritesOp()
+    {
+
+    }
 }

+ 8 - 0
admin/control/stat_collection.php

@@ -11,6 +11,14 @@ class stat_collectionControl extends SystemControl
 
     public function indexOp()
     {
+
+        $mod_favorites = Model('favorites');
+
+        $cond = array('fv_type=goods');
+        $on = 'goods.goods_id=favorites.fav_id';
+        $mod_goods = Model();
+        $result = $mod_goods->table('goods,favorites')->join('inner')->on($on)->field('goods_name,goods_id,count(*) as nc_count')->group('fav_id')->where($cond)->select();
         Tpl::showpage('stat.collection.list');
+
     }
 }

+ 53 - 0
admin/control/stat_favorites.php

@@ -0,0 +1,53 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: james
+ * Date: 2017/4/6
+ * Time: 上午10:43
+ */
+
+defined('InShopNC') or exit('Access Invalid!');
+
+class stat_favoritesControl extends SystemControl
+{
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    public function indexOp()
+    {
+        $goods_name = trim($_REQUEST['goods_name']);
+        $brand_name = trim($_REQUEST['brand_name']);
+        $sort = trim($_REQUEST['sort']);
+
+        $cond = [];
+        if(!empty($goods_name)) {
+            $cond['goods_name'] = array('like',"%{$goods_name}%");
+        }
+        else if (!empty($brand_name))
+        {
+            $cond['brand_name'] = array('like',"%{$brand_name}%");
+        }
+
+        if($sort == 'descending') {
+            $order = 'nc_count desc';
+        }
+        elseif($sort == 'ascending') {
+            $order = 'nc_count asc';
+        }
+        else {
+            $order = '';
+        }
+
+        $mod_favorites = Model('favorites');
+
+        $cond = array('fv_type=goods');
+        $on = 'goods.goods_id=favorites.fav_id';
+        $mod_goods = Model();
+        $result = $mod_goods->table('goods,favorites')->join('inner')->on($on)->field('goods_name,goods_id,count(*) as nc_count')->group('fav_id')->where($cond)->select();
+
+
+        Tpl::showpage('stat.collection.list');
+    }
+}