sjtxlist.inc.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  7. $type=empty($_GPC['type']) ? 'all' :$_GPC['type'];
  8. $state=$_GPC['state'];
  9. $pageindex = max(1, intval($_GPC['page']));
  10. $pagesize=10;
  11. $where=' WHERE uniacid=:uniacid and store_id=:store_id';
  12. $data[':uniacid']=$_W['uniacid'];
  13. $data[':store_id']=$storeid;
  14. if($_GPC['keywords']){
  15. $op=$_GPC['keywords'];
  16. $where.=" and name LIKE concat('%', :name,'%') ";
  17. $data[':name']=$op;
  18. }
  19. if($type=='all'){
  20. $sql="SELECT * FROM ".tablename('zhtc_withdrawal') . " ". $where." ORDER BY time DESC";
  21. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_withdrawal') ."".$where." ORDER BY time DESC",$data);
  22. }else{
  23. $where.= " and state=".$state;
  24. $sql="SELECT * FROM ".tablename('zhtc_withdrawal') . " ".$where." ORDER BY time DESC";
  25. $data[':uniacid']=$_W['uniacid'];
  26. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_withdrawal') . " ".$where." ORDER BY time DESC",$data);
  27. }
  28. $list=pdo_fetchall( $sql,$data);
  29. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  30. $list=pdo_fetchall($select_sql,$data);
  31. $pager = pagination($total, $pageindex, $pagesize);
  32. if($operation=='delete'){
  33. $id=$_GPC['id'];
  34. $res=pdo_delete('zhtc_withdrawal',array('id'=>$id));
  35. if($res){
  36. message('删除成功',$this->createWebUrl2('sjtxlist',array()),'success');
  37. }else{
  38. message('删除失败','','error');
  39. }
  40. }
  41. include $this->template('web/sjtxlist');