Jelajahi Sumber

fix admin favorite and anotice

stanley-king 8 tahun lalu
induk
melakukan
9a66d4c7bc

+ 26 - 0
admin/control/stat_anotice.php

@@ -38,6 +38,32 @@ class stat_anoticeControl extends SystemControl
 
     public function favoritesOp()
     {
+        $goods_name = trim($_REQUEST['goods_name']);
+        $sort = trim($_REQUEST['sort']);
+
+        $cond = [];
+        if(!empty($goods_name)) {
+            $cond['goods_name'] = array('like',"%{$goods_name}%");
+        }
+
+        if($sort == 'descending') {
+            $order = 'nc_count desc';
+        }
+        elseif($sort == 'ascending') {
+            $order = 'nc_count asc';
+        }
+        else {
+            $order = '';
+        }
+
+        $cond = array('fv_type=goods');
+        $on = 'goods.goods_id=favorites.fav_id';
+
+        $mod = Model();
+        $result = $mod->table('goods,favorites')->join('inner')->on($on)->where($cond)->field('goods_name,goods_id,count(*) as nc_count')->group('fav_id')->order($order)->select();
+
+        Tpl::output('list', $result);
+        Tpl::showpage('stat.anotice.favorite.list');
 
     }
 }

+ 0 - 24
admin/control/stat_collection.php

@@ -1,24 +0,0 @@
-<?php
-
-defined('InShopNC') or exit('Access Invalid!');
-
-class stat_collectionControl extends SystemControl
-{
-
-    public function __construct(){
-        parent::__construct();
-    }
-
-    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');
-
-    }
-}

+ 0 - 53
admin/control/stat_favorites.php

@@ -1,53 +0,0 @@
-<?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');
-    }
-}

admin/templates/default/stat.collection.list.php → admin/templates/default/stat.anotice.favorite.list.php


+ 1 - 1
admin/templates/default/stat.anotice.list.php

@@ -8,7 +8,7 @@
             <h3>到货通知分析</h3>
             <ul class="tab-base">
                 <li><a href="javascript:void(0)" class="current"><span>到货通知分析</span></a ></li>
-                <li><a href="index.php?act=stat_collection&op=index"><span>商品收藏分析</span></a ></li>
+                <li><a href="index.php?act=stat_anotice&op=favorites"><span>商品收藏分析</span></a ></li>
             </ul>
         </div>
     </div>