ingoods.inc.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu2();
  4. $type=isset($_GPC['type'])?$_GPC['type']:'wait';
  5. if($type=='wait'){
  6. $_GPC['state']=1;
  7. }
  8. $where=" WHERE a.uniacid=:uniacid and b.cityname=:cityname";
  9. if(isset($_GPC['keywords'])){
  10. $op=$_GPC['keywords'];
  11. $where.=" and a.goods_name LIKE concat('%', :name,'%') ";
  12. $data[':name']=$op;
  13. $type='all';
  14. }else{
  15. if($_GPC['state']){
  16. $where.=" and a.state={$_GPC['state']} ";
  17. }
  18. }
  19. if(!empty($_GPC['time'])){
  20. $start=strtotime($_GPC['time']['start']);
  21. $end=strtotime($_GPC['time']['end']);
  22. $where.=" and a.time >={$start} and a.time<={$end}";
  23. }
  24. $state=$_GPC['state'];
  25. $pageindex = max(1, intval($_GPC['page']));
  26. $pagesize=10;
  27. $data[':uniacid']=$_W['uniacid'];
  28. $data[':cityname']= $_COOKIE['cityname'];
  29. $sql="select a.*,b.store_name from " . tablename("zhtc_goods") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id" .$where." order by a.time desc ";
  30. $total=pdo_fetchcolumn("select count(*) as wname from " . tablename("zhtc_goods") . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id".$where." order by a.time desc ",$data);
  31. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  32. $list=pdo_fetchall($select_sql,$data);
  33. $pager = pagination($total, $pageindex, $pagesize);
  34. if($_GPC['op']=='delete'){
  35. $res=pdo_delete('zhtc_goods',array('id'=>$_GPC['id']));
  36. if($res){
  37. message('删除成功!', $this->createWebUrl('ingoods'), 'success');
  38. }else{
  39. message('删除失败!','','error');
  40. }
  41. }
  42. if($_GPC['op']=='tg'){
  43. $res=pdo_update('zhtc_goods',array('state'=>2),array('id'=>$_GPC['id']));
  44. if($res){
  45. message('通过成功!', $this->createWebUrl('ingoods'), 'success');
  46. }else{
  47. message('通过失败!','','error');
  48. }
  49. }
  50. if($_GPC['op']=='jj'){
  51. $res=pdo_update('zhtc_goods',array('state'=>3),array('id'=>$_GPC['id']));
  52. if($res){
  53. message('拒绝成功!', $this->createWebUrl('ingoods'), 'success');
  54. }else{
  55. message('拒绝失败!','','error');
  56. }
  57. }
  58. include $this->template('web/ingoods');