stat_anotice.php 941 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. defined('InShopNC') or exit('Access Invalid!');
  3. class stat_anoticeControl extends SystemControl
  4. {
  5. public function __construct(){
  6. parent::__construct();
  7. }
  8. public function indexOp()
  9. {
  10. $goods_name = trim($_REQUEST['goods_name']);
  11. $sort = trim($_REQUEST['sort']);
  12. $cond = [];
  13. if(!empty($goods_name)) {
  14. $cond['goods_name'] = array('like',"%{$goods_name}%");
  15. }
  16. if($sort == 'descending') {
  17. $order = 'nc_count desc';
  18. }
  19. elseif($sort == 'ascending') {
  20. $order = 'nc_count asc';
  21. }
  22. else {
  23. $order = '';
  24. }
  25. $mod_notice = Model('arrival_notice');
  26. $result = $mod_notice->where($cond)->field('count(*) as nc_count,goods_id,goods_name')->group('goods_id')->order($order)->select();
  27. Tpl::output('list', $result);
  28. Tpl::showpage('stat.anotice.list');
  29. }
  30. }