group.inc.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $pageindex = max(1, intval($_GPC['page']));
  5. $pagesize=10;
  6. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  7. $where=" where a.uniacid=:uniacid and a.state>0";
  8. $data[':uniacid']=$_W['uniacid'];
  9. if(isset($_GPC['keywords'])){
  10. $where.=" and ( a.goods_name LIKE concat('%', :name,'%') || a.id LIKE concat('%', :name,'%') || b.store_name LIKE concat('%', :name,'%'))";
  11. $data[':name']=$_GPC['keywords'];
  12. $type='all';
  13. }
  14. if($_GPC['time']){
  15. $start=strtotime($_GPC['time']['start']);
  16. $end=strtotime($_GPC['time']['end']);
  17. $where.=" and a.kt_time >='{$start}' and a.kt_time<='{$end}'";
  18. $type='all';
  19. }else{
  20. if($type=='ing'){
  21. $where.=" and a.state=1";
  22. }
  23. if($type=='success'){
  24. $where.=" and a.state=2";
  25. }
  26. if($type=='fail'){
  27. $where.=" and a.state=3";
  28. }
  29. }
  30. $sql="SELECT a.*,b.store_name FROM ".tablename('zhtc_group')." a left join".tablename('zhtc_store')." b on a.store_id=b.id ".$where." ORDER BY a.id DESC";
  31. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_group')." a left join".tablename('zhtc_store')." b on a.store_id=b.id " .$where,$data);
  32. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  33. $list=pdo_fetchall($select_sql,$data);
  34. $pager = pagination($total, $pageindex, $pagesize);
  35. //打印
  36. include $this->template('web/group');