1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?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');
- }
- }
|